mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Channel: Perform proper capability checks in devoice.
Closes: Sf#3524393 Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
parent
c90fafebe7
commit
66ac089a53
@ -1,6 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2002-2005, Jeremiah Fincher
|
# Copyright (c) 2002-2005, Jeremiah Fincher
|
||||||
# Copyright (c) 2009, James Vega
|
# Copyright (c) 2009-2012, James McCoy
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -153,14 +153,7 @@ class Channel(callbacks.Plugin):
|
|||||||
halfop = wrap(halfop, ['halfop', ('haveOp', 'halfop someone'),
|
halfop = wrap(halfop, ['halfop', ('haveOp', 'halfop someone'),
|
||||||
any('nickInChannel')])
|
any('nickInChannel')])
|
||||||
|
|
||||||
def voice(self, irc, msg, args, channel, nicks):
|
def _voice(self, irc, msg, args, channel, nicks, fn):
|
||||||
"""[<channel>] [<nick> ...]
|
|
||||||
|
|
||||||
If you have the #channel,voice capability, this will voice all the
|
|
||||||
<nick>s you provide. If you don't provide any <nick>s, this will
|
|
||||||
voice you. <channel> is only necessary if the message isn't sent in the
|
|
||||||
channel itself.
|
|
||||||
"""
|
|
||||||
if nicks:
|
if nicks:
|
||||||
if len(nicks) == 1 and msg.nick in nicks:
|
if len(nicks) == 1 and msg.nick in nicks:
|
||||||
capability = 'voice'
|
capability = 'voice'
|
||||||
@ -172,10 +165,20 @@ class Channel(callbacks.Plugin):
|
|||||||
capability = ircdb.makeChannelCapability(channel, capability)
|
capability = ircdb.makeChannelCapability(channel, capability)
|
||||||
if ircdb.checkCapability(msg.prefix, capability):
|
if ircdb.checkCapability(msg.prefix, capability):
|
||||||
def f(L):
|
def f(L):
|
||||||
return ircmsgs.voices(channel, L)
|
return fn(channel, L)
|
||||||
self._sendMsgs(irc, nicks, f)
|
self._sendMsgs(irc, nicks, f)
|
||||||
else:
|
else:
|
||||||
irc.errorNoCapability(capability)
|
irc.errorNoCapability(capability)
|
||||||
|
|
||||||
|
def voice(self, irc, msg, args, channel, nicks):
|
||||||
|
"""[<channel>] [<nick> ...]
|
||||||
|
|
||||||
|
If you have the #channel,voice capability, this will voice all the
|
||||||
|
<nick>s you provide. If you don't provide any <nick>s, this will
|
||||||
|
voice you. <channel> is only necessary if the message isn't sent in the
|
||||||
|
channel itself.
|
||||||
|
"""
|
||||||
|
self._voice(irc, msg, args, channel, nicks, ircmsgs.voices)
|
||||||
voice = wrap(voice, ['channel', ('haveOp', 'voice someone'),
|
voice = wrap(voice, ['channel', ('haveOp', 'voice someone'),
|
||||||
any('nickInChannel')])
|
any('nickInChannel')])
|
||||||
|
|
||||||
@ -228,12 +231,8 @@ class Channel(callbacks.Plugin):
|
|||||||
irc.error('I cowardly refuse to devoice myself. If you really '
|
irc.error('I cowardly refuse to devoice myself. If you really '
|
||||||
'want me devoiced, tell me to op you and then devoice '
|
'want me devoiced, tell me to op you and then devoice '
|
||||||
'me yourself.', Raise=True)
|
'me yourself.', Raise=True)
|
||||||
if not nicks:
|
self._voice(irc, msg, args, channel, nicks, ircmsgs.devoices)
|
||||||
nicks = [msg.nick]
|
devoice = wrap(devoice, ['channel', ('haveOp', 'devoice someone'),
|
||||||
def f(L):
|
|
||||||
return ircmsgs.devoices(channel, L)
|
|
||||||
self._sendMsgs(irc, nicks, f)
|
|
||||||
devoice = wrap(devoice, ['voice', ('haveOp', 'devoice someone'),
|
|
||||||
any('nickInChannel')])
|
any('nickInChannel')])
|
||||||
|
|
||||||
def cycle(self, irc, msg, args, channel):
|
def cycle(self, irc, msg, args, channel):
|
||||||
|
Loading…
Reference in New Issue
Block a user