From c8eafb1ed53bb4301082c85dc4fb2d774ab54dbc Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 13 Aug 2025 17:29:30 +0200 Subject: [PATCH] Define entire numerics ranges to ignore. --- ircplom/client.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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': -- 2.30.2