def __init__(self, nodedict={}): GozerEvent.__init__(self, nodedict) self.element = "iq" self.jabber = True self.cmnd = "IQ" self.cbtype = "IQ" self.bottype = "xmpp"
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 = {}
def __init__(self, nodedict={}): GozerEvent.__init__(self, nodedict) self.element = "presence" self.jabber = True self.cmnd = "PRESENCE" self.cbtype = "PRESENCE" self.bottype = "xmpp"
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)
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)
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)
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 = []