home · contact · privacy
Minor code re-arrangement.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 00:49:33 +0000 (02:49 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 24 Sep 2025 00:49:33 +0000 (02:49 +0200)
ircplom/client_tui.py

index b7056f1ed2d5e7db52d4c33b8ba6dcb8d8472c6c..db6ddc1ff3377f89ba7905e6fff47ae51ca8c740 100644 (file)
@@ -383,16 +383,6 @@ class _ClientWindowsManager:
         if not update.results:
             return False
         for scope, result in update.results:
-            log_kwargs: dict[str, str | bool] = {}
-            if scope in {_LogScope.CHAT, _LogScope.USER,
-                         _LogScope.USER_NO_CHANNELS}:
-                if update.full_path == ('message',):
-                    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
-                else:
-                    log_kwargs['log_target'] = update.full_path[1]
             msg = ''
             for item in result:
                 transform, content = item.split(':', maxsplit=1)
@@ -400,6 +390,15 @@ class _ClientWindowsManager:
                     nuh = self.db.users[content]
                     content = str(nuh) if transform == 'NUH' else nuh.nick
                 msg += content
+            log_kwargs: dict[str, str | bool] = {}
+            if update.full_path == ('message',):
+                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]
             self.log(msg, scope=scope, **log_kwargs)
         for win in [w for w in self.windows if isinstance(w, _ChatWindow)]:
             win.set_prompt_prefix()