From 4605ce84f80f96708220d1ad45dd26d1b47f0c1c Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 14 Sep 2004 15:07:52 +0000 Subject: [PATCH] Added repliedTo tag, stopped not calling invalidCommand if regexp methods match. --- src/Owner.py | 1 + src/callbacks.py | 33 +++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/Owner.py b/src/Owner.py index 38629d900..88aefea27 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -417,6 +417,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): def doPrivmsg(self, irc, msg): callbacks.Privmsg.handled = False callbacks.Privmsg.errored = False + msg.repliedTo = False ignored = ircdb.checkIgnored(msg.prefix) s = callbacks.addressed(irc.nick, msg) if s: diff --git a/src/callbacks.py b/src/callbacks.py index 77571ef6c..9497b4cbc 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -143,6 +143,7 @@ def canonicalName(command): def reply(msg, s, prefixName=None, private=None, notice=None, to=None, action=None, error=False): + msg.repliedTo = True # Ok, let's make the target: target = ircutils.replyTo(msg) if ircutils.isChannel(target): @@ -581,18 +582,23 @@ class IrcObjectProxy(RichReplyMethods): cbs = findCallbackForCommand(self, name) if len(cbs) == 0: for cb in self.irc.callbacks: - if isinstance(cb, PrivmsgRegexp): - for (r, name) in cb.res: - if r.search(self.msg.args[1]): - log.debug('Skipping invalidCommand: %s.%s', - cb.name(), name) - return - elif isinstance(cb, PrivmsgCommandAndRegexp): - for (r, name) in cb.res: - if r.search(self.msg.args[1]): - log.debug('Skipping invalidCommand: %s.%s', - cb.name(), name) - return +# We used not to run invalidCommands if regexps matched, but now I'd say that +# invalidCommands are more essential than regexps, so it is regexps that should +# have to work around invalidCommands, not vice-versa. +## if isinstance(cb, PrivmsgRegexp): +## for (r, name) in cb.res: +## if r.search(self.msg.args[1]): +## log.debug('Skipping invalidCommand: %s.%s', +## cb.name(), name) +## return + if isinstance(cb, PrivmsgCommandAndRegexp): +## for (r, name) in cb.res: +## if r.search(self.msg.args[1]): +## log.debug('Skipping invalidCommand: %s.%s', +## cb.name(), name) +## return +# Although we still consider addressedRegexps to be commands, so we don't call +# invalidCommnads if an addressedRegexp matches. payload = addressed(self.irc.nick, self.msg) for (r, name) in cb.addressedRes: if r.search(payload): @@ -762,6 +768,9 @@ class IrcObjectProxy(RichReplyMethods): raise ArgumentError # We shouldn't get here, but just in case. self.finished = True + def noReply(self): + self.finished = True + def getRealIrc(self): """Returns the real irclib.Irc object underlying this proxy chain.""" if isinstance(self.irc, irclib.Irc):