diff -r 6c0609395889 -r dbf49689af0d irc.py --- a/irc.py Mon Jan 12 10:55:45 2015 +0200 +++ b/irc.py Thu Jan 15 19:06:14 2015 +0200 @@ -37,6 +37,13 @@ def __str__ (self): return self.value +def get_client (name): + for client in all_clients: + if client.name == name: + return client + + raise ValueError ('no such client %s' % name) + # # Main IRC client class # @@ -169,9 +176,19 @@ stuff = message[1:].split(' ') command = stuff[0] args = stuff[1:] - self.handle_command (sender, user, host, replyto, command, args, message) + self.handle_command (sender, user, host, channel, replyto, command, args, message) return + if channel != self.mynick: + ModuleCore.call_hook (bot=self, hookname='chanmsg', channel=channel, sender=sender, + ident=user, host=host, message=message, replyto=replyto) + else: + ModuleCore.call_hook (bot=self, hookname='querymsg', sender=sender, ident=user, + host=host, message=message, replyto=replyto) + + ModuleCore.call_hook (bot=self, hookname='privmsg', target=channel, sender=sender, + ident=user, host=host, message=message, replyto=replyto) + Bt.process_message (self, line, replyto) def add_irc_channel (self, channame): @@ -196,8 +213,9 @@ self.write ('PART ' + channame) self.cfg.save() - def handle_command (self, sender, ident, host, replyto, command, args, message): - kvargs = {'sender': sender, 'ident': ident, 'host': host, 'replyto': replyto, 'cmdname': command, 'message': message} + def handle_command (self, sender, ident, host, target, replyto, command, args, message): + kvargs = {'sender': sender, 'ident': ident, 'host': host, 'target': target, + 'replyto': replyto, 'cmdname': command, 'message': message} try: ModuleCore.call_command (self, **kvargs)