From: Christian Heller Date: Wed, 24 Sep 2025 03:49:12 +0000 (+0200) Subject: Use more easily constructed NOTICE marker. X-Git-Url: https://plomlompom.com/repos/?a=commitdiff_plain;h=7de2d6d0c7915ebe5d95654a2b2d34f1e0b6f382;p=ircplom Use more easily constructed NOTICE marker. --- diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 9fe8ca6..35f89b6 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -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] diff --git a/test.txt b/test.txt index 482b641..ba4f473 100644 --- a/test.txt +++ b/test.txt @@ -70,11 +70,11 @@ # 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 :? @@ -154,7 +154,7 @@ # 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