Skip to content

Commit c0beda2

Browse files
committed
Allow owner to kban ops. Closes GH-215.
1 parent 61157f1 commit c0beda2

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

plugins/Channel/plugin.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ def kban(self, irc, msg, args,
316316
bannedHostmask = irc.state.nickToHostmask(bannedNick)
317317
except KeyError:
318318
irc.error(format(_('I haven\'t seen %s.'), bannedNick), Raise=True)
319-
capability = ircdb.makeChannelCapability(channel, 'op')
319+
opcapability = ircdb.makeChannelCapability(channel, 'op')
320+
ownercapability = ircdb.makeCapability(channel, 'owner')
320321
banmaskstyle = conf.supybot.protocols.irc.banmask
321322
banmask = banmaskstyle.makeBanmask(bannedHostmask, [o[0] for o in optlist])
322323
# Check (again) that they're not trying to make us kickban ourself.
@@ -345,18 +346,19 @@ def f():
345346
schedule.addEvent(f, expiry)
346347
if bannedNick == msg.nick:
347348
doBan()
348-
elif ircdb.checkCapability(msg.prefix, capability):
349-
if ircdb.checkCapability(bannedHostmask, capability):
349+
elif ircdb.checkCapability(msg.prefix, opcapability):
350+
if ircdb.checkCapability(bannedHostmask, opcapability) and \
351+
not ircdb.checkCapability(msg.prefix, ownercapability):
350352
self.log.warning('%s tried to ban %q, but both have %s',
351-
msg.prefix, bannedHostmask, capability)
353+
msg.prefix, bannedHostmask, opcapability)
352354
irc.error(format(_('%s has %s too, you can\'t ban '
353-
'him/her/it.'), bannedNick, capability))
355+
'him/her/it.'), bannedNick, opcapability))
354356
else:
355357
doBan()
356358
else:
357359
self.log.warning('%q attempted kban without %s',
358-
msg.prefix, capability)
359-
irc.errorNoCapability(capability)
360+
msg.prefix, opcapability)
361+
irc.errorNoCapability(opcapability)
360362
exact,nick,user,host
361363
kban = wrap(kban,
362364
['op',

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""stick the various versioning attributes in here, so we only have to change
22
them once."""
3-
version = '0.83.4.1+limnoria (2011-10-29T12:23:19+0200)'
3+
version = '0.83.4.1+limnoria (2011-10-29T13:46:10+0200)'

0 commit comments

Comments
 (0)