Added unban-without-hostmask behavior (untested) as well as fixed the bug in Channel.mode.

This commit is contained in:
Jeremy Fincher 2004-11-19 21:15:42 +00:00
parent eb83076ba1
commit a304dfeb86

View File

@ -84,7 +84,7 @@ class Channel(callbacks.Privmsg):
mode = wrap(mode, mode = wrap(mode,
[('checkChannelCapability', 'op'), [('checkChannelCapability', 'op'),
('haveOp', 'change the mode'), ('haveOp', 'change the mode'),
many('text')]) many('something')])
def limit(self, irc, msg, args, channel, limit): def limit(self, irc, msg, args, channel, limit):
"""[<channel>] [<limit>] """[<channel>] [<limit>]
@ -393,17 +393,31 @@ class Channel(callbacks.Privmsg):
additional('text')]) additional('text')])
def unban(self, irc, msg, args, channel, hostmask): def unban(self, irc, msg, args, channel, hostmask):
"""[<channel>] <hostmask> """[<channel>] [<hostmask>]
Unbans <hostmask> on <channel>. Especially useful for unbanning Unbans <hostmask> on <channel>. If <hostmask> is not given, unbans
yourself when you get unexpectedly (or accidentally) banned from any hostmask currently banned on <channel> that matches your current
the channel. <channel> is only necessary if the message isn't sent hostmask. Especially useful for unbanning yourself when you get
in the channel itself. unexpectedly (or accidentally) banned from the channel. <channel> is
only necessary if the message isn't sent in the channel itself.
""" """
irc.queueMsg(ircmsgs.unban(channel, hostmask)) if hostmask:
irc.queueMsg(ircmsgs.unban(channel, hostmask))
else:
bans = []
for banmask in irc.state.channels[channel].bans:
if ircutils.hostmaskPatternEqual(banmask, msg.prefix):
bans.append(banmask)
if bans:
irc.queueMsg(ircmsgs.unbans(channel, bans))
irc.replySuccess('All bans on %s matching %s '
'have been removed.' % (channel, msg.prefix))
else:
irc.error('No bans matching %s were found on %s.' %
(msg.prefix, channel))
unban = wrap(unban, [('checkChannelCapability', 'op'), unban = wrap(unban, [('checkChannelCapability', 'op'),
('haveOp', 'unban someone'), ('haveOp', 'unban someone'),
'hostmask']) additional('hostmask')])
def invite(self, irc, msg, args, channel, nick): def invite(self, irc, msg, args, channel, nick):
"""[<channel>] <nick> """[<channel>] <nick>