From cedcad32e2e9562a517952815e5a108b30040356 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 4 Jan 2005 03:44:33 +0000 Subject: [PATCH] Add a warning log. --- src/Channel.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/src/Channel.py b/src/Channel.py index 00375d6b7..cc44db9f7 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -61,6 +61,10 @@ conf.registerChannelValue(conf.supybot.plugins.Channel, 'alwaysRejoin', rejoin a channel whenever it's kicked from the channel.""")) class Channel(callbacks.Privmsg): + def __init__(self): + callbacks.Privmsg.__init__(self) + self.invites = {} + def doKick(self, irc, msg): channel = msg.args[0] if msg.args[1] == irc.nick: @@ -420,10 +424,43 @@ class Channel(callbacks.Privmsg): sent in the channel itself. """ self._sendMsg(irc, ircmsgs.invite(nick or msg.nick, channel)) + self.invites[(irc.getRealIrc(), ircutils.toLower(nick))] = irc invite = wrap(invite, [('checkChannelCapability', 'op'), ('haveOp', 'invite someone'), additional('nick')]) + def do341(self, irc, msg): + (_, nick, channel) = msg.args + nick = ircutils.toLower(nick) + replyIrc = self.invites.pop((irc, nick), None) + if replyIrc is not None: + self.log.info('Inviting %s to %s by command of %s.', + nick, channel, replyIrc.msg.prefix) + replyIrc.replySuccess() + else: + self.log.info('Inviting %s to %s.', nick, channel) + + def do443(self, irc, msg): + (_, nick, channel, _) = msg.args + nick = ircutils.toLower(nick) + replyIrc = self.invites.pop((irc, nick), None) + if replyIrc is not None: + replyIrc.error('%s is already in %s.' % (nick, channel)) + + def do401(self, irc, msg): + nick = msg.args[1] + nick = ircutils.toLower(nick) + replyIrc = self.invites.pop((irc, nick), None) + if replyIrc is not None: + replyIrc.error('There is no %s on this network.' % nick) + + def do504(self, irc, msg): + nick = msg.args[1] + nick = ircutils.toLower(nick) + replyIrc = self.invites.pop((irc, nick), NOne) + if replyirc is not None: + replyIrc.error('There is not %s on this server.' % nick) + def lobotomize(self, irc, msg, args, channel): """[]