def testasync(self, txt, timeout=0, kw={}): """ run txt with test ievent. don't close queues on exit.""" txt = txt.strip() ievent = Ircevent() ievent.bot = self ievent.cmnd = 'PRIVMSG' ievent.nick = 'test' ievent.userhost = 'test@test' ievent.origtxt = txt ievent.txt = ievent.origtxt ievent.channel = '#test' ievent.allowqueue = False ievent.closequeue = False if kw: for i, j in kw.iteritems(): setattr(ievent, i, j) if timeout: result = plugins.cmnd(self, ievent, timeout) else: result = plugins.cmnd(self, ievent, 10) rlog(100, self.name, str(result)) return result
def handle_ievent(self, ievent): """ check for callbacks, call Irc method. """ try: # call parent method Irc.handle_ievent(self, ievent) # check for callbacks if ievent.cmnd == 'JOIN' or ievent.msg: if ievent.nick.lower() in self.nicks401: self.nicks401.remove(ievent.nick.lower()) i = Ircevent() i.copyin(ievent) i.bot = self i.sock = self.sock callbacks.check(self, i) except: handle_exception()
# see if user provided channel res = strippedtxt(res.strip()) chan = checkchan(self, res) if chan != None: (channel, res) = chan else: channel = nick # create ircevent ievent = Ircevent() ievent.nick = nick ievent.userhost = userhost ievent.channel = channel ievent.origtxt = res ievent.txt = res ievent.cmnd = 'DCC' ievent.bot = self ievent.sock = sock ievent.speed = 1 ievent.isdcc = True # check if its a command if so dispatch if ievent.txt[0] == "!": ievent.txt = ievent.txt[1:] plugins.trydispatch(self, ievent) continue elif ievent.txt[0] == "@": # command is broadcast so send response to the paryline # members partyline.say_broadcast_notself( ievent.nick, "[%s] %s" % (ievent.nick, ievent.txt)) # make queue and run trydispatch to see if command has # fired
# see if user provided channel res = strippedtxt(res.strip()) chan = checkchan(self, res) if chan != None: (channel, res) = chan else: channel = nick # create ircevent ievent = Ircevent() ievent.nick = nick ievent.userhost = userhost ievent.channel = channel ievent.origtxt = res ievent.txt = res ievent.cmnd = 'DCC' ievent.bot = self ievent.sock = sock ievent.speed = 1 ievent.isdcc = True # check if its a command if so dispatch if ievent.txt[0] == "!": ievent.txt = ievent.txt[1:] plugins.trydispatch(self, ievent) continue elif ievent.txt[0] == "@": # command is broadcast so send response to the paryline # members partyline.say_broadcast_notself(ievent.nick, "[%s] %s" % (ievent.nick, ievent.txt)) # make queue and run trydispatch to see if command has # fired q = Queue.Queue()