From f1e34ccfa989de01b7d16164ea9cce9316550961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Kochen?= Date: Tue, 17 Feb 2004 13:28:40 +0000 Subject: [PATCH] Added invite command with test, fixed docstrings. --- src/Channel.py | 52 ++++++++++++++++++++++++++++---------------- test/test_Channel.py | 2 +- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/Channel.py b/src/Channel.py index 6fb650565..d267e6fa5 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -55,7 +55,7 @@ class Channel(callbacks.Privmsg): def op(self, irc, msg, args, channel): """[] [ ...] - If you have the #channel.op capability, this will give all the s + If you have the #channel,op capability, this will give all the s you provide ops. If you don't provide any s, this will op you. is only necessary if the message isn't sent in the channel itself. @@ -71,7 +71,7 @@ class Channel(callbacks.Privmsg): def halfop(self, irc, msg, args, channel): """[] - If you have the #channel.halfop capability, this will give all the + If you have the #channel,halfop capability, this will give all the s you provide halfops. If you don't provide any s, this will give you halfops. is only necessary if the message isn't sent in the channel itself. @@ -87,7 +87,7 @@ class Channel(callbacks.Privmsg): def voice(self, irc, msg, args, channel): """[] - If you have the #channel.voice capability, this will voice all the + If you have the #channel,voice capability, this will voice all the s you provide. If you don't provide any s, this will voice you. is only necessary if the message isn't sent in the channel itself. @@ -103,7 +103,7 @@ class Channel(callbacks.Privmsg): def deop(self, irc, msg, args, channel): """[] [ ...] - If you have the #channel.op capability, this will remove operator + If you have the #channel,op capability, this will remove operator privileges from all the nicks given. If no nicks are given, removes operator privileges from the person sending the message. """ @@ -122,7 +122,7 @@ class Channel(callbacks.Privmsg): def dehalfop(self, irc, msg, args, channel): """[] [ ...] - If you have the #channel.op capability, this will remove half-operator + If you have the #channel,op capability, this will remove half-operator privileges from all the nicks given. If no nicks are given, removes half-operator privileges from the person sending the message. """ @@ -141,7 +141,7 @@ class Channel(callbacks.Privmsg): def devoice(self, irc, msg, args, channel): """[] [ ...] - If you have the #channel.op capability, this will remove voice from all + If you have the #channel,op capability, this will remove voice from all the nicks given. If no nicks are given, removes voice from the person sending the message. """ @@ -160,7 +160,7 @@ class Channel(callbacks.Privmsg): def cycle(self, irc, msg, args, channel): """[] [] - If you have the #channel.op capability, this will cause the bot to + If you have the #channel,op capability, this will cause the bot to "cycle", or PART and then JOIN the channel. If is given, join the channel using that key. is only necessary if the message isn't sent in the channel itself. @@ -192,7 +192,7 @@ class Channel(callbacks.Privmsg): def kban(self, irc, msg, args): """[] [--{exact,nick,user,host}] [] - If you have the #channel.op capability, this will kickban for + If you have the #channel,op capability, this will kickban for as many seconds as you specify, or else (if you specify 0 seconds or don't specify a number of seconds) it will ban the person indefinitely. --exact bans only the exact hostmask; --nick bans just the nick; @@ -294,11 +294,25 @@ class Channel(callbacks.Privmsg): else: irc.error('How can I unban someone? I\'m not opped.') unban = privmsgs.checkChannelCapability(unban, 'op') + + def invite(self, irc, msg, args, channel): + """[] + + If you have the #channel,op capability, this will invite + to join . is only necessary if the message isn't + sent in the channel itself. + """ + nick = privmsgs.getArgs(args) + if irc.nick in irc.state.channels[channel].ops: + irc.queueMsg(ircmsgs.invite(nick, channel)) + else: + irc.error('How can I invite someone? I\'m not opped.') + invite = privmsgs.checkChannelCapability(invite, 'op') def lobotomize(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will "lobotomize" the + If you have the #channel,op capability, this will "lobotomize" the bot, making it silent and unanswering to all requests made in the channel. is only necessary if the message isn't sent in the channel itself. @@ -312,7 +326,7 @@ class Channel(callbacks.Privmsg): def unlobotomize(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will unlobotomize the bot, + If you have the #channel,op capability, this will unlobotomize the bot, making it respond to requests made in the channel again. is only necessary if the message isn't sent in the channel itself. @@ -326,7 +340,7 @@ class Channel(callbacks.Privmsg): def permban(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will effect a permanent + If you have the #channel,op capability, this will effect a permanent (persistent) ban on the given (or the current hostmask associated with . is only necessary if the message isn't sent in the channel itself. @@ -348,7 +362,7 @@ class Channel(callbacks.Privmsg): def unpermban(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will remove the permanent + If you have the #channel,op capability, this will remove the permanent ban on . is only necessary if the message isn't sent in the channel itself. """ @@ -362,7 +376,7 @@ class Channel(callbacks.Privmsg): def ignore(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will set a permanent + If you have the #channel,op capability, this will set a permanent (persistent) ignore on or the hostmask currently associated with . is only necessary if the message isn't sent in the channel itself. @@ -384,7 +398,7 @@ class Channel(callbacks.Privmsg): def unignore(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will remove the permanent + If you have the #channel,op capability, this will remove the permanent ignore on in the channel. is only necessary if the message isn't sent in the channel itself. """ @@ -418,7 +432,7 @@ class Channel(callbacks.Privmsg): def addcapability(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will give the user + If you have the #channel,op capability, this will give the user currently identified as (or the user to whom maps) the capability in the channel. is only necessary if the message isn't sent in the channel itself. @@ -438,7 +452,7 @@ class Channel(callbacks.Privmsg): def removecapability(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will take from the user + If you have the #channel,op capability, this will take from the user currently identified as (or the user to whom maps) the capability in the channel. is only necessary if the message isn't sent in the channel itself. @@ -458,7 +472,7 @@ class Channel(callbacks.Privmsg): def setdefaultcapability(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will set the default + If you have the #channel,op capability, this will set the default response to non-power-related (that is, not {op, halfop, voice} capabilities to be the value you give. is only necessary if the message isn't sent in the channel itself. @@ -482,7 +496,7 @@ class Channel(callbacks.Privmsg): def setcapability(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will add the channel + If you have the #channel,op capability, this will add the channel capability for all users in the channel. is only necessary if the message isn't sent in the channel itself. """ @@ -496,7 +510,7 @@ class Channel(callbacks.Privmsg): def unsetcapability(self, irc, msg, args, channel): """[] - If you have the #channel.op capability, this will unset the channel + If you have the #channel,op capability, this will unset the channel capability so each user's specific capability or the channel default capability will take precedence. is only necessary if the message isn't sent in the channel itself. diff --git a/test/test_Channel.py b/test/test_Channel.py index 85f1f8b43..5e0fdc7c6 100644 --- a/test/test_Channel.py +++ b/test/test_Channel.py @@ -66,7 +66,7 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation): self.assertNoResponse(' ', 2) def testErrorsWithoutOps(self): - for s in 'op deop halfop dehalfop voice devoice kick'.split(): + for s in 'op deop halfop dehalfop voice devoice kick invite'.split(): self.assertError('%s foo' % s) self.irc.feedMsg(ircmsgs.op(self.channel, self.nick)) self.assertNotError('%s foo' % s)