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()
def getident(self, irc, msg, args, nick): """[<nick>] Returns the ident of <nick>. If <nick> is not given, returns the host of the person who called the command. """ if not nick: nick = msg.nick irc.reply(ircutils.userFromHostmask(irc.state.nickToHostmask(nick)))
def doJoin(self, irc, msg): user = ircutils.userFromHostmask(msg.prefix) if user == 'root' or user == '~root': channel = msg.args[0] s = self.registryValue('warning', channel) if self.registryValue('warn', channel): irc.queueMsg(ircmsgs.notice(msg.nick, s)) if self.registryValue('kick', channel): irc.queueMsg(ircmsgs.kick(channel, msg.nick, s))
def mibbit(self, irc, msg, args, nick): """<nick> Mibbit-Check auf <nick> """ prefix = irc.state.nickToHostmask(nick) user = ircutils.userFromHostmask(prefix) host = ircutils.hostFromHostmask(prefix) if(host.find('mibbit.com') != -1): ip = self._numToDottedQuad(user) record = self._record_by_addr(ip) if record: reply = u'%s (%s)' % (ip, self._geoip_city_check(record)) else: reply = u'geoIP Fehler!' else: reply = u'%s benutzt kein mibbit' % nick irc.reply(reply.encode('utf-8'))
def mibbits(self, irc, msg, args): """ Zeigt alle mibbit-Benutzer im Kanal an """ mibbits = [] for nick in irc.state.channels[msg.args[0]].users: prefix = irc.state.nickToHostmask(nick) user = ircutils.userFromHostmask(prefix) host = ircutils.hostFromHostmask(prefix) if(host.find('mibbit.com') != -1): ip = self._numToDottedQuad(user) record = self._record_by_addr(ip) if record: mibbits.append(u'%s (%s, %s)' % (nick, ip, self._geoip_city_check(record))) else: mibbits.append('%s (geoIP Fehler)' % (nick)) if len(mibbits) > 0: reply = u'mibbits: %s' % (', '.join(mibbits)) else: reply = u'Keine mibbits entdeckt!' irc.reply(reply.encode('utf-8'))