Skip to content

Commit

Permalink
Properly handle IRC Authentication failures
Browse files Browse the repository at this point in the history
  • Loading branch information
gkrizek committed Jan 27, 2019
1 parent cc2708f commit 794a6fe
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ghi/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ def waitAndSee(self, search):
if tries > 20:
raise ConnectionError("Unable to connect to IRC: %s" % text)
ack = re.search(search, text, re.MULTILINE)
saslFailure = re.search(r'(.*)SASL authentication failed(.*)', text, re.MULTILINE)
if ack:
return
elif saslFailure:
raise ConnectionError("Unable to connect to IRC: SASL Authentication Failure")
sleep(0.25)
tries += 1

Expand Down Expand Up @@ -137,6 +140,8 @@ def sendMessages(pool, messages):
raise ConnectionError(text)
sleep(0.25)

logging.info("Connection Successful")

for channel in pool.channels:
for message in messages:
irc.sendMessage(channel, message)
Expand Down

0 comments on commit 794a6fe

Please sign in to comment.