From ec1d6bf993436dd8b258daba5c0135d9ca4a11c5 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Tue, 19 Aug 2025 04:46:47 +0200 Subject: [PATCH] Handle QUIT message, at least inside of channels. --- ircplom/client.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ircplom/client.py b/ircplom/client.py index 0c2a923..df2fc7d 100644 --- a/ircplom/client.py +++ b/ircplom/client.py @@ -67,6 +67,7 @@ _EXPECTATIONS: dict[str, _MsgParseExpectation] = { 'PART': _MsgParseExpectation(1, 2), 'PING': _MsgParseExpectation(1, source=''), 'PRIVMSG': _MsgParseExpectation(2), + 'QUIT': _MsgParseExpectation(1), } @@ -658,6 +659,14 @@ class Client(ABC, ClientQueueMixin): 'users', msg.nick_from_source, stay_complete=True) elif msg.match('PING'): self.send(IrcMessage(verb='PONG', params=(msg.params[0],))) + elif msg.match('QUIT'): + user = msg.nick_from_source + for chan_name in self._db.chan_names: + chan = self._db.chan(chan_name) + if user in chan.users: + chan.remove_completable('users', user, stay_complete=True) + self._log(f'{user} quits: {msg.params[0]}', + scope=LogScope.CHAT, target=chan_name) else: self._log(f'PLEASE IMPLEMENT HANDLER FOR: {msg.raw}') -- 2.30.2