예제 #1
0
파일: iq.py 프로젝트: Petraea/jsonbot
 def __init__(self, nodedict={}):
     GozerEvent.__init__(self, nodedict)
     self.element = "iq"
     self.jabber = True
     self.cmnd = "IQ"
     self.cbtype = "IQ"
     self.bottype = "xmpp"
예제 #2
0
 def finish(self, data):
     """ finish processing of an xml stanza. """
     methods = []
     self.final['subelements'] = self.subelements
     for subelement in self.subelements:
         logging.debug("%s - %s" % (self.cfg.name, str(subelement)))
         for elem in subelement:
             logging.debug("%s - setting %s handler" % (self.cfg.name, elem))
             methods.append(self.getHandler(elem))
         for method in methods:
             if not method: continue
             try:
                 result = GozerEvent(subelement)
                 result.bot = self
                 result.orig = data
                 result.jabber = True
                 method(result) 
             except Exception, ex: handle_exception()
     if self.tags:
         element = self.tags[0]
         logging.debug("%s - setting element: %s" % (self.cfg.name, element))
     else: element = 'stream'
     self.final['element'] = element
     method = self.getHandler(element)
     if method:
         try:
             result = GozerEvent(self.final)
             result.bot = self
             result.orig = data
             result.jabber = True
             method(result) 
         except Exception, ex:
             handle_exception()
             result = {}
예제 #3
0
파일: presence.py 프로젝트: Petraea/jsonbot
 def __init__(self, nodedict={}):
     GozerEvent.__init__(self, nodedict)
     self.element = "presence"
     self.jabber = True
     self.cmnd = "PRESENCE"
     self.cbtype = "PRESENCE"
     self.bottype = "xmpp"
예제 #4
0
파일: iq.py 프로젝트: Lujeni/old-projects
 def __init__(self, nodedict={}):
     GozerEvent.__init__(self, nodedict)
     self.element = "iq"
     self.jabber = True
     self.cmnd = "IQ"
     self.cbtype = "IQ"
     self.bottype = "xmpp"
예제 #5
0
 def __init__(self, nodedict={}):
     self.element = "message"
     self.jabber = True
     self.cmnd = "MESSAGE"
     self.cbtype = "MESSAGE"
     self.bottype = "xmpp"
     self.type = "normal"
     GozerEvent.__init__(self, nodedict)
예제 #6
0
파일: message.py 프로젝트: melmothx/jsonbot
 def __init__(self, nodedict={}):
     self.element = "message"
     self.jabber = True
     self.cmnd = "MESSAGE"
     self.cbtype = "MESSAGE"
     self.bottype = "xmpp"
     self.type = "normal"
     GozerEvent.__init__(self, nodedict)
예제 #7
0
 def __init__(self, origin=None, payload=None, type="event", key=None):
     GozerEvent.__init__(self)
     self.createtime = time.time()
     self.origin = origin
     self.type = str(type)
     self.payload = payload
     self.makeid()
     if key: self.makehmac(key)
     else: self.makehmac(self.id)
예제 #8
0
 def __init__(self, origin=None, payload=None, type="event", key=None, how="direct"):
     GozerEvent.__init__(self)
     self.createtime = time.time()
     self.origin = origin
     self.type = str(type) 
     self.payload = payload
     self.makeid()
     if key: self.makehmac(key)
     else: self.makehmac(self.id)
예제 #9
0
파일: core.py 프로젝트: melmothx/jsonbot
             result.bot = self
             result.orig = data
             result.jabber = True
             method(result)
         except Exception, ex:
             handle_exception()
 if self.tags:
     element = self.tags[0]
     logging.debug("%s - setting element: %s" % (self.name, element))
 else:
     element = 'stream'
 self.final['element'] = element
 method = self.getHandler(element)
 if method:
     try:
         result = GozerEvent(self.final)
         result.bot = self
         result.orig = data
         result.jabber = True
         method(result)
     except Exception, ex:
         handle_exception()
         result = {}
 else:
     logging.error("%s - can't find handler for %s" %
                   (self.name, element))
     result = {}
 if result:
     self.final = {}
     self.reslist = []
     self.tags = []