ClientsDb = dict[str, 'Client']
_NAMES_DESIRED_SERVER_CAPS = ('server-time', 'account-tag', 'sasl')
-_NUMERIC_RANGES_TO_IGNORE = ((2, 4), # irrelevant login info
- (251, 255), # more of the same, LUSERS-specific
- (265, 266)) # more LUSERS stuff
+_NUMERICS_TO_IGNORE = ( # tuples define (inclusive) ranges
+ (2, 4), # nothing in this login info we're interested in
+ (251, 255), # same
+ (265, 266), # same
+ 375, # RPL_MOTDSTART already implied to us by first appearance of 372
+)
class LogScope(Enum):
self._update_db('isupports', None, True)
self._prev_verb = msg.verb
numerics_to_ignore = []
- for min_, max_ in _NUMERIC_RANGES_TO_IGNORE:
- numerics_to_ignore += list(range(min_, max_ + 1))
+ for item in _NUMERICS_TO_IGNORE:
+ if isinstance(item, tuple):
+ numerics_to_ignore += list(range(item[0], item[1] + 1))
+ else:
+ numerics_to_ignore += [item]
if msg.verb.isdigit() and int(msg.verb) in numerics_to_ignore:
return
match msg.verb:
case '005':
for param in msg.params[1:-1]:
self._db.append('isupports', param)
- case '375':
- self._db.set('motd', [], False)
- case '372':
+ case '372': # RPL_MOTD
self._db.append('motd', msg.params[-1])
- case '376':
- self._db.set('motd', None, confirm=True)
- for line in self._db.motd:
- self._log(line, as_notice=True)
+ case '376': # RPL_ENDOFMOTD
+ self._update_db('motd', None, True)
case 'PING':
self.send(IrcMessage(verb='PONG', params=(msg.params[0],)))
case 'ERROR':