for id_ in (id_ for id_ in update.value
if id_ not in update.old_value):
update.results += [(LogScope.CHAT,
- [':joining: ', f'NUH:{id_}'])]
+ [f'NUH:{id_}', ': joins'])]
for id_ in (id_ for id_ in update.old_value
if id_ not in update.value):
- quits = self.exits[id_][0] == 'Q'
- part_msg = self.exits[id_][1:]
- exit_msg = [':' + ('quits' if quits else 'parts') + ': ',
- f'NUH:{id_}']
- if part_msg:
- exit_msg += [f':: {part_msg}']
- update.results += [(LogScope.CHAT, exit_msg)]
+ update.results += [(LogScope.CHAT,
+ _UpdatingUser.exit_msg_toks(
+ f'NUH:{id_}', self.exits[id_]))]
class _UpdatingUser(_UpdatingNode, User):
prev_nick = '?'
+ @staticmethod
+ def exit_msg_toks(tok_who: str, exit_code: str) -> list[str]:
+ 'Construct part/quit message from user identifier, exit_code.'
+ verb = 'quits' if exit_code[0] == 'Q' else 'parts'
+ exit_msg = exit_code[1:]
+ msg_toks = [tok_who, f': {verb}']
+ if exit_msg:
+ msg_toks += [f':: {exit_msg}']
+ return msg_toks
+
def recursive_set_and_report_change(self, update: _Update) -> None:
super().recursive_set_and_report_change(update)
if update.key in {'nick', 'exit_msg'}:
(LogScope.USER,
[f':{self.prev} renames {update.value}'])]
elif update.key == 'exit_msg':
- update.results.clear()
if update.value:
- msg = f':{self} quits'
- if len(update.value) > 1:
- msg += f': {update.value[1:]}'
- update.results += [(LogScope.USER_NO_CHANNELS, [msg])]
+ update.results += [(LogScope.USER_NO_CHANNELS,
+ self.exit_msg_toks(
+ f':{self}', update.value))]
@property
def prev(self) -> str:
1,2 $ 1
1,2 $ 2
1,2 $ me
-4 $ joining: baz!~baz@baz.baz
+4 $ baz!~baz@baz.baz joins
# join second channel with partial residents identity to compare distribution of resident-specific messages
> /join #testtest
1,2 $ channels:#test:user_ids set to:
1,2 $ 1
1,2 $ me
-4 $ parts: bazbaz!~baz@baz.baz
+4 $ bazbaz!~baz@baz.baz parts
1,2 $ channels:#test:exits:2 cleared
2 < :bazbaz!~baz@baz.baz JOIN :#test
1,2 $ channels:#test:user_ids set to:
1,2 $ 1
1,2 $ 2
1,2 $ me
-4 $ joining: bazbaz!~baz@baz.baz
+4 $ bazbaz!~baz@baz.baz joins
# handle non-self PART in only inhabited channel, lose identity, re-join as new identity
2 < :bar!~bar@bar.bar PART :#test
1,2 $ channels:#test:user_ids set to:
1,2 $ 2
1,2 $ me
-4 $ parts: bar!~bar@bar.bar
+4 $ bar!~bar@bar.bar parts
1,2 $ channels:#test:exits:1 cleared
1,2 $ users:1 cleared
2 < :bar!~bar@bar.bar JOIN :#test
1,2 $ 2
1,2 $ 3
1,2 $ me
-4 $ joining: bar!~bar@bar.bar
+4 $ bar!~bar@bar.bar joins
# handle non-self QUIT
2 < :bazbaz!~baz@baz.baz QUIT :Client Quit
+1,2 $ users:2:exit_msg set to: [QClient Quit]
6 $ bazbaz!~baz@baz.baz quits: Client Quit
1,2 $ channels:#test:exits:2 set to: [QClient Quit]
1,2 $ channels:#test:user_ids set to:
1,2 $ 3
1,2 $ me
-4 $ quits: bazbaz!~baz@baz.baz: Client Quit
+4 $ bazbaz!~baz@baz.baz quits: Client Quit
1,2 $ channels:#test:exits:2 cleared
1,2 $ channels:#testtest:exits:2 set to: [QClient Quit]
1,2 $ channels:#testtest:user_ids set to:
1,2 $ me
-5 $ quits: bazbaz!~baz@baz.baz: Client Quit
+5 $ bazbaz!~baz@baz.baz quits: Client Quit
1,2 $ channels:#testtest:exits:2 cleared
1,2 $ users:2 cleared
1,2 $ channels:#test:exits:me set to: [P]
1,2 $ channels:#test:user_ids set to:
1,2 $ 3
-4 $ parts: foo!~foobarbaz@baz.bar.foo
+4 $ foo!~foobarbaz@baz.bar.foo parts
1,2 $ channels:#test:exits:me cleared
1,2 $ channels:#test cleared
1,2 $ users:3 cleared
1,2 $ requesting disconnect …
2 > QUIT :ircplom says bye
2 < :foo!~foobarbaz@baz.bar.foo QUIT :Client Quit
+1,2 $ users:me:exit_msg set to: [QClient Quit]
3,6 $ foo!~foobarbaz@baz.bar.foo quits: Client Quit
1,2 $ channels:#testtest:exits:me set to: [QClient Quit]
1,2 $ channels:#testtest:user_ids set to:
-5 $ quits: foo!~foobarbaz@baz.bar.foo: Client Quit
+5 $ foo!~foobarbaz@baz.bar.foo quits: Client Quit
1,2 $ channels:#testtest:exits:me cleared
2 < ERROR :Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]
1,2 $ connection_state set to: [Closing link: (~foobarbaz@baz.bar.foo) [Quit: ircplom says bye]]
repeat 63:65
3,4,5,6 $ CONNECTED
repeat 66:147
-repeat 159:341
+repeat 159:343
> /quit
0 <