process multiple matches of a regexp per message

This commit is contained in:
Daniel Folkinshteyn 2010-03-17 12:37:34 -04:00
parent 95aa56c694
commit 6ceeace44d

View File

@ -134,15 +134,14 @@ class MessageParser(callbacks.Plugin, plugins.ChannelDBHandler):
if len(results) == 0:
return
for (regexp, action) in results:
match = re.search(regexp, msg.args[1])
for match in re.finditer(regexp, msg.args[1]):
if match is not None:
thisaction = action
self._updateRank(channel, regexp)
for (i, j) in enumerate(match.groups()):
action = re.sub(r'\$' + str(i+1), match.group(i+1), action)
actions.append(action)
thisaction = re.sub(r'\$' + str(i+1), match.group(i+1), thisaction)
actions.append(thisaction)
#if len(actions) > 0:
# irc.replies(actions, prefixNick=False)
for action in actions:
self._runCommandFunction(irc, msg, action)