From c31512da018b5a60d88f3258f2540bdc44f5f595 Mon Sep 17 00:00:00 2001 From: James Vega Date: Sat, 31 Jul 2004 02:01:28 +0000 Subject: [PATCH] We can respond if we're addressed but there's no terminal question mark. Actions on the other hand are the DEVIL! They get banished immediately. --- plugins/Infobot.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/plugins/Infobot.py b/plugins/Infobot.py index 86a9a7391..f82ad8a27 100755 --- a/plugins/Infobot.py +++ b/plugins/Infobot.py @@ -246,6 +246,8 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): _forceRe = re.compile(r'^no[,: -]+', re.I) def doPrivmsg(self, irc, msg): + if ircmsgs.isAction(msg): + return maybeAddressed = callbacks.addressed(irc.nick, msg, whenAddressedByNick=True) if maybeAddressed: @@ -258,6 +260,20 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): if maybeForced != payload: self.force = True payload = maybeForced + # Let's make sure we dump out of Infobot if the privmsg is an actual + # command otherwise we could get multiple responses. + if self.addressed: + try: + tokens = callbacks.tokenize(payload) + getCallback = callbacks.findCallbackForCommand + commands = filter(None, map(lambda c, i=irc: getCallback(i, c), + tokens)) + if commands: + return + else: + payload += '?' + except SyntaxError: + pass if payload.endswith(irc.nick): self.addressed = True payload = payload[:-len(irc.nick)] @@ -360,7 +376,6 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): utils.nItems('change', self.db.getResponseCount()))) - Class = Infobot # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: