diff --git a/help.json b/help.json index ef6f7a5..e320efa 100644 --- a/help.json +++ b/help.json @@ -1,8 +1,9 @@ { - "pass": "pass [password]", + "pass": "pass ", "logout": "logout", - "add": "add [name] [address] [port] [ssl|plain] [nickname]", - "del": "del [name", + "add": "add
", + "del": "del ", + "mod": "mod [] []", "list": "list", "rehash": "rehash" } diff --git a/threshold b/threshold index 08e83a4..7835282 100755 --- a/threshold +++ b/threshold @@ -167,7 +167,10 @@ class Helper(object): elif cmd == "list": poolMap = [] for i in pool.keys(): - poolMap.append("%s: %s" % (i, pool[i])) + poolMap.append("Server: %s" % i) + for x in pool[i].keys(): + poolMap.append("%s: %s" % (x, pool[i][x])) + poolMap.append("\n") info("\n".join(poolMap)) return @@ -188,6 +191,17 @@ class Helper(object): "port": spl[3], "protocol": protocol, "nickname": spl[5], + "username": None, + "realname": None, + "userinfo": None, + "finger": None, + "version": None, + "source": None, + "authtype": None, + "password": None, + "authentity": None, + "key": None, + "certificate": None, } success("Successfully created bot") self.savePool() @@ -210,6 +224,44 @@ class Helper(object): incUsage("del") return + elif cmd == "mod": + if length == 2: + if not spl[1] in pool.keys(): + failure("Name does not exist: %s" % spl[1]) + return + optionMap = ["Viewing options for %s" % spl[1]] + for i in pool[spl[1]].keys(): + optionMap.append("%s: %s" % (i, pool[spl[1]][i])) + info("\n".join(optionMap)) + return + + elif length == 3: + if not spl[1] in pool.keys(): + failure("Name does not exist: %s" % spl[1]) + return + if not spl[2] in pool[spl[1]].keys(): + failure("No such key: %s" % spl[2]) + return + info("%s: %s" % (spl[2], pool[spl[1]][spl[2]])) + return + + elif length == 4: + if not spl[1] in pool.keys(): + failure("Name does not exist: %s" % spl[1]) + return + if not spl[2] in pool[spl[1]].keys(): + failure("No such key: %s" % spl[2]) + return + if spl[3] == pool[spl[1]][spl[2]]: + failure("Value already exists: %s" % spl[3]) + return + pool[spl[1]][spl[2]] = spl[3] + success("Successfully set key %s to %s on %s" % (spl[2], spl[3], spl[1])) + return + + else: + incUsage("mod") + else: incUsage(None) return