home · contact · privacy
Handle 396 numeric.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 14 Aug 2025 12:01:34 +0000 (14:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 14 Aug 2025 12:01:34 +0000 (14:01 +0200)
ircplom/client.py

index bd71e6a0a720786a84e375e09dd29467df822953..3eea8865bef9121b0ddc9fdd43211f7079fc5178 100644 (file)
@@ -22,6 +22,7 @@ _NUMERICS_TO_CONFIRM_NICKNAME = (
     (265, 266),
     372,
     (375, 376),
+    396,
 )
 _NUMERICS_TO_IGNORE = (
     (1, 4),      # nothing in this login info we're interested in
@@ -354,6 +355,11 @@ class Client(ABC, ClientQueueMixin):
                 self._db.append('motd', msg.params[-1])
             case '376':  # RPL_ENDOFMOTD
                 self._update_db('motd', None, True)
+            case '396':  # RPL_VISIBLEHOST/RPL_YOURDISPLAYEDHOST/RPL_HOSTHIDDEN
+                # '@'-split because <https://defs.ircdocs.horse/defs/numerics>
+                # claims: "<hostname> can also be in the form <user@hostname>"
+                self._update_db('client_host', confirm=True,
+                                value=msg.params[1].split('@')[-1])
             case 'PING':
                 self.send(IrcMessage(verb='PONG', params=(msg.params[0],)))
             case 'ERROR':