예제 #1
0
 def __init__(self, q):
     self.version_name = u"freQ"
     self.version_version = u"1.0.0 (20080118)"
     self.version_os = u"Twisted %s, Python %s" % (twisted.__version__, sys.version)
     self.authd = 0
     self.wrapper = wrapper()
     self.wrapper.onauthd = self.onauthd
     self.wrapper.register_handler(self.iq_handler, "iq", "get")
     self.wrapper.c.addBootstrap("//event/client/basicauth/authfailed", self.failed)
     self.wrapper.c.addBootstrap("//event/client/basicauth/invaliduser", self.failed)
     print "ok"
     self.g = {}
     self.alias_engine = None
     self.plug = pluginloader(self, q)
     self.muc = muc(self)
     self.log = log.logger()
     self.log.log("freQ %s started with pid=%s" % (self.version_version, os.getpid()))
     self.cmdhandlers = []
     if config.ENABLE_SQLITE:
         self.db = db.db()
     self.wrapper.register_msg_handler(self.call_cmd_handlers, u".*")
     try:
         tl = config.LOGF
     except:
         tl = "./twisted.log"
     if not os.access(tl, 0):
         fp = file(tl, "w")
         fp.write("# freQ\n")
         fp.close()
     twisted.python.log.startLogging(open(tl, "a"))
     twisted.python.log.addObserver(self.error_handler)
예제 #2
0
파일: freq.py 프로젝트: cobrab11/freq-bot
 def __init__(self, env):
     self.env = env
     self.log = log.logger()
     if not os.access(config.LOGF, 0):
         fp = file(config.LOGF, 'w')
         fp.write('# freQ log\n')
         fp.close()
     twisted.python.log.startLogging(open(config.LOGF, 'a'))
     twisted.python.log.addObserver(self.error_handler)
     self.stopped = False
     self.smart_shutdown = False
     self.censor = censor()
     self.g = {}
     self.cmdhandlers = []
     self.msghandlers = []
     self.topichandlers = []
     self.joinhandlers = []
     self.leavehandlers = []
     self.badhandlers = []
     self.rewriteengines = []
     self.access_modificators = []
     self.cmd_cache = {}
     self.want_restart = False
     featlist = [
         'http://jabber.org/protocol/caps',
         'http://jabber.org/protocol/muc',
         'http://jabber.org/protocol/disco#info', 'urn:xmpp:ping',
         'urn:xmpp:time', 'jabber:iq:version', 'vcard-temp'
     ]
     self.features = sorted(featlist)
     self.version_name = u'FreQ-bot'
     self.version_version = self.getVer()
     self.log.version = self.version_version
     self.caps = self.genCaps()
     if config.SHARE_OS:
         self.version_os = u'Twisted %s, Python %s' % (twisted.__version__,
                                                       sys.version)
     else:
         self.version_os = 'SomeOS'
     self.authd = 0
     self.wrapper = wrapper(self.version_version, self.caps)
     self.wrapper.onauthd = self.onauthd
     self.wrapper.c.addBootstrap('//event/client/basicauth/authfailed',
                                 self.failed)
     self.wrapper.c.addBootstrap('//event/client/basicauth/invaliduser',
                                 self.failed)
     self.plug = pluginloader(self)
     self.log.log('<b>freQ %s (PID: %s) Initialized</b>' %
                  (self.version_version, os.getpid()))
     #reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown)
     self.cc = task.LoopingCall(self.clean_cmd_cache)
     self.cc.start(10)
     self.k_a = task.LoopingCall(self.keep_alive)
     self.k_a.start(config.KEEP_ALIVE_INTERVAL)
예제 #3
0
파일: freq.py 프로젝트: setazer/freq-bot
 def __init__(self, env):
  self.env = env
  self.log = log.logger()
  if not os.access(config.LOGF, 0):
   fp = open(config.LOGF, 'w')
   fp.write('# freQ log\n')
   fp.close()
  twisted.python.log.startLogging(open(config.LOGF, 'a'))
  twisted.python.log.addObserver(self.error_handler)
  self.stopped = False
  self.smart_shutdown = False
  self.censor = censor()
  self.g = {}
  self.cmdhandlers = []
  self.msghandlers = []
  self.topichandlers = []
  self.joinhandlers = []
  self.leavehandlers = []
  self.badhandlers = []
  self.rewriteengines = []
  self.access_modificators = []
  self.cmd_cache = {}
  self.want_restart = False
  featlist = ['http://jabber.org/protocol/caps', 'http://jabber.org/protocol/muc', 'http://jabber.org/protocol/disco#info', 'urn:xmpp:ping', 'urn:xmpp:time', 'jabber:iq:version', 'vcard-temp']
  self.features = sorted(featlist)
  self.version_name = u'FreQ-bot'
  self.version_version = self.getVer()
  self.log.version = self.version_version
  self.caps = self.genCaps()
  if config.SHARE_OS: 
   self.version_os = u'Twisted %s, Python %s' % (twisted.__version__, sys.version)
  else: self.version_os = 'SomeOS'
  self.authd = 0
  self.wrapper = wrapper(self.version_version, self.caps)
  self.wrapper.onauthd = self.onauthd
  self.wrapper.c.addBootstrap('//event/client/basicauth/authfailed', self.failed)
  self.wrapper.c.addBootstrap('//event/client/basicauth/invaliduser', self.failed)
  self.plug = pluginloader(self)
  self.log.log('<b>freQ %s (PID: %s) Initialized</b>' % (self.version_version, os.getpid()))
  #reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown)
  self.cc = task.LoopingCall(self.clean_cmd_cache)
  self.cc.start(10)
  self.k_a = task.LoopingCall(self.keep_alive)
  self.k_a.start(config.KEEP_ALIVE_INTERVAL)
예제 #4
0
 def __init__(self, env):
     self.env = env
     self.log = log.logger()
     if not os.access(config.LOGF, 0):
         fp = file(config.LOGF, "w")
         fp.write("# freQ log\n")
         fp.close()
     twisted.python.log.startLogging(open(config.LOGF, "a"))
     twisted.python.log.addObserver(self.error_handler)
     self.stopped = False
     self.smart_shutdown = False
     self.censor = censor()
     self.g = {}
     self.cmdhandlers = []
     self.msghandlers = []
     self.topichandlers = []
     self.joinhandlers = []
     self.leavehandlers = []
     self.badhandlers = []
     self.rewriteengines = []
     self.access_modificators = []
     self.cmd_cache = {}
     self.want_restart = False
     self.version_name = u"freqbot"
     self.version_version = self.getVer()
     self.log.version = self.version_version
     if config.SHARE_OS:
         self.version_os = u"Twisted %s, Python %s" % (twisted.__version__, sys.version)
     else:
         self.version_os = "SomeOS"
     self.authd = 0
     self.wrapper = wrapper(self.version_version)
     self.wrapper.onauthd = self.onauthd
     self.wrapper.c.addBootstrap("//event/client/basicauth/authfailed", self.failed)
     self.wrapper.c.addBootstrap("//event/client/basicauth/invaliduser", self.failed)
     self.plug = pluginloader(self)
     self.log.log("<b>freQ %s (PID: %s) Initialized</b>" % (self.version_version, os.getpid()))
     # reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown)
     self.cc = task.LoopingCall(self.clean_cmd_cache)
     self.cc.start(10)
     self.k_a = task.LoopingCall(self.keep_alive)
     self.k_a.start(config.KEEP_ALIVE_INTERVAL)
예제 #5
0
 def __init__(self, q):
  self.log = log.logger()
  if not os.access(config.LOGF, 0):
   fp = file(config.LOGF, 'w')
   fp.write('# freQ log\n')
   fp.close()
  twisted.python.log.startLogging(open(config.LOGF, 'a'))
  twisted.python.log.addObserver(self.error_handler)
  self.stopped = False
  self.smart_shutdown = False
  self.censor = censor()
  self.g = {}
  self.cmdhandlers = []
  self.msghandlers = []
  self.topichandlers = []
  self.joinhandlers = []
  self.leavehandlers = []
  self.badhandlers = []
  self.rewriteengines = []
  self.access_modificators = []
  self.cmd_cache = {}
  self.version_name = u'freQ'
  self.version_version = u'1.1.0 (20080131)'
  self.log.version = self.version_version
  self.version_os = u'Twisted %s, Python %s' % (twisted.__version__, sys.version)
  self.authd = 0
  self.wrapper = wrapper(self.version_version)
  self.wrapper.onauthd = self.onauthd
  self.wrapper.c.addBootstrap('//event/client/basicauth/authfailed', self.failed)
  self.wrapper.c.addBootstrap('//event/client/basicauth/invaliduser', self.failed)
  if config.ENABLE_SQLITE: self.db = db.db()
  self.plug = pluginloader(self, q)
  print 'Initialized'
  self.log.log('<b>freQ %s (PID: %s) Initialized</b>' % (self.version_version, os.getpid()))
  #reactor.addSystemEventTrigger('before', 'shutdown', self.shutdown)
  self.cc = task.LoopingCall(self.clean_cmd_cache)
  self.cc.start(10)
  self.k_a = task.LoopingCall(self.keep_alive)
  self.k_a.start(config.KEEP_ALIVE_INTERVAL)