diff --git a/src/Channel.py b/src/Channel.py index 520f81737..d52d07a21 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -96,6 +96,8 @@ class Channel(callbacks.Privmsg): If you have the #channel.op capability, this will remove operator privileges from all the nicks given. """ + if not args: + raise callbacks.ArgumentError if irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.deops(channel, args)) else: @@ -108,6 +110,8 @@ class Channel(callbacks.Privmsg): If you have the #channel.op capability, this will remove half-operator privileges from all the nicks given. """ + if not args: + raise callbacks.ArgumentError if irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.dehalfops(channel, args)) else: @@ -120,6 +124,8 @@ class Channel(callbacks.Privmsg): If you have the #channel.op capability, this will remove voice from all the nicks given. """ + if not args: + raise callbacks.ArgumentError if irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.devoices(channel, args)) else: @@ -141,6 +147,20 @@ class Channel(callbacks.Privmsg): irc.queueMsg(ircmsgs.join(channel, key)) cycle = privmsgs.checkChannelCapability(cycle, 'op') + def kick(self, irc, msg, args, channel): + """[] [] + + Kicks from for . If isn't given, + uses the nick of the person making the command as the reason. + is only necessary if the message isn't sent in the channel + itself. + """ + (nick, reason) = privmsgs.getArgs(args, optional=1) + if not reason: + reason = msg.nick + irc.queueMsg(ircmsgs.kick(channel, nick, reason)) + kick = privmsgs.checkChannelCapability(kick, 'op') + def kban(self, irc, msg, args): """[] [] diff --git a/test/test_Channel.py b/test/test_Channel.py index 5352a2ba2..5338d8112 100644 --- a/test/test_Channel.py +++ b/test/test_Channel.py @@ -50,9 +50,9 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation): def testErrorsWithoutOps(self): for s in ['op', 'deop', 'voice', 'devoice', 'halfop', 'dehalfop']: - self.assertError(s) + self.assertError('%s foo' % s) self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) - self.assertNotError(s) + self.assertNotError('%s foo' % s) self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick)) def testOp(self):