def on_whoreply(self,c,e): """ Handles the servers whoreplies We do the periodic check for for user modes here. e.source = <server> e.target = <nickname> e.arguments = [channel, ~nickname, host, server, nickname, H*, 0 realname] """ channel = e.arguments()[0] nick = e.arguments()[4] host = e.arguments()[2] try: ip = gethostbyname(host) except: return if nick == e.target(): level = "o" else: level = dbstuff.getLevel(channel,host) if DEBUG: print("whoreply with %s %s (%s) in %s has %s" % (nick, host, ip, channel, level)) if (level == "v") or (level == "o"): c.mode(channel,"+%s %s" % (level,nick))
def on_join(self,c,e): """ Handles the servers JOIN messages Here the bot eventually welcomes a new user (but not to himself) And the bot queries the database for getting the highest mode for the new user and applies it """ nick = nm_to_n(e.source()) host = nm_to_h(e.source()) channel = e.target() if DEBUG: print nick + " joined" if nick != c.get_nickname(): #c.privmsg(channel,"Hello %s" % nick) level = dbstuff.getLevel(channel,host) if DEBUG: print("level: %s on %s in %s has %s" % (nick, host, channel, level)) if (level == "v") or (level == "o"): c.mode(channel,"+%s %s" % (level,nick))