handle RPL_VISIBLEHOST (396) to catch our hostname (maybe username too) changing

This commit is contained in:
jesopo 2020-03-05 11:23:39 +00:00
parent c0947b066d
commit def6eb0ac3
2 changed files with 10 additions and 0 deletions

View file

@ -205,6 +205,10 @@ class Module(ModuleManager.BaseModule):
@utils.hook("raw.received.chghost")
def chghost(self, event):
user.chghost(self.events, event)
# RPL_VISIBLEHOST, telling us what our hostname (and sometimes username) is
@utils.hook("raw.received.396")
def handle_396(self, event):
core.handle_396(event)
# IRCv3 SETNAME, to change a user's realname
@utils.hook("raw.received.setname")

View file

@ -165,3 +165,9 @@ def handle_433(event):
_nick_in_use(event["server"])
def handle_437(event):
_nick_in_use(event["server"])
def handle_396(event):
username, sep, hostname = event["line"][1].rpartition("@")
event["server"].hostname = hostname
if sep:
event["server"].username = username