Added 'chanignores' command to list current channel ignores.

This commit is contained in:
Daniel DiPaolo 2003-11-05 17:22:38 +00:00
parent 6de6fb863b
commit b14ee76ca0
2 changed files with 20 additions and 1 deletions

View File

@ -39,6 +39,7 @@ import time
import conf
import debug
import ircdb
import utils
import ircmsgs
import schedule
import ircutils
@ -241,6 +242,24 @@ class Channel(callbacks.Privmsg):
irc.reply(msg, conf.replySuccess)
unchanignore = privmsgs.checkChannelCapability(unchanignore, 'op')
def chanignores(self, irc, msg, args, channel):
"""[<channel>]
Lists the hostmasks that the bot is ignoring on the given channel.
The <channel> argument is only necessary if the message isn't being
sent in the channel itself.
"""
channelarg = privmsgs.getArgs(args, needed=0, optional=1)
channel = channelarg or channel
c = ircdb.channels.getChannel(channel)
if len(c.ignores) == 0:
irc.reply(msg, 'I\'m not currently ignoring any hostmasks '
'in %r' % channel)
return
irc.reply(msg, utils.commaAndify(map(repr,c.ignores)))
chanignores = privmsgs.checkChannelCapability(chanignores, 'op')
def addchancapability(self, irc, msg, args, channel):
"""[<channel>] <name|hostmask> <capability>

View File

@ -77,9 +77,9 @@ class ChannelTestCase(ChannelPluginTestCase, PluginDocumentation):
def testChanignore(self):
self.assertNotError('chanignore foo!bar@baz')
self.assertResponse('chanignores', "'foo!bar@baz'")
self.assertNotError('unchanignore foo!bar@baz')
self.assertError('permban not!a.hostmask')
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: