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\)$'
).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']: