From 1c1046cddbd67cb83e8a4d8a582aaab7d6c07749 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 7 Feb 2004 06:24:45 +0000 Subject: [PATCH] The bot won't de itself anymore. --- src/Channel.py | 18 +++++++++++++++--- test/test_Channel.py | 9 +++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/Channel.py b/src/Channel.py index fd04540dc..3f911918c 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -100,7 +100,11 @@ class Channel(callbacks.Privmsg): """ if not args: args.append(msg.nick) - if irc.nick in irc.state.channels[channel].ops: + if irc.nick in args: + irc.error('I cowardly refuse to deop myself. If you really want ' + 'me deopped, tell me to op you and then deop me ' + 'yourself.') + elif irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.deops(channel, args)) else: irc.error('How can I deop someone? I\'m not opped!') @@ -115,7 +119,11 @@ class Channel(callbacks.Privmsg): """ if not args: args.append(msg.nick) - if irc.nick in irc.state.channels[channel].ops: + if irc.nick in args: + irc.error('I cowardly refuse to dehalfop myself. If you really ' + 'want me dehalfopped, tell me to op you and then ' + 'dehalfop me yourself.') + elif irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.dehalfops(channel, args)) else: irc.error('How can I dehalfop someone? I\'m not opped!') @@ -130,7 +138,11 @@ class Channel(callbacks.Privmsg): """ if not args: args.append(msg.nick) - if irc.nick in irc.state.channels[channel].ops: + if irc.nick in args: + irc.error('I cowardly refuse to devoice myself. If you really ' + 'want me devoiced, tell me to op you and then devoice ' + 'me yourself.') + elif irc.nick in irc.state.channels[channel].ops: irc.queueMsg(ircmsgs.devoices(channel, args)) else: irc.error('How can I devoice someone? I\'m not opped!') diff --git a/test/test_Channel.py b/test/test_Channel.py index ec306a812..461ab9e75 100644 --- a/test/test_Channel.py +++ b/test/test_Channel.py @@ -72,6 +72,11 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation): self.assertNotError('%s foo' % s) self.irc.feedMsg(ircmsgs.deop(self.channel, self.nick)) + def testWontDeItself(self): + for s in 'deop dehalfop devoice'.split(): + self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) + self.assertError('%s %s' % (s, self.nick)) + def testOp(self): self.assertError('op') self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) @@ -114,10 +119,6 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation): self.assertNotRegexp('kban foobar time', 'ValueError') self.assertError('kban %s' % self.irc.nick) - def testLobotomizers(self): - self.assertNotError('lobotomize') - self.assertNotError('unlobotomize') - def testPermban(self): self.assertNotError('permban foo!bar@baz') self.assertNotError('unpermban foo!bar@baz')