From: Christian Heller Date: Tue, 25 Nov 2025 13:23:23 +0000 (+0100) Subject: Show membership prefixes in channel residents listing. X-Git-Url: https://plomlompom.com/repos/condition_titles?a=commitdiff_plain;h=56b0ee14cb73de0075131e5af1ccc7a00fd85283;p=ircplom Show membership prefixes in channel residents listing. --- diff --git a/src/ircplom/client_tui.py b/src/ircplom/client_tui.py index 5ac53a1..35f1e26 100644 --- a/src/ircplom/client_tui.py +++ b/src/ircplom/client_tui.py @@ -295,7 +295,11 @@ class _UpdatingChannel(_UpdatingNode, Channel): if not update.old_value: nicks = [] for id_ in sorted(update.value): - nicks += [f'NICK:{id_}', ':, '] + nicks += [ + ':' + ''.join(prefix for prefix in self.prefixes.keys() + if id_ in self.prefixes[prefix]), + f'NICK:{id_}', + ':, '] nicks.pop() update.results += [(_LogScope.CHAT, [':residents: '] + nicks)] else: diff --git a/src/tests/channels.test b/src/tests/channels.test index 61db464..417f1a2 100644 --- a/src/tests/channels.test +++ b/src/tests/channels.test @@ -125,7 +125,7 @@ insert user-set-to :1 + USER_ID=4 USERNICK :rab log 1 $ channels:#ch_test0:prefixes:+ set to: [3], [4] insert user-set-to :1 + USER_ID=5 USERNICK :zab insert join-channel-1 : + CHANNEL=#ch_test0 RESIDENT_IDS :[2], [3], [4], [5], [me] -log 3 $ residents: baz, oof, rab, zab, foo +log 3 $ residents: @baz, +oof, +rab, zab, foo # check server giving and taking membership prefixes insert servermsglogged : + MSG ::foo.bar.baz MODE #ch_test0 +o zab diff --git a/src/tests/isupports.test b/src/tests/isupports.test index 69e0546..3897a64 100644 --- a/src/tests/isupports.test +++ b/src/tests/isupports.test @@ -89,7 +89,7 @@ insert user-set-to :1 +1 USER_ID=2 USERNICK :baz log 1 $ channels:#ch_test6:prefixes:+ set to: [2] insert user-set-to :1 +1 USER_ID=3 USERNICK :=quux insert join-channel-1 : +0 CHANNEL=#ch_test6 RESIDENT_IDS :[1], [2], [3], [me] -log 7 $ residents: bar, baz, =quux, foo +log 7 $ residents: @bar, +baz, =quux, foo insert un-default : +0 KEY=PREFIX VALUE :(vE)+= insert join-channel-0 : +0 CHANNEL=#ch_test7 RESIDENT_NAMES :foo @bar +baz =quux insert user-set-to :1 +1 USER_ID=4 USERNICK :@bar @@ -97,7 +97,7 @@ log 1 $ channels:#ch_test7:prefixes:+ set to: [2] insert user-set-to :1 +1 USER_ID=5 USERNICK :quux log 1 $ channels:#ch_test7:prefixes:= set to: [5] insert join-channel-1 : +0 CHANNEL=#ch_test7 RESIDENT_IDS :[2], [4], [5], [me] -log 8 $ residents: baz, @bar, quux, foo +log 8 $ residents: +baz, @bar, =quux, foo # test effect of USERLEN insert join-empty : + CHAN_WIN_ID=9 CHANNEL :#ch_test8 diff --git a/src/tests/test.test b/src/tests/test.test index 6400cc2..d14e8a1 100644 --- a/src/tests/test.test +++ b/src/tests/test.test @@ -115,7 +115,7 @@ insert join-channel-0 : +0 CHANNEL=#test RESIDENT_NAMES :foo @baz insert user-set-to :1 +1 USER_ID=1 USERNICK :baz log 1 $ channels:#test:prefixes:@ set to: [1] insert join-channel-1 : +0 CHANNEL=#test RESIDENT_IDS :[1], [me] -log 4 $ residents: baz, foo +log 4 $ residents: @baz, foo # process non-self channel JOIN insert servermsglogged : +0 MSG ::bar!~bar@bar.bar JOIN :#test