#NEWLINE# def __init__( self , door_states , time_of_last_state_change ) : #NEWLINE# #INDENT# self . logger = logging . getLogger ( __name__ ) #NEWLINE# self . connected = False #NEWLINE# self . door_states = door_states #NEWLINE# self . time_of_last_state_change = door_states #NEWLINE# if ( not hasattr ( cfg , 'JABBER_ID' ) ) : #NEWLINE# #INDENT# self . logger . debug ( 'Jabber ID not defined - Jabber support disabled' ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( cfg . JABBER_ID == '' ) : #NEWLINE# #INDENT# self . logger . debug ( 'Jabber ID not configured - Jabber support disabled' ) #NEWLINE# return #NEWLINE# #UNINDENT# self . logger . info ( 'Signing into Jabber as %s' , cfg . JABBER_ID ) #NEWLINE# sleekxmpp . ClientXMPP . __init__ ( self , cfg . JABBER_ID , cfg . JABBER_PASSWORD ) #NEWLINE# self . add_event_handler ( 'session_start' , self . handle_session_start ) #NEWLINE# self . add_event_handler ( 'message' , self . handle_message ) #NEWLINE# self . add_event_handler ( 'ssl_invalid_cert' , self . ssl_invalid_cert ) #NEWLINE# self . use_signals ( ) #NEWLINE# self . register_plugin ( 'xep_0030' ) #NEWLINE# self . register_plugin ( 'xep_0004' ) #NEWLINE# self . register_plugin ( 'xep_0060' ) #NEWLINE# self . register_plugin ( 'xep_0199' ) #NEWLINE# if ( hasattr ( cfg , 'JABBER_SERVER' ) and hasattr ( cfg , 'JABBER_PORT' ) ) : #NEWLINE# #INDENT# if ( not self . connect ( ( cfg . JABBER_SERVER , cfg . JABBER_PORT ) ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( not self . connect ( ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# #UNINDENT# self . process ( block = False ) #NEWLINE# self . connected = True