Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions sopel/coretasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,11 @@ def receive_cap_list(bot, trigger):
if req.success:
req.success(bot, req.prefix + trigger)
if cap == 'sasl': # TODO why is this not done with bot.cap_req?
receive_cap_ack_sasl(bot)
try:
receive_cap_ack_sasl(bot)
except ConfigurationError as error:
LOGGER.error(str(error))
bot.quit('Wrong SASL configuration.')


def receive_cap_ls_reply(bot, trigger):
Expand Down Expand Up @@ -845,6 +849,19 @@ def sasl_success(bot, trigger):
bot.write(('CAP', 'END'))


@plugin.event(events.ERR_SASLFAIL)
@plugin.event(events.ERR_SASLTOOLONG)
@plugin.event(events.ERR_SASLABORTED)
@plugin.event(events.ERR_NICKLOCKED)
@plugin.unblockable
@plugin.thread(False)
def sasl_fail(bot, trigger):
"""SASL Auth Failed: log the error and quit."""
LOGGER.error(
'SASL Auth Failed; check your configuration: %s', str(trigger))
bot.quit('SASL Auth Failed')


@module.event(events.RPL_SASLMECHS)
@module.unblockable
def sasl_mechs(bot, trigger):
Expand Down Expand Up @@ -873,10 +890,13 @@ def sasl_mechs(bot, trigger):

See https://github.com/sopel-irc/sopel/issues/1780 for background
"""
raise ConfigurationError(
"Configured SASL mechanism '{}' is not advertised by this server. "
"Advertised values: {}"
.format(mech, ', '.join(supported_mechs)))
LOGGER.error(
"Configured SASL mechanism '%s' is not advertised by this server. "
"Advertised values: %s",
mech,
', '.join(supported_mechs),
)
bot.quit('Wrong SASL configuration.')


def _get_sasl_pass_and_mech(bot):
Expand Down