format and print CHGHOST events

This commit is contained in:
jesopo 2019-10-31 15:35:53 +00:00
parent 8831724af0
commit a73629bbf7
4 changed files with 14 additions and 2 deletions

View file

@ -84,6 +84,14 @@ class Module(ModuleManager.BaseModule):
def self_join(self, event): def self_join(self, event):
self._on_join(event, event["server"].get_user(event["server"].nickname)) self._on_join(event, event["server"].get_user(event["server"].nickname))
@utils.hook("received.chghost")
def _on_chghost(self, event):
line_minimal = "%s changed host (%s@%s)" % (event["user"].nickname,
event["username"], event["hostname"])
line = "- %s" % line_minimal
self._event("chghost", event["server"], line, None, user=event["user"],
minimal=line_minimal)
def _on_part(self, event, user): def _on_part(self, event, user):
reason = event["reason"] reason = event["reason"]
reason = "" if not reason else " (%s)" % reason reason = "" if not reason else " (%s)" % reason

View file

@ -204,7 +204,7 @@ class Module(ModuleManager.BaseModule):
# IRCv3 CHGHOST, a user's username and/or hostname has changed # IRCv3 CHGHOST, a user's username and/or hostname has changed
@utils.hook("raw.received.chghost") @utils.hook("raw.received.chghost")
def chghost(self, event): def chghost(self, event):
user.chghost(event) user.chghost(self.events, event)
# IRCv3 SETNAME, to change a user's realname # IRCv3 SETNAME, to change a user's realname
@utils.hook("raw.received.setname") @utils.hook("raw.received.setname")

View file

@ -64,7 +64,7 @@ def away(events, event):
user.away_message = None user.away_message = None
events.on("received.away.off").call(user=user, server=event["server"]) events.on("received.away.off").call(user=user, server=event["server"])
def chghost(event): def chghost(events, event):
nickname = event["line"].source.nickname nickname = event["line"].source.nickname
username = event["line"].args[0] username = event["line"].args[0]
hostname = event["line"].args[1] hostname = event["line"].args[1]
@ -74,6 +74,9 @@ def chghost(event):
event["server"].hostname = hostname event["server"].hostname = hostname
target = event["server"].get_user(nickname) target = event["server"].get_user(nickname)
events.on("received.chghost").call(user=target, server=event["server"],
username=username, hostname=hostname)
target.username = username target.username = username
target.hostname = hostname target.hostname = hostname

View file

@ -26,6 +26,7 @@ class Module(ModuleManager.BaseModule):
@utils.hook("formatted.kick") @utils.hook("formatted.kick")
@utils.hook("formatted.quit") @utils.hook("formatted.quit")
@utils.hook("formatted.rename") @utils.hook("formatted.rename")
@utils.hook("formatted.chghost")
def formatted(self, event): def formatted(self, event):
self._print(event) self._print(event)