from ircplom.client import (
AutoAttrMixin, Channel, Client, ClientQueueMixin, Dict, DictItem,
IrcConnSetup, LogScope, NewClientEvent, NickUserHost, ServerCapability,
- SharedClientDbFields, User)
+ SharedClientDbFields, Topic, User)
CMD_SHORTCUTS['disconnect'] = 'window.disconnect'
CMD_SHORTCUTS['join'] = 'window.join'
def _focused_set_and_report_change(
self, old_value: '_UpdatingNode', update: _Update
) -> tuple[tuple[LogScope, Any], ...]:
- scope = self._scope(update.key)
- if update.key == 'topic':
+ if update.key == 'user_ids':
+ assert isinstance(update.value, set)
+ d = ({'NUHS:joining': tuple(sorted(id_ for id_ in update.value
+ if id_ not in self.user_ids))}
+ if self.user_ids
+ else {'NICKS:residents': tuple(sorted(update.value))})
if super()._focused_set_and_report_change(old_value, update):
- return ((scope,
- f'RAW:{self.topic.who} set topic: {self.topic.what}'),)
+ return ((self._scope(update.key), d),)
return tuple()
- assert update.key == 'user_ids'
- assert isinstance(update.value, set)
- d = ({'NUHS:joining': tuple(sorted(id_ for id_ in update.value
- if id_ not in self.user_ids))}
- if self.user_ids
- else {'NICKS:residents': tuple(sorted(update.value))})
- if super()._focused_set_and_report_change(old_value, update):
- return ((scope, d),)
- return tuple()
+ return super()._focused_set_and_report_change(old_value, update)
class _UpdatingUser(_UpdatingNode, User):
log_kwargs |= {'target': update.path[1]}
if value is None:
self.log(f'{log_path} cleared', **log_kwargs)
+ elif isinstance(value, Topic):
+ self.log(f'{value.who} set topic: {value.what}', **log_kwargs)
elif isinstance(value, dict):
for verb, item in [(k, v) for k, v in value.items() if v]:
toks = verb.split(':', maxsplit=1)