mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-03-03 04:50:43 +01:00
Added Channel.{deop,devoice,dehalfop}
This commit is contained in:
parent
7f3cafbfbd
commit
39ab2b78bf
@ -1,3 +1,5 @@
|
||||
* Added Channel.{deop,devoice,dehalfop}.
|
||||
|
||||
* Added Http.size and Http.doctype and Http.headers to retrieve
|
||||
various meta-information on URLs.
|
||||
|
||||
|
@ -89,6 +89,42 @@ class Channel(callbacks.Privmsg):
|
||||
else:
|
||||
irc.error(msg, 'How can I voice you? I\'m not opped!')
|
||||
voice = privmsgs.checkChannelCapability(voice, 'voice')
|
||||
|
||||
def deop(self, irc, msg, args, channel):
|
||||
"""[<channel>] <nick> [<nick> ...]
|
||||
|
||||
If you have the #channel.op capability, this will remove operator
|
||||
privileges from all the nicks given.
|
||||
"""
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.deops(channel, args))
|
||||
else:
|
||||
irc.error(msg, 'How can I deop someone? I\'m not opped!')
|
||||
deop = privmsgs.checkChannelCapability(deop, 'op')
|
||||
|
||||
def dehalfop(self, irc, msg, args, channel):
|
||||
"""[<channel>] <nick> [<nick> ...]
|
||||
|
||||
If you have the #channel.op capability, this will remove half-operator
|
||||
privileges from all the nicks given.
|
||||
"""
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.dehalfops(channel, args))
|
||||
else:
|
||||
irc.error(msg, 'How can I deop someone? I\'m not opped!')
|
||||
dehalfop = privmsgs.checkChannelCapability(dehalfop, 'op')
|
||||
|
||||
def devoice(self, irc, msg, args, channel):
|
||||
"""[<channel>] <nick> [<nick> ...]
|
||||
|
||||
If you have the #channel.op capability, this will remove voice from all
|
||||
the nicks given.
|
||||
"""
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
irc.queueMsg(ircmsgs.devoices(channel, args))
|
||||
else:
|
||||
irc.error(msg, 'How can I deop someone? I\'m not opped!')
|
||||
devoice = privmsgs.checkChannelCapability(devoice, 'op')
|
||||
|
||||
def cycle(self, irc, msg, args, channel):
|
||||
"""[<channel>] [<key>]
|
||||
|
@ -48,6 +48,13 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
self.assertEqual(m.args, (self.channel, '-b', 'foo!bar@baz'))
|
||||
self.assertNotError(' ')
|
||||
|
||||
def testErrorsWithoutOps(self):
|
||||
for s in ['op', 'deop', 'voice', 'devoice', 'halfop', 'dehalfop']:
|
||||
self.assertError(s)
|
||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||
self.assertNotError(s)
|
||||
self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick))
|
||||
|
||||
def testOp(self):
|
||||
self.assertError('op')
|
||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||
|
Loading…
x
Reference in New Issue
Block a user