mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Fixed addressedRegexps handling in PluginRegexp.
This commit is contained in:
parent
568ebcdf96
commit
b0df87ed7d
@ -1215,21 +1215,28 @@ class PluginRegexp(Plugin):
|
|||||||
r = re.compile(method.__doc__, self.flags)
|
r = re.compile(method.__doc__, self.flags)
|
||||||
self.addressedRes.append((r, name))
|
self.addressedRes.append((r, name))
|
||||||
|
|
||||||
|
def _callRegexp(self, name, irc, msg, m):
|
||||||
|
method = getattr(self, name)
|
||||||
|
try:
|
||||||
|
method(irc, msg, m)
|
||||||
|
except Error, e:
|
||||||
|
irc.error(str(e))
|
||||||
|
except Exception, e:
|
||||||
|
self.log.exception('Uncaught exception in _callRegexp:')
|
||||||
|
|
||||||
|
def invalidCommand(self, irc, msg, tokens):
|
||||||
|
s = ' '.join(tokens)
|
||||||
|
for (r, name) in self.addressedRes:
|
||||||
|
for m in r.finditer(s):
|
||||||
|
self._callRegexp(name, irc, msg, m)
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
if msg.isError:
|
if msg.isError:
|
||||||
return
|
return
|
||||||
s = addressed(irc.nick, msg)
|
|
||||||
if s:
|
|
||||||
for (r, name) in self.addressedRes:
|
|
||||||
if msg.repliedTo and name not in self.alwaysCall:
|
|
||||||
continue
|
|
||||||
for m in r.finditer(s):
|
|
||||||
proxy = self.Proxy(irc, msg)
|
proxy = self.Proxy(irc, msg)
|
||||||
self._callCommand(name, proxy, msg, m)
|
|
||||||
for (r, name) in self.res:
|
for (r, name) in self.res:
|
||||||
for m in r.finditer(msg.args[1]):
|
for m in r.finditer(msg.args[1]):
|
||||||
proxy = self.Proxy(irc, msg)
|
self._callRegexp(name, proxy, msg, m)
|
||||||
self._callCommand(name, proxy, msg, m)
|
|
||||||
PrivmsgCommandAndRegexp = PluginRegexp
|
PrivmsgCommandAndRegexp = PluginRegexp
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user