def handle_adduserhost(bot, ievent): """ user-adduserhost <name> <userhost> .. add to userhosts of name """ if len(ievent.args) != 2: ievent.missing('<name> <userhost>') return name, userhost = ievent.args name = name.lower() if name == 'owner' and not bot.ownercheck(ievent, 'can adduserhost to \ owner'): return if not users.exist(name): ievent.reply("can't find user %s" % name) return if users.gotuserhost(name, userhost): ievent.reply('%s already has userhost %s' % (name, userhost)) return result = 0 try: result = users.adduserhost(name, userhost) except Exception, ex: ievent.reply("ERROR: %s" % str(ex)) return
def lookup(self, bot, nick, userhost): user = self.get(bot, nick) if user: users.adduserhost(user, userhost) return True return False