Implement searching through the wholist
This commit is contained in:
parent
7e1e0ee0d2
commit
5b6bf59d7a
|
@ -6,6 +6,7 @@
|
||||||
"mod": "mod <name> [<key>] [<value>]",
|
"mod": "mod <name> [<key>] [<value>]",
|
||||||
"get": "get <name> <variable>",
|
"get": "get <name> <variable>",
|
||||||
"key": "key <master|show|add|del|except|unexcept|showexcept|monitor> [<name>] [<target>] [<key>] [<on|off>]",
|
"key": "key <master|show|add|del|except|unexcept|showexcept|monitor> [<name>] [<target>] [<key>] [<on|off>]",
|
||||||
|
"who": "who <nick>",
|
||||||
"join": "join <name> <channel> [<key>]",
|
"join": "join <name> <channel> [<key>]",
|
||||||
"enable": "enable <name",
|
"enable": "enable <name",
|
||||||
"disable": "disable <name>",
|
"disable": "disable <name>",
|
||||||
|
|
34
threshold
34
threshold
|
@ -194,6 +194,7 @@ class IRCBot(IRCClient):
|
||||||
|
|
||||||
def signedOn(self):
|
def signedOn(self):
|
||||||
self.connected = True
|
self.connected = True
|
||||||
|
log("signed on: %s" % self.name)
|
||||||
if self.authtype == "ns":
|
if self.authtype == "ns":
|
||||||
self.msg(self.authentity, "IDENTIFY %s" % self.nspass)
|
self.msg(self.authentity, "IDENTIFY %s" % self.nspass)
|
||||||
for i in self.autojoin:
|
for i in self.autojoin:
|
||||||
|
@ -315,6 +316,18 @@ class Helper(object):
|
||||||
if nick in wholist[network].keys():
|
if nick in wholist[network].keys():
|
||||||
wholist[network][nick][1] = ident
|
wholist[network][nick][1] = ident
|
||||||
wholist[network][nick][2] = host
|
wholist[network][nick][2] = host
|
||||||
|
else:
|
||||||
|
wholist[network][nick] = [nick, ident, host, None, None, None]
|
||||||
|
|
||||||
|
def getWho(self, nick):
|
||||||
|
result = {}
|
||||||
|
for i in wholist.keys():
|
||||||
|
for x in wholist[i].keys():
|
||||||
|
if nick.lower() == x.lower():
|
||||||
|
if not i in result.keys():
|
||||||
|
result[i] = []
|
||||||
|
result[i].append(wholist[i][x])
|
||||||
|
return result
|
||||||
|
|
||||||
def saveConfig(self):
|
def saveConfig(self):
|
||||||
global config
|
global config
|
||||||
|
@ -616,6 +629,23 @@ class Helper(object):
|
||||||
incUsage("get")
|
incUsage("get")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
elif cmd == "who":
|
||||||
|
global wholist
|
||||||
|
if length == 2:
|
||||||
|
result = self.getWho(spl[1])
|
||||||
|
rtrn = ""
|
||||||
|
for i in result.keys():
|
||||||
|
rtrn += "Matches from: %s" % i
|
||||||
|
rtrn += "\n"
|
||||||
|
for x in result[i]:
|
||||||
|
rtrn += (", ".join(x))
|
||||||
|
rtrn += "\n"
|
||||||
|
info(rtrn)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
incUsage("who")
|
||||||
|
return
|
||||||
|
|
||||||
elif cmd == "key":
|
elif cmd == "key":
|
||||||
if data.startswith("key add"):
|
if data.startswith("key add"):
|
||||||
if not data in ["key add ", "key add"] and data[3] == " ":
|
if not data in ["key add ", "key add"] and data[3] == " ":
|
||||||
|
@ -752,6 +782,10 @@ class Helper(object):
|
||||||
incUsage("key")
|
incUsage("key")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
else:
|
||||||
|
incUsage("key")
|
||||||
|
return
|
||||||
|
|
||||||
elif cmd == "add":
|
elif cmd == "add":
|
||||||
if length == 6:
|
if length == 6:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue