From: Christian Heller Date: Wed, 13 Aug 2025 15:29:30 +0000 (+0200) Subject: Define entire numerics ranges to ignore. X-Git-Url: https://plomlompom.com/repos/booking/static/%7B%7Bdb.prefix%7D%7D/%7B%7Bpath_up_incl%7D%7D%7B%7B%20booking.id_%20%20%201%20%7D%7D?a=commitdiff_plain;p=ircplom Define entire numerics ranges to ignore. --- diff --git a/ircplom/client.py b/ircplom/client.py index 1dfd5f8..688113a 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -14,6 +14,9 @@ from ircplom.irc_conn import (BaseIrcConnection, IrcConnAbortException, 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 class LogScope(Enum): @@ -317,11 +320,14 @@ class Client(ABC, ClientQueueMixin): def handle_msg(self, msg: IrcMessage) -> None: 'Log msg.raw, then process incoming msg into appropriate client steps.' self._log(msg.raw, scope=LogScope.RAW, out=False) + numerics_to_ignore = [] + for min_, max_ in _NUMERIC_RANGES_TO_IGNORE: + numerics_to_ignore += list(range(min_, max_ + 1)) + if msg.verb.isdigit() and int(msg.verb) in numerics_to_ignore: + return match msg.verb: case '001' | 'NICK': self._update_db('nickname', value=msg.params[0], confirm=True) - case '002' | '003' | '004': - pass # explicitly ignored verbs/numerics case '375': self._db.set('motd', [], False) case '372':