def testBans(self): channel = '#osu' bans = ['*!*@*', 'jemfinch!*@*'] exceptions = ['*!*@*ohio-state.edu'] noException = ircmsgs.bans(channel, bans) self.assertEqual(ircutils.separateModes(noException.args[1:]), [('+b', bans[0]), ('+b', bans[1])]) withExceptions = ircmsgs.bans(channel, bans, exceptions) self.assertEqual(ircutils.separateModes(withExceptions.args[1:]), [('+b', bans[0]), ('+b', bans[1]), ('+e', exceptions[0])])
def k(self, irc, msg, args, nicks): """[user] ... [user] Kick mit Timeban """ if(self._checkCPO(irc, msg)): hostmasks = [] for nick in nicks: prefix = irc.state.nickToHostmask(nick) user = ircutils.userFromHostmask(prefix) host = ircutils.hostFromHostmask(prefix) hostmask = '*!*@%s' % host if(host.find('mibbit.com') != -1): hostmask = '*!%s@*.mibbit.com' % user hostmasks.append(hostmask) hostmask = '*!*@%s' % self._numToDottedQuad(user) hostmasks.append(hostmask) irc.queueMsg(ircmsgs.bans(msg.args[0], hostmasks)) irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Your behavior is not conducive to the desired environment.')) def unban(): irc.queueMsg(ircmsgs.unbans(msg.args[0], hostmasks)) schedule.addEvent(unban, time.time() + 900) irc.noReply()