mirror of https://github.com/Mikaela/Limnoria.git
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
|
* Added Http.size and Http.doctype and Http.headers to retrieve
|
||||||
various meta-information on URLs.
|
various meta-information on URLs.
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,42 @@ class Channel(callbacks.Privmsg):
|
||||||
irc.error(msg, 'How can I voice you? I\'m not opped!')
|
irc.error(msg, 'How can I voice you? I\'m not opped!')
|
||||||
voice = privmsgs.checkChannelCapability(voice, 'voice')
|
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):
|
def cycle(self, irc, msg, args, channel):
|
||||||
"""[<channel>] [<key>]
|
"""[<channel>] [<key>]
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,13 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||||
self.assertEqual(m.args, (self.channel, '-b', 'foo!bar@baz'))
|
self.assertEqual(m.args, (self.channel, '-b', 'foo!bar@baz'))
|
||||||
self.assertNotError(' ')
|
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):
|
def testOp(self):
|
||||||
self.assertError('op')
|
self.assertError('op')
|
||||||
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
self.irc.feedMsg(ircmsgs.op(self.channel, self.nick))
|
||||||
|
|
Loading…
Reference in New Issue