Exemple #1
0
 def __init__(self, cfg=None, usersin=None, plugs=None, jid=None, *args, **kwargs):
     BotBase.__init__(self, cfg, usersin, plugs, jid, *args, **kwargs)
     self.port = 5222
     if not self.host:
         self.host = self.cfg.host
         if not self.host: raise Exception("%s - host not set - %s" % (self.name, str(self.cfg)))
     self.username = self.user.split('@')[0]
     XMLStream.__init__(self, self.host, self.port, self.name)   
     self.type = 'sxmpp'
     self.sock = None
     self.me = self.cfg.user
     self.jid = self.me
     self.lastin = None
     self.test = 0
     self.password = ""
     self.connecttime = 0
     self.connection = None
     self.privwait = XMPPWait()
     self.errorwait = XMPPErrorWait()
     self.jabber = True
     self.jids = {}
     self.topics = {}
     self.timejoined = {}
     self.channels409 = []
     if self.state and not self.state.data.ratelimit: self.state.data.ratelimit = 0.05
     if self.port == 0: self.port = 5222
Exemple #2
0
 def __init__(self, cfg=None, usersin=None, plugs=None, jid=None, *args, **kwargs):
     BotBase.__init__(self, cfg, usersin, plugs, jid, *args, **kwargs)
     if not self.cfg: raise Exception("sxmpp - config is not set.")
     if not self.cfg.user: raise NoUserProvided("please make sure the user config variable is set in %s (or use -u)"  % cfg.cfile)
     try: self.cfg.username, self.cfg.host = self.cfg.user.split('@')
     except (ValueError, TypeError): raise Exception("%s - user not set - %s" % (self.cfg.name, str(self.cfg)))
     XMLStream.__init__(self, self.cfg.name)   
     self.type = 'sxmpp'
     self.sock = None
     self.lastin = None
     self.test = 0
     self.connecttime = 0
     self.connection = None
     self.jabber = True
     self.jids = {}
     self.topics = {}
     self.timejoined = {}
     self.channels409 = []
     if self.state and not self.state.data.ratelimit: self.state.data.ratelimit = 0.02
     try: self.cfg.port = int(self.cfg.port)
     except (ValueError, TypeError): self.cfg.port = 5222
     logging.debug("%s - user is %s" % (self.cfg.name, self.cfg.user))
Exemple #3
0
 def __init__(self,
              cfg=None,
              usersin=None,
              plugs=None,
              jid=None,
              *args,
              **kwargs):
     BotBase.__init__(self, cfg, usersin, plugs, jid, *args, **kwargs)
     if not self.cfg: raise Exception("sxmpp - config is not set.")
     if not self.cfg.user:
         raise NoUserProvided(
             "please make sure the user config variable is set in %s (or use -u)"
             % cfg.cfile)
     try:
         self.cfg.username, self.cfg.host = self.cfg.user.split('@')
     except (ValueError, TypeError):
         raise Exception("%s - user not set - %s" %
                         (self.cfg.name, str(self.cfg)))
     XMLStream.__init__(self, self.cfg.name)
     self.type = 'sxmpp'
     self.sock = None
     self.lastin = None
     self.test = 0
     self.connecttime = 0
     self.connection = None
     self.jabber = True
     self.jids = {}
     self.topics = {}
     self.timejoined = {}
     self.channels409 = []
     if self.state and not self.state.data.ratelimit:
         self.state.data.ratelimit = 0.02
     try:
         self.cfg.port = int(self.cfg.port)
     except (ValueError, TypeError):
         self.cfg.port = 5222
     logging.debug("%s - user is %s" % (self.cfg.name, self.cfg.user))