示例#1
0
def handle_userdelpermit(bot, ievent):
    """ user-delpermit <name> <permit> .. remove (name, permit) from permit 
        list """
    try:
        who, what = ievent.args
    except ValueError:
        ievent.missing("<name> <what>")
        return
    if not users.exist(who):
        ievent.reply("can't find registered name of %s" % who)
        return
    name = users.getname(ievent.userhost)
    if not users.gotpermit(name, (who, what)):
        ievent.reply('%s is already not allowed to do %s' % (who, what))
        return
    result = 0
    try:
        result = users.deluserpermit(name, (who, what))
    except Exception, ex:
        ievent.reply("ERROR: %s" % str(ex))
        return
示例#2
0
def handle_addpermit(bot, ievent):
    """ user-addpermit <name> <permit> .. add permit to permit list \
        of <name> """
    try:
        who, what = ievent.args
    except ValueError:
        ievent.missing("<name> <permit>")
        return
    if not users.exist(who):
        ievent.reply("can't find username of %s" % who)
        return
    name = users.getname(ievent.userhost)
    if users.gotpermit(name, (who, what)):
        ievent.reply('%s is already allowed to do %s' % (who, what))
        return
    result = 0
    try:
        result = users.adduserpermit(name, (who, what))
    except Exception, ex:
        handle_exception()
        ievent.reply("ERROR: %s" % str(ex))
        return