From 85e0783cb94d95544a555e28c96ab0c50210d20f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 6 Jan 2004 03:32:21 +0000 Subject: [PATCH] Added RFE #871165, doInvite for Admin. --- src/Admin.py | 18 +++++++++++++----- src/conf.py | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Admin.py b/src/Admin.py index dd937d392..1866c2047 100755 --- a/src/Admin.py +++ b/src/Admin.py @@ -66,7 +66,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): del self.joins[channel] irc.error(msg, 'Cannot join %s, it\'s full.' % channel) except KeyError: - self.log.warning('Got 471 without Admin.join being called.') + self.log.debug('Got 471 without Admin.join being called.') def do473(self, irc, msg): try: @@ -75,7 +75,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): del self.joins[channel] irc.error(msg, 'Cannot join %s, I was not invited.' % channel) except KeyError: - self.log.warning('Got 473 without Admin.join being called.') + self.log.debug('Got 473 without Admin.join being called.') def do474(self, irc, msg): try: @@ -84,7 +84,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): del self.joins[channel] irc.error(msg, 'Cannot join %s, it\'s banned me.' % channel) except KeyError: - self.log.warning('Got 474 without Admin.join being called.') + self.log.debug('Got 474 without Admin.join being called.') def do475(self, irc, msg): try: @@ -93,7 +93,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): del self.joins[channel] irc.error(msg, 'Cannot join %s, my keyword was wrong.' % channel) except KeyError: - self.log.warning('Got 475 without Admin.join being called.') + self.log.debug('Got 475 without Admin.join being called.') def doJoin(self, irc, msg): if msg.prefix == irc.prefix: @@ -101,7 +101,15 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): del self.joins[msg.args[0]] except KeyError: s = 'Joined a channel without Admin.join being called' - self.log.warning(s) + self.log.debug(s) + + def doInvite(self, irc, msg): + if msg.args[1] not in irc.state.channels: + if conf.alwaysJoinOnInvite: + irc.queueMsg(ircmsgs.join(msg.args[1])) + else: + if ircdb.checkCapability(msg.prefix, 'admin'): + irc.queueMsg(ircmsgs.join(msg.args[1])) def join(self, irc, msg, args): """[,] [[,] ...] diff --git a/src/conf.py b/src/conf.py index 6c02bf83e..07d001669 100644 --- a/src/conf.py +++ b/src/conf.py @@ -187,6 +187,14 @@ requireChannelCommandsToBeSentInChannel = False ### followIdentificationThroughNickChanges = False +### +# alwaysJoinOnInvite: Causes the bot to always join a channel when it's +# invited. Defaults to False, in which case the bot will +# only join if the user inviting it has the 'admin' +# capability. +### +alwaysJoinOnInvite = False + ### # enablePipeSyntax: Supybot allows nested commands; generally, commands are # nested via [square brackets]. Supybot can also use a