mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Added repliedTo tag, stopped not calling invalidCommand if regexp methods match.
This commit is contained in:
parent
5570ba3dbe
commit
4605ce84f8
@ -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:
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user