Allow owner to kban ops. Closes GH-215.

This commit is contained in:
Valentin Lorentz 2011-10-29 13:46:11 +02:00
parent 61157f1a70
commit c0beda2422
2 changed files with 10 additions and 8 deletions

View File

@ -316,7 +316,8 @@ class Channel(callbacks.Plugin):
bannedHostmask = irc.state.nickToHostmask(bannedNick) bannedHostmask = irc.state.nickToHostmask(bannedNick)
except KeyError: except KeyError:
irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True) irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
capability = ircdb.makeChannelCapability(channel, 'op') opcapability = ircdb.makeChannelCapability(channel, 'op')
ownercapability = ircdb.makeCapability(channel, 'owner')
banmaskstyle = conf.supybot.protocols.irc.banmask banmaskstyle = conf.supybot.protocols.irc.banmask
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.
@ -345,18 +346,19 @@ class Channel(callbacks.Plugin):
schedule.addEvent(f, expiry) schedule.addEvent(f, expiry)
if bannedNick == msg.nick: if bannedNick == msg.nick:
doBan() doBan()
elif ircdb.checkCapability(msg.prefix, capability): elif ircdb.checkCapability(msg.prefix, opcapability):
if ircdb.checkCapability(bannedHostmask, capability): if ircdb.checkCapability(bannedHostmask, opcapability) and \
not ircdb.checkCapability(msg.prefix, ownercapability):
self.log.warning('%s tried to ban %q, but both have %s', self.log.warning('%s tried to ban %q, but both have %s',
msg.prefix, bannedHostmask, capability) msg.prefix, bannedHostmask, opcapability)
irc.error(format(_('%s has %s too, you can\'t ban ' irc.error(format(_('%s has %s too, you can\'t ban '
'him/her/it.'), bannedNick, capability)) 'him/her/it.'), bannedNick, opcapability))
else: else:
doBan() doBan()
else: else:
self.log.warning('%q attempted kban without %s', self.log.warning('%q attempted kban without %s',
msg.prefix, capability) msg.prefix, opcapability)
irc.errorNoCapability(capability) irc.errorNoCapability(opcapability)
exact,nick,user,host exact,nick,user,host
kban = wrap(kban, kban = wrap(kban,
['op', ['op',

View File

@ -1,3 +1,3 @@
"""stick the various versioning attributes in here, so we only have to change """stick the various versioning attributes in here, so we only have to change
them once.""" them once."""
version = '0.83.4.1+limnoria (2011-10-29T12:23:19+0200)' version = '0.83.4.1+limnoria (2011-10-29T13:46:10+0200)'