provide a priority (default 50) to add_global_handler
This commit is contained in:
parent
8bec2e62a1
commit
de3f9d9ae7
@ -28,6 +28,9 @@ from extlib import irclib
|
|||||||
class Module(object):
|
class Module(object):
|
||||||
"""Declare a base class used for creating classes that have real functionality."""
|
"""Declare a base class used for creating classes that have real functionality."""
|
||||||
|
|
||||||
|
def priority(self):
|
||||||
|
return 50
|
||||||
|
|
||||||
def __init__(self, config, server, modlist):
|
def __init__(self, config, server, modlist):
|
||||||
"""
|
"""
|
||||||
Construct a feature module. Inheritors should not do anything special
|
Construct a feature module. Inheritors should not do anything special
|
||||||
@ -76,8 +79,8 @@ class Module(object):
|
|||||||
own.
|
own.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
server.add_global_handler('pubmsg', self.on_pubmsg)
|
server.add_global_handler('pubmsg', self.on_pubmsg, self.priority())
|
||||||
server.add_global_handler('privmsg', self.on_privmsg)
|
server.add_global_handler('privmsg', self.on_privmsg, self.priority())
|
||||||
|
|
||||||
def unregister_handlers(self):
|
def unregister_handlers(self):
|
||||||
"""
|
"""
|
||||||
|
@ -29,9 +29,9 @@ class IrcAdmin(Module):
|
|||||||
"""Support miscellaneous IRC stuff --- joining channels, changing the nick, etc."""
|
"""Support miscellaneous IRC stuff --- joining channels, changing the nick, etc."""
|
||||||
|
|
||||||
def register_handlers(self, server):
|
def register_handlers(self, server):
|
||||||
server.add_global_handler('welcome', self.on_connect)
|
server.add_global_handler('welcome', self.on_connect, self.priority())
|
||||||
server.add_global_handler('pubmsg', self.on_pubmsg)
|
server.add_global_handler('pubmsg', self.on_pubmsg, self.priority())
|
||||||
server.add_global_handler('privmsg', self.on_privmsg)
|
server.add_global_handler('privmsg', self.on_privmsg, self.priority())
|
||||||
|
|
||||||
# we define save, so we'll bite the bullet and take SIGINT
|
# we define save, so we'll bite the bullet and take SIGINT
|
||||||
signal.signal(signal.SIGINT, self.sigint_handler)
|
signal.signal(signal.SIGINT, self.sigint_handler)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user