mirror of https://github.com/Mikaela/Limnoria.git
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):
|
def doPrivmsg(self, irc, msg):
|
||||||
callbacks.Privmsg.handled = False
|
callbacks.Privmsg.handled = False
|
||||||
callbacks.Privmsg.errored = False
|
callbacks.Privmsg.errored = False
|
||||||
|
msg.repliedTo = False
|
||||||
ignored = ircdb.checkIgnored(msg.prefix)
|
ignored = ircdb.checkIgnored(msg.prefix)
|
||||||
s = callbacks.addressed(irc.nick, msg)
|
s = callbacks.addressed(irc.nick, msg)
|
||||||
if s:
|
if s:
|
||||||
|
|
|
@ -143,6 +143,7 @@ def canonicalName(command):
|
||||||
|
|
||||||
def reply(msg, s, prefixName=None, private=None,
|
def reply(msg, s, prefixName=None, private=None,
|
||||||
notice=None, to=None, action=None, error=False):
|
notice=None, to=None, action=None, error=False):
|
||||||
|
msg.repliedTo = True
|
||||||
# Ok, let's make the target:
|
# Ok, let's make the target:
|
||||||
target = ircutils.replyTo(msg)
|
target = ircutils.replyTo(msg)
|
||||||
if ircutils.isChannel(target):
|
if ircutils.isChannel(target):
|
||||||
|
@ -581,18 +582,23 @@ class IrcObjectProxy(RichReplyMethods):
|
||||||
cbs = findCallbackForCommand(self, name)
|
cbs = findCallbackForCommand(self, name)
|
||||||
if len(cbs) == 0:
|
if len(cbs) == 0:
|
||||||
for cb in self.irc.callbacks:
|
for cb in self.irc.callbacks:
|
||||||
if isinstance(cb, PrivmsgRegexp):
|
# We used not to run invalidCommands if regexps matched, but now I'd say that
|
||||||
for (r, name) in cb.res:
|
# invalidCommands are more essential than regexps, so it is regexps that should
|
||||||
if r.search(self.msg.args[1]):
|
# have to work around invalidCommands, not vice-versa.
|
||||||
log.debug('Skipping invalidCommand: %s.%s',
|
## if isinstance(cb, PrivmsgRegexp):
|
||||||
cb.name(), name)
|
## for (r, name) in cb.res:
|
||||||
return
|
## if r.search(self.msg.args[1]):
|
||||||
elif isinstance(cb, PrivmsgCommandAndRegexp):
|
## log.debug('Skipping invalidCommand: %s.%s',
|
||||||
for (r, name) in cb.res:
|
## cb.name(), name)
|
||||||
if r.search(self.msg.args[1]):
|
## return
|
||||||
log.debug('Skipping invalidCommand: %s.%s',
|
if isinstance(cb, PrivmsgCommandAndRegexp):
|
||||||
cb.name(), name)
|
## for (r, name) in cb.res:
|
||||||
return
|
## 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)
|
payload = addressed(self.irc.nick, self.msg)
|
||||||
for (r, name) in cb.addressedRes:
|
for (r, name) in cb.addressedRes:
|
||||||
if r.search(payload):
|
if r.search(payload):
|
||||||
|
@ -762,6 +768,9 @@ class IrcObjectProxy(RichReplyMethods):
|
||||||
raise ArgumentError # We shouldn't get here, but just in case.
|
raise ArgumentError # We shouldn't get here, but just in case.
|
||||||
self.finished = True
|
self.finished = True
|
||||||
|
|
||||||
|
def noReply(self):
|
||||||
|
self.finished = True
|
||||||
|
|
||||||
def getRealIrc(self):
|
def getRealIrc(self):
|
||||||
"""Returns the real irclib.Irc object underlying this proxy chain."""
|
"""Returns the real irclib.Irc object underlying this proxy chain."""
|
||||||
if isinstance(self.irc, irclib.Irc):
|
if isinstance(self.irc, irclib.Irc):
|
||||||
|
|
Loading…
Reference in New Issue