From f871d3828ccc219a0c2ce62fbad840bf91566606 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 23 Jul 2004 01:19:30 +0000 Subject: [PATCH] Added Channel.limit. --- ChangeLog | 3 ++- src/Channel.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a073e3a01..9186152ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ - * Added Channel.mode, to set the mode in the channel. + * Added Channel.mode, to set modes in the channel, and + Channel.limit, to set the channel limit. * Added a new plugin, Format, which offers several commands for formatting strings on IRC. Moved several commands from to it diff --git a/src/Channel.py b/src/Channel.py index 96bd86405..30f84c726 100755 --- a/src/Channel.py +++ b/src/Channel.py @@ -69,12 +69,35 @@ class Channel(callbacks.Privmsg): """[] [ ...] Sets the mode in to , sending the arguments given. + is only necessary if the message isn't sent in the channel + itself. """ if not args: raise callbacks.ArgumentError irc.queueMsg(ircmsgs.mode(channel, args)) mode = privmsgs.checkChannelCapability(mode, 'op') + def limit(self, irc, msg, args, channel): + """[] + + Sets the channel limit to . If is 0, removes the + channel limit. is only necessary if the message isn't sent + in the channel itself. + """ + limit = privmsg.getArgs(args) + try: + limit = int(limit) + if limit < 0: + raise ValueError + except ValueError: + irc.error('%r is not a positive integer.' % limit) + return + if limit: + irc.queueMsg(ircmsgs.mode(channel, ['+l', limit])) + else: + irc.queueMsg(ircmsgs.mode(channel, ['-l'])) + limit = privmsgs.checkChannelCapability(limit, 'op') + def op(self, irc, msg, args, channel): """[] [ ...]