def post_init(self): """ Configure this module to start handling the muc issues. :return: """ self._channel_name = configuration.get_configuration().get( configuration.MUC_SECTION_NAME, configuration.ROOM_KEY ) self._nick = configuration.get_configuration().get(configuration.MUC_SECTION_NAME, configuration.ROOM_NICK_KEY) self.xmpp.add_event_handler(self.xmpp["rho_bot_configuration"].CONFIGURATION_RECEIVED_EVENT, self._join_room)
def __init__(self): # Set up the configuration details to call the super constructor. jid = configuration.get_configuration().get(configuration.CONNECTION_SECTION_NAME, configuration.JID_KEY) password = configuration.get_configuration().get( configuration.CONNECTION_SECTION_NAME, configuration.PASSWORD_KEY ) logger.info("Attempting to configure with: %s %s" % (jid, password)) sleekxmpp.ClientXMPP.__init__(self, jid, password) # Set up the configuration details for the name of the bot. self.name = configuration.get_configuration().get(configuration.BOT_SECTION_NAME, configuration.NAME_KEY) # Register the plugins for plugin in self.required_plugins: self.register_plugin(plugin) # The session_start event will be triggered when # the bot establishes its connection with the server # and the XML streams are ready for use. We want to # listen for this event so that we we can initialize # our roster. self.add_event_handler("session_start", self.start)