home · contact · privacy
Use more easily constructed NOTICE marker.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 03:49:12 +0000 (05:49 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 03:49:12 +0000 (05:49 +0200)
ircplom/client_tui.py
test.txt

index 9fe8ca6fc9386641c69c2e25eee4be0db66cdcd4..35f89b65aab8ed76e20f56fd8c05a5e040d519c0 100644 (file)
@@ -304,10 +304,12 @@ class _TuiClientDb(_UpdatingNode, SharedClientDbFields):
                 update.results += [(_LogScope.ALL, [':DISCONNECTED'])]
         elif update.key == 'message' and update.value:
             assert isinstance(update.value, ChatMessage)
-            who = (f':{update.value.sender}' if update.value.sender
-                   else 'NICK:me')
-            update.results += [(_LogScope.CHAT,
-                                [':[', who, f':] {update.value.content}'])]
+            toks = [':*** '] if update.value.is_notice else []
+            toks += [':[']
+            toks += [f':{update.value.sender}' if update.value.sender
+                     else 'NICK:me']
+            toks += [f':] {update.value.content}'] 
+            update.results += [(_LogScope.CHAT, toks)]
 
 
 class _ClientWindowsManager:
@@ -366,8 +368,6 @@ class _ClientWindowsManager:
         prefix = '$'
         if 'out' in kwargs:
             prefix = _LOG_PREFIX_OUT if kwargs['out'] else _LOG_PREFIX_IN
-            if kwargs.get('is_notice', False):
-                prefix *= 3
         kw = {k: v for k, v in kwargs.items() if k in {'log_target', 'alert'}}
         self._tui_log(msg, scope=scope, prefix=prefix, **kw)
 
@@ -389,7 +389,6 @@ class _ClientWindowsManager:
                 log_kwargs['log_target'] = (update.value.target
                                             or update.value.sender)
                 log_kwargs['out'] = not bool(update.value.sender)
-                log_kwargs['is_notice'] = update.value.is_notice
             elif scope in {_LogScope.CHAT, _LogScope.USER,
                            _LogScope.USER_NO_CHANNELS}:
                 log_kwargs['log_target'] = update.full_path[1]
index 482b64174d0a9184347916673c87b3204adef867..ba4f473482f76051f13b9931f32ac03e77545ae8 100644 (file)
--- a/test.txt
+++ b/test.txt
 
 # expect some NOTICE and PING to process/reply during initiation
 0:1 < :*.?.net NOTICE * :*** Looking up your ident...
-2 <<< [ server] *** Looking up your ident...
+2 < *** [ server] *** Looking up your ident...
 0:1 < :*.?.net NOTICE * :*** Looking up your hostname...
-2 <<< [ server] *** Looking up your hostname...
+2 < *** [ server] *** Looking up your hostname...
 0:1 < :*.?.net NOTICE * :*** Found your hostname (baz.bar.foo)
-2 <<< [ server] *** Found your hostname (baz.bar.foo)
+2 < *** [ server] *** Found your hostname (baz.bar.foo)
 0:1 < PING :?
 1 > PONG :?
 
 
 # handle bot query NOTICE
 0:1 < :SaslServ!SaslServ@services.bar.baz NOTICE foo1 :Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000.
-3 <<< [SaslServ] Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000.
+3 < *** [SaslServ] Last login from ~foobarbaz@foo.bar.baz on Jan 1 22:00:00 2021 +0000.
 
 # check difference in available commands when switching to client window
 > /join #test