def run(self): log.msg("Init hermes logic unit instance") self.tagParser = TagParser() # preparing database self.db = sqlite3.connect(os.path.join(config()["spool"]["path"], config()["spool"]["db"])) self.db.isolation_level = None self.db.row_factory = sqlite3.Row c = self.db.cursor() c.execute( """CREATE TABLE IF NOT EXISTS contacts (id INTEGER PRIMARY KEY AUTOINCREMENT, type INTEGER, address TEXT, privilege INTEGER, subscription TEXT)""" ) c.execute( """CREATE UNIQUE INDEX IF NOT EXISTS uniq_contact_address ON contacts(type, address)""" ) self.contacts = ContactsManager() self.xmpp = xmpp.XmppMessenger() demon.init() super(HermesCore, self).run()
def run(self): log.msg("Init hermes logic unit instance") self.tagParser = TagParser() # preparing database self.db = sqlite3.connect( os.path.join(config()['spool']['path'], config()['spool']['db'])) self.db.isolation_level = None self.db.row_factory = sqlite3.Row c = self.db.cursor() c.execute('''CREATE TABLE IF NOT EXISTS contacts (id INTEGER PRIMARY KEY AUTOINCREMENT, type INTEGER, address TEXT, privilege INTEGER, subscription TEXT)''') c.execute('''CREATE UNIQUE INDEX IF NOT EXISTS uniq_contact_address ON contacts(type, address)''') self.contacts = ContactsManager() self.xmpp = xmpp.XmppMessenger() demon.init() super(HermesCore, self).run()
def __init__(self): super(XmppMessenger, self).__init__() self.me = jid.JID(config()['xmpp']['me']) self.xmlstream = False self.kaTimer = None self.kaResponseTimer = None self.lastSendTime = datetime.datetime.today() - datetime.timedelta(days=1) f = client.XMPPClientFactory(self.me, config()['xmpp']['password']) f.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT, self.connected) f.addBootstrap(xmlstream.STREAM_END_EVENT, self.disconnected) f.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.authenticated) f.addBootstrap(xmlstream.INIT_FAILED_EVENT, self.init_failed) self.connector = XMPPClientConnector(reactor, self.me.host, f) self.connect()
def __init__(self): super(XmppMessenger, self).__init__() self.me = jid.JID(config()['xmpp']['me']) self.xmlstream = False self.kaTimer = None self.kaResponseTimer = None self.lastSendTime = datetime.datetime.today() - datetime.timedelta( days=1) f = client.XMPPClientFactory(self.me, config()['xmpp']['password']) f.addBootstrap(xmlstream.STREAM_CONNECTED_EVENT, self.connected) f.addBootstrap(xmlstream.STREAM_END_EVENT, self.disconnected) f.addBootstrap(xmlstream.STREAM_AUTHD_EVENT, self.authenticated) f.addBootstrap(xmlstream.INIT_FAILED_EVENT, self.init_failed) self.connector = XMPPClientConnector(reactor, self.me.host, f) self.connect()
def pickServer(self): host, port = SRVConnector.pickServer(self) if not self.servers and not self.orderedServers: # no SRV record, fall back.. port = int(config()['xmpp']['port']) return host, port
def auth(self, user, password): logins = config()["logins"]["login"] authorized = filter(lambda l: l.user == user and l.password == password, logins) if len(authorized): self.senderName = " or ".join([i.name for i in authorized]) self.senderLogin = user return True return False
def auth(self, user, password): logins = config()['logins']['login'] authorized = filter( lambda l: l.user == user and l.password == password, logins) if len(authorized): self.senderName = " or ".join([i.name for i in authorized]) self.senderLogin = user return True return False
def __init__(self,**kwargs): self.lexer = lex.lex(module=self, **kwargs) self.parser = yacc.yacc(module=self, outputdir=config()['spool']['path'], debugfile=os.path.join(config()['spool']['path'], "tag_parser_debug.log"))
def servicesDict(self): ret = {} logins = config()["logins"]["login"] for l in logins: ret[l.user] = l.name return ret
def servicesDict(self): ret = {} logins = config()['logins']['login'] for l in logins: ret[l.user] = l.name return ret