From: Christian Heller Date: Fri, 19 Sep 2025 23:33:16 +0000 (+0200) Subject: Differentiate (dis-)connection message from debugging on .connection_status content. X-Git-Url: https://plomlompom.com/repos/booking/pick_tasks?a=commitdiff_plain;h=4692e49bc5fe5659708d69ac952b8db9aaf6fb8c;p=ircplom Differentiate (dis-)connection message from debugging on .connection_status content. --- diff --git a/ircplom/client_tui.py b/ircplom/client_tui.py index 3a0d7ed..8bc3a79 100644 --- a/ircplom/client_tui.py +++ b/ircplom/client_tui.py @@ -283,7 +283,14 @@ class _TuiClientDb(_UpdatingNode, SharedClientDbFields): motd: tuple[str, ...] = tuple() users: _UpdatingDict[_UpdatingUser] channels: _UpdatingDict[_UpdatingChannel] - log_scopes = {'connection_state': LogScope.ALL} + + def recursive_set_and_report_change(self, update: _Update) -> None: + super().recursive_set_and_report_change(update) + if update.key == 'connection_state': + if update.value == 'connected': + update.results += [(LogScope.ALL, [':CONNECTED'])] + elif not update.value: + update.results += [(LogScope.ALL, [':DISCONNECTED'])] class _ClientWindowsManager: diff --git a/test.txt b/test.txt index 43b9bd3..3bb10c6 100644 --- a/test.txt +++ b/test.txt @@ -44,6 +44,7 @@ # on /connect init databases, log in new windows > /connect foo.bar.baz foo:bar foobarbazquux:baz +1,2 $ DISCONNECTED 1,2 $ isupport cleared 1,2 $ isupport:CHANTYPES set to: [#&] 1,2 $ isupport:PREFIX set to: [(ov)@+] @@ -62,6 +63,7 @@ 1,2 $ port set to: [6697] 1,2 $ connection_state set to: [connecting] 1,2 $ connection_state set to: [connected] +1,2 $ CONNECTED 2 > CAP LS :302 2 > USER foobarbazquux 0 * :baz 2 > NICK :foo @@ -323,8 +325,9 @@ 5 $ quits: foo!~foobarbaz@baz.bar.foo: Client Quit 1,2 $ channels:#testtest:exits:me cleared 2 < ERROR :Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye] -1,2,3,4,5,6 $ connection_state set to: [Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]] -1,2,3,4,5,6 $ connection_state set to: [] +1,2 $ connection_state set to: [Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]] +1,2 $ connection_state set to: [] +1,2,3,4,5,6 $ DISCONNECTED 1,2 $ isupport cleared 1,2 $ isupport:CHANTYPES set to: [#&] 1,2 $ isupport:PREFIX set to: [(ov)@+] @@ -338,10 +341,10 @@ # check that (save TUI tests assuming start on window 0, and no 4 yet) on reconnect, all the same effects can be expected > /reconnect -1,2,3,4,5,6 $ connection_state set to: [connecting] -1,2,3,4,5,6 $ connection_state set to: [connected] -repeat 64:147 -repeat 158:338 +repeat 63:65 +1,2,3,4,5,6 $ CONNECTED +repeat 66:147 +repeat 159:341 > /quit 0 <