DrBotIRC: have regex handler take list of events
forgot to commit the unhook part
This commit is contained in:
parent
0c7e4023ac
commit
bda4b78564
@ -288,7 +288,7 @@ class DrBotIRC(irclib.IRC):
|
||||
"""Removes a global regex handler function.
|
||||
|
||||
Args:
|
||||
event event type (a string), as in numeric_events
|
||||
event list of event type (a string), as in numeric_events
|
||||
regex regex string that was used in matching
|
||||
handler callback function to remove
|
||||
|
||||
@ -297,13 +297,16 @@ class DrBotIRC(irclib.IRC):
|
||||
|
||||
"""
|
||||
|
||||
if not event in self.regex_handlers:
|
||||
return 0
|
||||
if type(event) != list:
|
||||
event = [event]
|
||||
|
||||
for h in self.regex_handlers[event]:
|
||||
if regex == h[1] and handler == h[2]:
|
||||
self.regex_handlers[event].remove(h)
|
||||
return 1
|
||||
for ev in event:
|
||||
if not ev in self.regex_handlers:
|
||||
continue
|
||||
|
||||
for h in self.regex_handlers[ev]:
|
||||
if regex == h[1] and handler == h[2]:
|
||||
self.regex_handlers[ev].remove(h)
|
||||
|
||||
def _handle_event(self, connection, event):
|
||||
"""Override event handler to do recursion and regex checking.
|
||||
|
Loading…
Reference in New Issue
Block a user