Channel.kban: Fall-back to exact hostmask when banmask matches the bot.

This commit is contained in:
James Vega 2009-01-19 21:13:10 +00:00
parent 42ef99a152
commit 125e24ceda

View File

@ -268,7 +268,6 @@ class Channel(callbacks.Plugin):
itself. itself.
""" """
# Check that they're not trying to make us kickban ourself. # Check that they're not trying to make us kickban ourself.
self.log.debug('In kban')
if not irc.isNick(bannedNick): if not irc.isNick(bannedNick):
self.log.warning('%q tried to kban a non nick: %q', self.log.warning('%q tried to kban a non nick: %q',
msg.prefix, bannedNick) msg.prefix, bannedNick)
@ -288,11 +287,13 @@ class Channel(callbacks.Plugin):
banmask = banmaskstyle.makeBanmask(bannedHostmask, [o[0] for o in optlist]) banmask = banmaskstyle.makeBanmask(bannedHostmask, [o[0] for o in optlist])
# Check (again) that they're not trying to make us kickban ourself. # Check (again) that they're not trying to make us kickban ourself.
if ircutils.hostmaskPatternEqual(banmask, irc.prefix): if ircutils.hostmaskPatternEqual(banmask, irc.prefix):
if ircutils.hostmaskPatternEqual(banmask, irc.prefix): if ircutils.hostmaskPatternEqual(bannedHostmask, irc.prefix):
self.log.warning('%q tried to make me kban myself.',msg.prefix) self.log.warning('%q tried to make me kban myself.',msg.prefix)
irc.error('I cowardly refuse to ban myself.') irc.error('I cowardly refuse to ban myself.')
return return
else: else:
self.log.warning('Using exact hostmask since banmask would '
'ban myself.')
banmask = bannedHostmask banmask = bannedHostmask
# Now, let's actually get to it. Check to make sure they have # Now, let's actually get to it. Check to make sure they have
# #channel,op and the bannee doesn't have #channel,op; or that the # #channel,op and the bannee doesn't have #channel,op; or that the