def doevent(self, event): """ dispatch an event. """ time.sleep(0.01) if not self.cfg: raise Exception( "eventbase - cfg is not set .. can't handle event.") return if not event: raise NoEventProvided() self.ecounter += 1 if event.userhost in self.state['ignore']: logging.warn("%s - ignoring %s" % (self.cfg.name, event.userhost)) return try: if event.isremote(): self.doremote(event) return if event.type == "groupchat" and event.fromm in self.ids: logging.debug("%s - receiving groupchat from self (%s)" % (self.cfg.name, event.fromm)) return event.txt = self.inputmorphs.do(fromenc(event.txt, self.encoding), event) except UnicodeDecodeError: logging.warn("%s - got decode error in input .. ingoring" % self.cfg.name) return event.bind(self, noraise=True) try: logging.debug("%s - event dump: %s" % (self.cfg.name, event.dump())) except: pass self.status = "callback" starttime = time.time() if self.closed: if self.gatekeeper.isblocked(event.origin): logging.warn("%s is blocked" % event.origin) return if event.status == "done": logging.warn("%s - event is done .. ignoring" % self.cfg.name) return if event.msg or event.isdcc: event.speed = 2 if event.channelchanged: cmnds.dispatch(self, event) return e1 = cpy(event) first_callbacks.check(self, e1) if not e1.stop: callbacks.check(self, e1) if not e1.stop: last_callbacks.check(self, e1) event.callbackdone = True waiter.check(self, event) #mainsink.put(5, self, event) self.lastiter = time.time() self.benice() return event
def doevent(self, event): """ dispatch an event. """ if not event: raise NoEventProvided() if event.isremote(): self.doremote(event) return event.txt = self.inputmorphs.do(fromenc(event.txt, self.encoding)) msg = "%s - %s - %s - %s" % (self.name, event.auth, event.how, event.cbtype) if event.cbtype in ['NOTICE']: logging.warn("%s - %s - %s" % (self.name, event.nick, event.txt)) else: try: int(event.cbtype) logging.debug("======== start handling local event ========") logging.debug(msg) except (ValueError, TypeError): if event.cbtype in ['PING', 'PRESENCE' ] or event.how == "background": logging.debug( "======== start handling local event ========") logging.debug(msg) else: logging.info( "======== start handling local event ========") logging.info(msg) logging.debug(event.dump()) event.prepare(self) self.status = "callback" starttime = time.time() if self.closed: if self.gatekeeper.isblocked(event.origin): return if event.status == "done": logging.debug("%s - event is done .. ignoring" % self.name) return self.reloadcheck(event) if event.msg or event.isdcc: event.speed = 2 e1 = cpy(event) first_callbacks.check(self, e1) if not e1.stop: callbacks.check(self, e1) if not e1.stop: last_callbacks.check(self, e1) event.callbackdone = True if not self.isgae: import asyncore asyncore.loop() return event
def doevent(self, event): """ dispatch an event. """ time.sleep(0.01) if not self.cfg: raise Exception("eventbase - cfg is not set .. can't handle event.") ; return if not event: raise NoEventProvided() try: if event.isremote(): self.doremote(event) ; return if event.type == "groupchat" and event.fromm in self.ids: logging.warn("%s - receiving groupchat from self (%s)" % (self.cfg.name, event.fromm)) return event.txt = self.inputmorphs.do(fromenc(event.txt, self.encoding), event) except UnicodeDecodeError: logging.warn("%s - got decode error in input .. ingoring" % self.cfg.name) ; return logtxt = "%s - %s ======== start handling local event ======== %s" % (self.cfg.name, event.cbtype, event.userhost) if event.cbtype in ['NOTICE']: logging.warn("%s - %s - %s" % (self.cfg.name, event.nick, event.txt)) else: try: int(event.cbtype) logging.debug(logtxt) except (ValueError, TypeError): if event.cbtype in ['PING', 'PRESENCE'] or event.how == "background": logging.debug(logtxt) else: logging.info(logtxt) event.bind(self) try: logging.debug("%s - event dump: %s" % (self.cfg.name, event.dump())) except: pass self.status = "callback" starttime = time.time() if self.closed: if self.gatekeeper.isblocked(event.origin): return if event.status == "done": logging.debug("%s - event is done .. ignoring" % self.cfg.name) return self.reloadcheck(event) if event.msg or event.isdcc: event.speed = 2 e1 = event first_callbacks.check(self, e1) if not e1.stop: callbacks.check(self, e1) if not e1.stop: last_callbacks.check(self, e1) event.callbackdone = True waiter.check(self, event) #self.benice(event) return event
def doevent(self, event): """ dispatch an event. """ time.sleep(0.01) if not self.cfg: raise Exception("eventbase - cfg is not set .. can't handle event.") ; return if not event: raise NoEventProvided() self.ecounter += 1 if event.userhost in self.state['ignore']: logging.warn("%s - ignoring %s" % (self.cfg.name, event.userhost)) ; return try: if event.isremote(): self.doremote(event) ; return if event.type == "groupchat" and event.fromm in self.ids: logging.debug("%s - receiving groupchat from self (%s)" % (self.cfg.name, event.fromm)) return event.txt = self.inputmorphs.do(fromenc(event.txt, self.encoding), event) except UnicodeDecodeError: logging.warn("%s - got decode error in input .. ingoring" % self.cfg.name) ; return event.bind(self, noraise=True) try: logging.debug("%s - event dump: %s" % (self.cfg.name, event.dump())) except: pass self.status = "callback" starttime = time.time() if self.closed: if self.gatekeeper.isblocked(event.origin): logging.warn("%s is blocked" % event.origin) ; return if event.status == "done": logging.warn("%s - event is done .. ignoring" % self.cfg.name) return if event.msg or event.isdcc: event.speed = 2 if event.channelchanged: cmnds.dispatch(self, event) ; return e1 = cpy(event) first_callbacks.check(self, e1) if not e1.stop: callbacks.check(self, e1) if not e1.stop: last_callbacks.check(self, e1) event.callbackdone = True waiter.check(self, event) #mainsink.put(5, self, event) self.lastiter = time.time() self.benice() return event
def doevent(self, event): """ dispatch an event. """ if not event: raise NoEventProvided() if event.isremote(): self.doremote(event) ; return event.txt = self.inputmorphs.do(fromenc(event.txt, self.encoding)) msg = "%s - %s - %s - %s" % (self.name, event.auth, event.how, event.cbtype) if event.cbtype in ['NOTICE']: logging.warn("%s - %s - %s" % (self.name, event.nick, event.txt)) else: try: int(event.cbtype) logging.debug("======== start handling local event ========") logging.debug(msg) except (ValueError, TypeError): if event.cbtype in ['PING', 'PRESENCE'] or event.how == "background": logging.debug("======== start handling local event ========") logging.debug(msg) else: logging.info("======== start handling local event ========") ; logging.info(msg) logging.debug(event.dump()) event.prepare(self) self.status = "callback" starttime = time.time() if self.closed: if self.gatekeeper.isblocked(event.origin): return if event.status == "done": logging.debug("%s - event is done .. ignoring" % self.name) return self.reloadcheck(event) if event.msg or event.isdcc: event.speed = 2 e1 = cpy(event) first_callbacks.check(self, e1) if not e1.stop: callbacks.check(self, e1) if not e1.stop: last_callbacks.check(self, e1) event.callbackdone = True if not self.isgae: import asyncore ; asyncore.loop() return event