Services: fix rejoin-on-kickban with atheme 7.x

- Adjust _chanRe to only match channels, as atheme also puts the target nick in bold
- Look for "unbanned <botnick>" messages in ChanServ notices (after stripping formatting)

This likely fixes GH-166. atheme has been using this format since at least 2005[1],
so it's possible that Supybot's rejoin-on-ban had never worked with it.

[1]: 4017c0da85 (diff-ba2bdc02ba7b29fd7e4931cafe63baa0R218)
This commit is contained in:
James Lu 2018-01-27 13:13:44 -08:00
parent add3ceb4e7
commit 55723c2161

View File

@ -239,7 +239,7 @@ class Services(callbacks.Plugin):
elif chanserv and ircutils.strEqual(msg.nick, chanserv):
self.doChanservNotice(irc, msg)
_chanRe = re.compile('\x02(.*?)\x02')
_chanRe = re.compile('\x02(#.*?)\x02')
def doChanservNotice(self, irc, msg):
if self.disabled(irc):
return
@ -250,9 +250,13 @@ class Services(callbacks.Plugin):
on = 'on %s' % irc.network
if m is not None:
channel = m.group(1)
if 'all bans' in s or 'unbanned from' in s:
# All bans removed (freenode)
# You have been unbanned from (oftc)
if 'all bans' in s or 'unbanned from' in s or \
('unbanned %s' % irc.nick.lower()) in \
ircutils.stripFormatting(s):
# All bans removed (old freenode?)
# You have been unbanned from (oftc, anope)
# "Unbanned \x02someuser\x02 from \x02#channel\x02 (\x02N\x02
# ban(s) removed)" (atheme 7.x)
irc.sendMsg(networkGroup.channels.join(channel))
elif 'isn\'t registered' in s:
self.log.warning('Received "%s isn\'t registered" from ChanServ %s',