2018-03-14 20:13:40 +00:00
|
|
|
import main
|
2018-03-04 17:25:57 +00:00
|
|
|
from string import digits
|
2018-02-23 22:05:40 +00:00
|
|
|
#from utils.logging.log import *
|
|
|
|
|
|
|
|
def setWho(network, newObjects):
|
2018-03-04 17:25:57 +00:00
|
|
|
network = "".join([x for x in network if not x in digits])
|
2018-03-14 20:13:40 +00:00
|
|
|
if not network in main.wholist.keys():
|
|
|
|
main.wholist[network] = {}
|
2018-02-23 22:05:40 +00:00
|
|
|
for i in newObjects.keys():
|
2018-03-14 20:13:40 +00:00
|
|
|
main.wholist[network][i] = newObjects[i]
|
2018-02-23 22:05:40 +00:00
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
def setWhoSingle(network, nick, ident, host):
|
2018-03-04 17:25:57 +00:00
|
|
|
network = "".join([x for x in network if not x in digits])
|
2018-02-23 22:05:40 +00:00
|
|
|
|
2018-03-14 20:13:40 +00:00
|
|
|
if network in main.wholist.keys():
|
|
|
|
if nick in main.wholist[network].keys():
|
|
|
|
main.wholist[network][nick][1] = ident
|
|
|
|
main.wholist[network][nick][2] = host
|
2018-02-23 22:05:40 +00:00
|
|
|
else:
|
2018-03-14 20:13:40 +00:00
|
|
|
main.wholist[network][nick] = [nick, ident, host, None, None, None]
|
|
|
|
else:
|
|
|
|
main.wholist[network] = {nick: [nick, ident, host, None, None, None]}
|
2018-02-23 22:05:40 +00:00
|
|
|
|
|
|
|
def getWho(nick):
|
|
|
|
result = {}
|
2018-03-14 20:13:40 +00:00
|
|
|
for i in main.wholist.keys():
|
|
|
|
for x in main.wholist[i].keys():
|
2018-02-23 22:05:40 +00:00
|
|
|
if nick.lower() == x.lower():
|
|
|
|
if not i in result.keys():
|
|
|
|
result[i] = []
|
2018-03-14 20:13:40 +00:00
|
|
|
result[i].append(main.wholist[i][x])
|
2018-02-23 22:05:40 +00:00
|
|
|
return result
|