def _enforceLimit(self, irc, channel): if self.registryValue('enable', channel): maximum = self.registryValue('maximumExcess', channel) minimum = self.registryValue('minimumExcess', channel) assert maximum > minimum currentUsers = len(irc.state.channels[channel].users) currentLimit = irc.state.channels[channel].modes.get('l', 0) if currentLimit - currentUsers < minimum: self._enforce(irc, ircmsgs.limit(channel,currentUsers+maximum)) elif currentLimit - currentUsers > maximum: self._enforce(irc, ircmsgs.limit(channel,currentUsers+minimum))
def shoa(self, irc, msg, args): """ Shoa ist anberaumt """ if(self._checkCPO(irc, msg)): nicks = [] nick4 = [] def unlimit(): irc.queueMsg(ircmsgs.unlimit(msg.args[0], 0)) irc.queueMsg(ircmsgs.limit(msg.args[0], 1)) schedule.addEvent(unlimit, time.time() + 3*60) for nick in irc.state.channels[msg.args[0]].users: if nick not in irc.state.channels[msg.args[0]].ops: nicks.append(nick) i = 0 for nick in nicks: i = i+1 nick4.append(nick) if (len(nick4) >= 4): irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Reichskristallnacht')) nick4 = [] elif ((len(nicks) - i) < 4): irc.queueMsg(ircmsgs.kicks(msg.args[0], nicks, 'Reichskristallnacht')) irc.noReply()