예제 #1
0
    def dispatch(self, callback, txt):

        """ dispatch callback on txt. """

        try:
            result = re.search(callback.compiled, txt)
            if result:
                if callback.threaded:
                    thr.start_new_thread(callback.func, (txt, result.groups()))
                else:
                    cmndrunners.put(callback.plugname, callback.func, txt, \
result.groups())
                    return 1
        except Exception, ex:
            handle_exception()
예제 #2
0
    def dispatch(self, callback, bot, ievent):

        """ dispatch callback on ircevent. """

        try:
            result = re.search(callback.compiled, ievent.txt.strip())
            if result:
                ievent.groups = list(result.groups())                
                if callback.threaded:
                    thr.start_bot_command(callback.func, (bot, ievent))
                else:
                    cmndrunners.put(callback.plugname, callback.func, bot, \
ievent)
                return 1
        except Exception, ex:
            handle_exception(ievent)