#NEWLINE# def before_send( self ) : #NEWLINE# #INDENT# def on_session_start( event ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# self . xmpp . send_presence ( ) #NEWLINE# self . xmpp . get_roster ( ) #NEWLINE# self . _session_started = True #NEWLINE# #UNINDENT# except self . lib . exceptions . XMPPError as e : #NEWLINE# #INDENT# raise MessengerWarmupException ( ( 'XMPP Error: %s' % e ) ) #NEWLINE# #UNINDENT# #UNINDENT# self . xmpp = self . lib . ClientXMPP ( self . from_jid , self . password ) #NEWLINE# self . xmpp . add_event_handler ( 'session_start' , on_session_start ) #NEWLINE# result = self . xmpp . connect ( address = ( self . host , on_session_start . port ) , reattempt = False , use_tls = self . use_tls , use_ssl = self . use_ssl ) #NEWLINE# if result : #NEWLINE# #INDENT# self . xmpp . process ( block = False )