From: Christian Heller Date: Sun, 9 Nov 2025 17:42:14 +0000 (+0100) Subject: Fix forgetting CAP :END if no sasl capability captured. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/calendar?a=commitdiff_plain;h=8f16f474849f77dd40a312afa47da4e2218c59c7;p=ircplom Fix forgetting CAP :END if no sasl capability captured. --- diff --git a/src/ircplom/client.py b/src/ircplom/client.py index 66e9873..6b51caa 100644 --- a/src/ircplom/client.py +++ b/src/ircplom/client.py @@ -22,7 +22,9 @@ from ircplom.irc_conn import ( from ircplom.msg_parse_expectations import MSG_EXPECTATIONS -_NAMES_DESIRED_SERVER_CAPS = ('sasl',) +_SASL_CAPNAME = 'sasl' +_SASL_PLAIN = 'PLAIN' +_NAMES_DESIRED_SERVER_CAPS = (_SASL_CAPNAME,) _DISCONNECT_MSG_REGEXES_TO_RETRY_ON = ( r'^Closing Link: \(Connection timed out\)$', r'^Closing Link: \(Ping timeout: [0-9]+ seconds\)$' @@ -790,13 +792,15 @@ class Client(ABC, ClientQueueMixin): ).encode('utf-8')).decode('utf-8') self.send('AUTHENTICATE', auth) elif ret['_verb'] == 'CAP': - if (self.caps.process_msg(verb=ret['subverb'], items=ret['items'], - complete='tbc' not in ret) - and 'sasl' in self.db.caps.keys() - and 'PLAIN' in self.db.caps['sasl'].data.split(',')): - if self.db.password: + if (self.caps.process_msg(verb=ret['subverb'], + items=ret['items'], + complete='tbc' not in ret)): + if self.db.password\ + and _SASL_CAPNAME in self.db.caps.keys()\ + and _SASL_PLAIN in self.db.caps[_SASL_CAPNAME + ].data.split(','): self.db.sasl_auth_state = 'attempting' - self.send('AUTHENTICATE', 'PLAIN') + self.send('AUTHENTICATE', _SASL_PLAIN) else: self.caps.end_negotiation() elif ret['_verb'] == 'JOIN' and ret['joiner'] != self.db.users['me']: