modules/notification/irc: Fix channel joining for some IRC servers. (#55444)

* Fix channel joining for some IRC servers.

Some IRC servers may return the channel in a different case than
requested.  For instance, you might request "foo" but the server
returns "FOO".  The regular expression matching must be case-insensitive
for the join response in order to handle this.

* ansible style guidelines want spaces
This commit is contained in:
Brad House 2019-04-17 18:55:43 -04:00 committed by Brian Coca
parent 73b7ab71fe
commit 52b582a7a4

View file

@ -213,7 +213,7 @@ def send_msg(msg, server='localhost', port='6667', channel=None, nick_to=None, k
start = time.time()
while 1:
join += to_native(irc.recv(1024))
if re.search(r'^:\S+ 366 %s %s :' % (nick, channel), join, flags=re.M):
if re.search(r'^:\S+ 366 %s %s :' % (nick, channel), join, flags=re.M | re.I):
break
elif time.time() - start > timeout:
raise Exception('Timeout waiting for IRC JOIN response')