aboutsummaryrefslogtreecommitdiff
path: root/modules/signals.py
diff options
context:
space:
mode:
authorGravatar jesopo2018-08-31 12:55:52 +0100
committerGravatar dongfix2018-08-31 13:44:39 +0100
commitb7cf524e9869828ff85954cb731f7fee98bee8d9 (patch)
treed5d887ac82f3e50f0ea295953981363c1c5e7c5a /modules/signals.py
parentRevert "Reformat" (diff)
Give modules event objects with "context"s, to facilitate purging all the event
hooks for a module
Diffstat (limited to 'modules/signals.py')
-rw-r--r--modules/signals.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/signals.py b/modules/signals.py
index 3ab6966a..cbc22429 100644
--- a/modules/signals.py
+++ b/modules/signals.py
@@ -1,19 +1,21 @@
import signal
class Module(object):
- def __init__(self, bot):
+ def __init__(self, bot, events):
self.bot = bot
+ self.events = events
signal.signal(signal.SIGINT, self.SIGINT)
signal.signal(signal.SIGUSR1, self.SIGUSR1)
def SIGINT(self, signum, frame):
print()
- self.bot.events.on("signal").on("interrupt").call(signum=signum, frame=frame)
+ self.events.on("signal").on("interrupt").call(signum=signum,
+ frame=frame)
for server in self.bot.servers.values():
reason = "Leaving"
if server.get_setting("quit-quote", True):
- reason = self.bot.events.on("get.quit-quote"
+ reason = self.events.on("get.quit-quote"
).call_for_result(default="Leaving")
server.send_quit(reason)
self.bot.register_write(server)