예제 #1
0
파일: plugin.py 프로젝트: Ban3/Limnoria
    def unban(self, irc, msg, args, channel, hostmask):
        """[<channel>] [<hostmask|--all>]

        Unbans <hostmask> on <channel>.  If <hostmask> is not given, unbans
        any hostmask currently banned on <channel> that matches your current
        hostmask.  Especially useful for unbanning yourself when you get
        unexpectedly (or accidentally) banned from the channel.  <channel> is
        only necessary if the message isn't sent in the channel itself.
        """
        if hostmask == '--all':
            bans = irc.state.channels[channel].bans
            self._sendMsg(irc, ircmsgs.unbans(channel, bans))
        elif hostmask:
            self._sendMsg(irc, 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(format(_('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))
예제 #2
0
    def unban(self, irc, msg, args, channel, hostmask):
        """[<channel>] [<hostmask>]

        Unbans <hostmask> on <channel>.  If <hostmask> is not given, unbans
        any hostmask currently banned on <channel> that matches your current
        hostmask.  Especially useful for unbanning yourself when you get
        unexpectedly (or accidentally) banned from the channel.  <channel> is
        only necessary if the message isn't sent in the channel itself.
        """
        if hostmask:
            self._sendMsg(irc, 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(
                    format(
                        _('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))
예제 #3
0
 def doKick(self, irc, msg):
     channel = msg.args[0]
     kicked = msg.args[1].split(',')
     protected = []
     for nick in kicked:
         if ircutils.strEqual(nick, irc.nick):
             return # Channel will handle the rejoin.
     for nick in kicked:
         hostmask = irc.state.nickToHostmask(nick)
         if self.isProtected(irc, channel, hostmask):
             self.log.info('%s was kicked from %s and is protected; '
                           'inviting back.', hostmask, channel)
             hostmask = '%s!%s' % (nick, irc.state.nickToHostmask(nick))
             protected.append(nick)
             bans = []
             for banmask in irc.state.channels[channel].bans:
                 if ircutils.hostmaskPatternEqual(banmask, hostmask):
                     bans.append(banmask)
             irc.queueMsg(ircmsgs.unbans(channel, bans))
             irc.queueMsg(ircmsgs.invite(nick, channel))
     if not self.isOp(irc, channel, msg.prefix):
         self.demote(irc, channel, msg.nick)
예제 #4
0
파일: plugin.py 프로젝트: rostob/Limnoria
 def doKick(self, irc, msg):
     channel = msg.channel
     kicked = msg.args[1].split(',')
     protected = []
     for nick in kicked:
         if ircutils.strEqual(nick, irc.nick):
             return  # Channel will handle the rejoin.
     for nick in kicked:
         hostmask = irc.state.nickToHostmask(nick)
         if self.isProtected(irc, channel, hostmask):
             self.log.info(
                 '%s was kicked from %s and is protected; '
                 'inviting back.', hostmask, channel)
             hostmask = '%s!%s' % (nick, irc.state.nickToHostmask(nick))
             protected.append(nick)
             bans = []
             for banmask in irc.state.channels[channel].bans:
                 if ircutils.hostmaskPatternEqual(banmask, hostmask):
                     bans.append(banmask)
             irc.queueMsg(ircmsgs.unbans(channel, bans))
             irc.queueMsg(ircmsgs.invite(nick, channel))
     if not self.isOp(irc, channel, msg.prefix):
         self.demote(irc, channel, msg.nick)
예제 #5
0
파일: plugin.py 프로젝트: krautchan/erica
			def unban():
				irc.queueMsg(ircmsgs.unbans(msg.args[0], hostmasks))