Parse and print when we send QUIT commands (line_handler, print_activity)
This commit is contained in:
parent
f6179c46ab
commit
e51c653c1e
2 changed files with 24 additions and 9 deletions
|
@ -290,17 +290,26 @@ class Module(ModuleManager.BaseModule):
|
||||||
|
|
||||||
# a user has disconnected!
|
# a user has disconnected!
|
||||||
@utils.hook("raw.received.quit")
|
@utils.hook("raw.received.quit")
|
||||||
|
@utils.hook("raw.send.quit")
|
||||||
def quit(self, event):
|
def quit(self, event):
|
||||||
|
nickname = None
|
||||||
|
if event["direction"] == Direction.RECV:
|
||||||
|
nickname = event["prefix"].nickname
|
||||||
reason = event["args"].get(0)
|
reason = event["args"].get(0)
|
||||||
|
|
||||||
if (not event["server"].is_own_nickname(event["prefix"].nickname) and
|
if event["direction"] == Direction.RECV:
|
||||||
not event["prefix"].hostmask == "*"):
|
nickname = event["prefix"].nickname
|
||||||
user = event["server"].get_user(event["prefix"].nickname)
|
if (not event["server"].is_own_nickname(nickname) and
|
||||||
event["server"].remove_user(user)
|
not event["prefix"].hostmask == "*"):
|
||||||
self._event(event, "quit", reason=reason, user=user,
|
user = event["server"].get_user(nickname)
|
||||||
server=event["server"])
|
event["server"].remove_user(user)
|
||||||
|
self.events.on("received.quit").call(reason=reason, user=user,
|
||||||
|
server=event["server"])
|
||||||
|
else:
|
||||||
|
event["server"].disconnect()
|
||||||
else:
|
else:
|
||||||
event["server"].disconnect()
|
self.events.on("send.quit").call(reason=reason,
|
||||||
|
server=event["server"])
|
||||||
|
|
||||||
def _match_caps(self, capabilities):
|
def _match_caps(self, capabilities):
|
||||||
return set(capabilities) & CAPABILITIES
|
return set(capabilities) & CAPABILITIES
|
||||||
|
|
|
@ -89,10 +89,16 @@ class Module(ModuleManager.BaseModule):
|
||||||
self.print_line(event, "%s changed nickname to %s" % (
|
self.print_line(event, "%s changed nickname to %s" % (
|
||||||
event["old_nickname"], event["new_nickname"]))
|
event["old_nickname"], event["new_nickname"]))
|
||||||
|
|
||||||
|
def _quit(self, event, nickname, reason):
|
||||||
|
self.print_line(event, "%s quit%s" % (nickname,
|
||||||
|
"" if not reason else " (%s)" % reason))
|
||||||
|
|
||||||
@utils.hook("received.quit")
|
@utils.hook("received.quit")
|
||||||
def on_quit(self, event):
|
def on_quit(self, event):
|
||||||
self.print_line(event, "%s quit%s" % (event["user"].nickname,
|
self._quit(event, event["user"].nickname, event["reason"])
|
||||||
"" if not event["reason"] else " (%s)" % event["reason"]))
|
@utils.hook("send.quit")
|
||||||
|
def send_quit(self, event):
|
||||||
|
self._quit(event, event["server"].nickname, event["reason"])
|
||||||
|
|
||||||
def _on_kick(self, event, nickname):
|
def _on_kick(self, event, nickname):
|
||||||
self.print_line(event, "%s kicked %s from %s%s" % (
|
self.print_line(event, "%s kicked %s from %s%s" % (
|
||||||
|
|
Loading…
Reference in a new issue