def __init__(self, pytrans): self.pytrans = pytrans self.pytrans.disco.addFeature(globals.IQVERSION, self.incomingIq, config.jid) self.pytrans.disco.addFeature(globals.IQVERSION, self.incomingIq, "USER") try: self.version = "%s - SVN r%s" % (legacy.version, svninfo.getSVNVersion()) except: self.version = legacy.version self.os = "Python " + sys.version.split(' ')[0] + "/" + sys.platform + ", Twisted " + twisted.copyright.version
def __init__(self): LogEvent(INFO) try: LogEvent(INFO, msg="SVN r" + svninfo.getSVNVersion()) except: pass ### Database prep-work # Open our spool self.xdb = xdb.XDB(config.jid) # We need to enable our avatar cache if not config.disableAvatars: self.avatarCache = avatar.AvatarCache() ### Lets load some key/base functionality handlers # Service discovery support self.iq = iq.IqHandler(self) # Service discovery support self.disco = disco.ServiceDiscovery(self) # Ad-hoc commands support self.adhoc = adhoc.AdHocCommands(self) # Pubsub/PEP support #self.pubsub = pubsub.PublishSubscribe(self) # Registration support self.registermanager = register.RegisterManager(self) # Lets add some known built-in features to discovery self.disco.addIdentity("gateway", legacy.id, legacy.name, config.jid) self.disco.addFeature(globals.XHTML, None, "USER") if config.confjid and config.confjid != "": #self.discovery.addIdentity("gateway", legacy.id, legacy.name + " Chatrooms", config.confjid) self.disco.addIdentity("conference", "text", legacy.name + " Chatrooms", config.confjid) self.disco.addFeature(globals.XCONFERENCE, None, config.confjid) self.disco.addFeature(globals.IQCONFERENCE, None, config.confjid) # Lets load the base and legacy service plugins self.serviceplugins = {} self.loadPlugins("src/services") self.loadPlugins("src/legacy/services") # Misc tracking variables self.startTime = int(time.time()) self.xmlstream = None self.sessions = {} # Message IDs self.messageID = 0 # Routine cleanup/updates/etc self.loopTask = task.LoopingCall(self.loopFunc) self.loopTask.start(60.0)