From: Christian Heller Date: Thu, 14 Aug 2025 18:32:37 +0000 (+0200) Subject: Add further parameter number expectations. X-Git-Url: https://plomlompom.com/repos/booking/template?a=commitdiff_plain;ds=sidebyside;p=ircplom Add further parameter number expectations. --- diff --git a/ircplom/client.py b/ircplom/client.py index 6f46b33..0eff7a4 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -411,14 +411,14 @@ class Client(ABC, ClientQueueMixin): channel = msg.params[0] log_msg = f'{msg.nick_from_source} {msg.verb.lower()}s {channel}' match msg.verb: - case '005': + case '005' if len(msg.params) > 2: for param in msg.params[1:-1]: self._db.append('isupports', param) - case '372': # RPL_MOTD + case '372' if len(msg.params) == 2: # RPL_MOTD self._db.append('motd', msg.params[-1]) - case '376': # RPL_ENDOFMOTD + case '376' if len(msg.params) == 2: # RPL_ENDOFMOTD self._update_db('motd', None, True) - case '396': # RPL_VISIBLEHOST/RPL_YOURDISPLAYEDHOST/RPL_HOSTHIDDEN + case '396' if len(msg.params) == 3: # RPL_VISIBLEHOST # '@'-split because # claims: " can also be in the form " self._update_db('client_host', confirm=True, @@ -439,7 +439,7 @@ class Client(ABC, ClientQueueMixin): self.send(IrcMessage('AUTHENTICATE', ('PLAIN',))) else: self._caps.end_negotiation() - case 'ERROR': + case 'ERROR' if len(msg.params) == 1: self.close() case 'JOIN' if len(msg.params) == 1: self._log(log_msg, scope=scope, channel=channel) @@ -449,7 +449,7 @@ class Client(ABC, ClientQueueMixin): case 'NICK' if (len(msg.params) == 1 and msg.nick_from_source == self._db.nickname): self._update_db('nickname', msg.params[0], confirm=True) - case 'NOTICE' | 'PRIVMSG' if len(msg.params) > 1: + case 'NOTICE' | 'PRIVMSG' if len(msg.params) == 2: scope = LogScope.CHAT if '!' in msg.source else LogScope.SERVER self._log(msg.params[-1], scope=scope, channel=msg.params[0], out=False, as_notice=msg.verb == 'NOTICE', @@ -460,7 +460,7 @@ class Client(ABC, ClientQueueMixin): self._log(log_msg, scope=scope, channel=channel) case 'PING' if len(msg.params) == 1: self.send(IrcMessage(verb='PONG', params=(msg.params[0],))) - case '903' | '904': + case '903' | '904' if len(msg.params) == 1: alert = msg.verb == '904' self._log(f'SASL auth {"failed" if alert else "succeeded"}', alert=alert)