Make use of "when line sent" logic to disconnect after QUIT (signals.py)

This commit is contained in:
jesopo 2019-02-10 14:32:04 +00:00
parent 709365ecf8
commit cf64e8832b

View file

@ -26,10 +26,11 @@ class Module(ModuleManager.BaseModule):
if server.get_setting("quit-quote", True):
reason = self.exports.get_one("quit-quote",
lambda: reason)()
server.send_quit(reason)
line = server.send_quit(reason)
line.on_send(self._make_hook(server))
self.events.on("writebuffer.empty").hook(
lambda event: self.bot.disconnect(event["server"]))
def _make_hook(self, server):
return lambda: self.bot.disconnect(server)
def SIGUSR1(self, signum, frame):
self.bot.trigger(self._reload_config)