home · contact · privacy
For channel residents show nicknames or entire masks rather than IDs.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 2 Sep 2025 08:47:42 +0000 (10:47 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 2 Sep 2025 08:47:42 +0000 (10:47 +0200)
ircplom/client.py
ircplom/client_tui.py

index b04c4c9383811ebd79514809f50d7c6885d4c4e8..7e6b14f013516f482ad27e59295e7796a61eeb05 100644 (file)
@@ -250,6 +250,9 @@ class NickUserHost:
     user: str = '?'
     host: str = '?'
 
+    def __str__(self) -> str:
+        return f'{self.nick}!{self.user}@{self.host}'
+
 
 @dataclass
 class ServerCapability:
@@ -335,9 +338,6 @@ class _Channel:
 
 class _NickUserHost(NickUserHost):
 
-    def __str__(self) -> str:
-        return f'{self.nick}!{self.user}@{self.host}'
-
     def __eq__(self, other) -> bool:
         if not isinstance(other, NickUserHost):
             return False
index 6f42c4531f1b9dff62276a41d8d8e7564be96424..2961f6ee1b6ee7a2ef23d8d1958a03e604248aa5 100644 (file)
@@ -192,18 +192,16 @@ class _UpdatingChannel(_UpdatingNode):
 
     def set_and_check_for_change(self, update: _Update
                                  ) -> Optional[tuple[LogScope, Any]]:
-        def fmt_ids(user_ids: tuple[str, ...]) -> str:
-            return ', '.join(user_ids)
         if update.path == ('user_ids',):
             assert isinstance(update.value, tuple)
-            d: dict[str, str] = {}
+            d: dict[str, tuple[str, ...]] = {}
             if not self.user_ids:
-                d['residents'] = fmt_ids(update.value)
+                d['nicks:residents'] = tuple(update.value)
             else:
-                d['joining'] = fmt_ids(tuple(id_ for id_ in update.value
-                                             if id_ not in self.user_ids))
-                d['parting'] = fmt_ids(tuple(id_ for id_ in self.user_ids
-                                             if id_ not in update.value))
+                d['nuhs:joining'] = tuple(id_ for id_ in update.value
+                                          if id_ not in self.user_ids)
+                d['nuhs:parting'] = tuple(id_ for id_ in self.user_ids
+                                          if id_ not in update.value)
             if super().set_and_check_for_change(update):
                 return (self._scope(update.path), d)
             return None
@@ -296,6 +294,14 @@ class _ClientWindowsManager:
             self.log(f'{log_path} cleared', **log_kwargs)
         elif isinstance(value, dict):
             for verb, item in [(k, v) for k, v in value.items() if v]:
+                toks = verb.split(':', maxsplit=1)
+                verb = toks[-1]
+                transform = toks[0] if len(toks) > 1 else ''
+                if transform in {'nicks', 'nuhs'}:
+                    nuhs = (self.db.users[id_] for id_ in item)
+                    item = ', '.join([
+                        (str(nuh) if transform == 'nuhs' else nuh.nick)
+                        for nuh in nuhs])
                 self.log(f'{verb}: {item}', **log_kwargs)
         else:
             announcement = f'{log_path} set to:'