def docmnd(self, origin, channel, txt, event=None, wait=0, showall=False, nooutput=False): """ do a command. """ if event: e = cpy(event) else: e = EventBase() e.cbtype = "CMND" e.bot = self e.origin = origin e.auth = origin e.userhost = origin e.channel = channel e.txt = unicode(txt) e.nick = e.userhost.split('@')[0] e.usercmnd = e.txt.split()[0] e.allowqueues = True e.closequeue = True e.showall = showall e.nooutput = nooutput e.bind(self) if cmnds.woulddispatch(self, e) or e.txt[0] == "?": return self.doevent(e)
def make_event(self, origin, channel, txt, event=None, wait=0, showall=False, nooutput=False, cbtype=""): """ insert an event into the callbacks chain. """ if event: e = cpy(event) else: e = EventBase(bot=self) e.cbtype = cbtype or "CMND" e.origin = origin or "test@test" e.auth = e.origin e.userhost = e.origin e.channel = channel if 'socket' in repr(channel): e.socket = channel e.txt = unicode(txt) e.nick = (event and event.nick) or stripident(e.userhost.split('@')[0]) e.showall = showall e.nooutput = nooutput e.wait = wait e.closequeue = False e.bind(self) return e
def putevent(self, origin, channel, txt, event=None, wait=0, showall=False, nooutput=False): """ insert an event into the callbacks chain. """ assert origin if event: e = cpy(event) ; e.addwaiting(event) else: e = EventBase() e.cbtype = "CMND" e.bot = self e.origin = origin e.ruserhost = origin e.auth = origin e.userhost = origin e.channel = channel e.txt = unicode(txt) e.nick = e.userhost.split('@')[0] e.usercmnd = e.txt.split()[0] e.iscommand = False #e.iscallback = False e.allowqueues = True e.onlyqueues = False e.closequeue = True e.showall = showall e.nooutput = nooutput e.wait = wait e.bind(self) self.put(e) return e
def putevent(self, origin, channel, txt, event=None, wait=0, showall=False, nooutput=False): """ insert an event into the callbacks chain. """ assert origin if event: e = cpy(event) else: e = EventBase() e.cbtype = "CMND" e.bot = self e.origin = origin e.ruserhost = origin e.auth = origin e.userhost = origin e.channel = channel e.txt = unicode(txt) e.nick = e.userhost.split('@')[0] e.usercmnd = e.txt.split()[0] e.iscommand = False #e.iscallback = False e.allowqueues = True e.onlyqueues = False e.closequeue = True e.showall = showall e.nooutput = nooutput e.wait = wait e.bind(self) self.put(e) return e