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.
|
"""Removes a global regex handler function.
|
||||||
|
|
||||||
Args:
|
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
|
regex regex string that was used in matching
|
||||||
handler callback function to remove
|
handler callback function to remove
|
||||||
|
|
||||||
@ -297,13 +297,16 @@ class DrBotIRC(irclib.IRC):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not event in self.regex_handlers:
|
if type(event) != list:
|
||||||
return 0
|
event = [event]
|
||||||
|
|
||||||
for h in self.regex_handlers[event]:
|
for ev in event:
|
||||||
if regex == h[1] and handler == h[2]:
|
if not ev in self.regex_handlers:
|
||||||
self.regex_handlers[event].remove(h)
|
continue
|
||||||
return 1
|
|
||||||
|
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):
|
def _handle_event(self, connection, event):
|
||||||
"""Override event handler to do recursion and regex checking.
|
"""Override event handler to do recursion and regex checking.
|
||||||
|
Loading…
Reference in New Issue
Block a user