def __init__(self, login, passwd, res, chat, name, modules, session, force_ipv4, address=None, port=None): sleekxmpp.ClientXMPP.__init__(self, "%s/%s" % (login, res), passwd) n_port = port if port is not None else 5222 # TODO : do an SRV lookup on address or self.boundjid.host n_address = address if address is not None else self.boundjid.host if address is None and port is None : t_address = () else : t_address = (n_address, n_port) logger.info("Connecting to %s", chat) self.use_ipv6 = not force_ipv4 # Connecting con = self.connect(address=t_address, reattempt=False) if not con: logger.error(_("Unable to connect !")) raise XMPPException(_("Unable to connect !")) self.registerPlugin("xep_0045") # When the session start (bot connected) the connect_muc method will be called self.add_event_handler("session_start", self.connect_muc) # sleekxmpp handlers to XMPP stanzas self.add_event_handler("message", self.message_handler) self.add_event_handler("groupchat_presence", self.presence_handler) self.add_event_handler("failed_auth", self.failed_auth) PipoBot.__init__(self, name, login, chat, modules, session) self.process(threaded=True)
def __init__(self, login, passwd, res, chat, name, modules, session, force_ipv4): sleekxmpp.ClientXMPP.__init__(self, "%s/%s" % (login, res), passwd) logger.info("Connecting to %s", chat) self.use_ipv6 = not force_ipv4 # Connecting con = self.connect(reattempt=False) if not con: logger.error(_("Unable to connect !")) raise XMPPException(_("Unable to connect !")) self.registerPlugin("xep_0045") # When the session start (bot connected) the connect_muc method will be called self.add_event_handler("session_start", self.connect_muc) # sleekxmpp handlers to XMPP stanzas self.add_event_handler("message", self.message) self.add_event_handler("groupchat_presence", self.presence) self.add_event_handler("failed_auth", self.failed_auth) PipoBot.__init__(self, name, login, chat, modules, session) self.process(threaded=True)
def __init__(self, name, login, chatname, modules, session): PipoBot.__init__(self, name, login, chatname, modules, session) self.occupants.add_user(name, login, "moderator") logger.info("Starting console bot in fake room %s" % self.chatname) self.session = session # Since we are in test mode, we remove time constraints for module in self.sync_mods: if hasattr(module, "lock_name"): del module.lock_name
def __init__(self, name, login, chatname, modules, session): PipoBot.__init__(self, name, login, chatname, None, modules, session) self.occupants.add_user(name, login, "moderator") logger.info("Starting console bot in fake room %s" % self.chatname) self.session = session # Since we are in test mode, we remove time constraints for module in self.sync: if hasattr(module, "lock_name"): del module.lock_name