Properly handle networks when looking up users' online status

modern-tables
Mark Veidemanis 2 years ago
parent 0457cfbbed
commit 654c9960ba
Signed by: m
GPG Key ID: 5ACFCEED46C0904F

@ -44,27 +44,30 @@ def annotate_results(results_parsed):
for net in nets: for net in nets:
# Annotate the online attribute from Threshold # Annotate the online attribute from Threshold
online_info = annotate_online( nicks = [
net, [x["nick"] for x in results_parsed if x["src"] == "irc"] x["nick"] for x in results_parsed if x["src"] == "irc" and x["net"] == net
) ]
channels = [
x["channel"]
for x in results_parsed
if x["src"] == "irc" and x["net"] == net
]
online_info = annotate_online(net, nicks)
# Annotate the number of users in the channel # Annotate the number of users in the channel
num_users = annotate_num_users( num_users = annotate_num_users(net, channels)
net, [x["channel"] for x in results_parsed if x["src"] == "irc"]
)
# Annotate the number channels the user is on # Annotate the number channels the user is on
num_chans = annotate_num_chans( num_chans = annotate_num_chans(net, nicks)
net, [x["nick"] for x in results_parsed if x["src"] == "irc"]
)
for item in results_parsed: for item in results_parsed:
if "nick" in item: if item["net"] == net:
if item["nick"] in online_info: if "nick" in item:
item["online"] = online_info[item["nick"]] if item["nick"] in online_info:
if "channel" in item: item["online"] = online_info[item["nick"]]
if item["channel"] in num_users: if "channel" in item:
item["num_users"] = num_users[item["channel"]] if item["channel"] in num_users:
if "nick" in item: item["num_users"] = num_users[item["channel"]]
if item["nick"] in num_chans: if "nick" in item:
item["num_chans"] = num_chans[item["nick"]] if item["nick"] in num_chans:
item["num_chans"] = num_chans[item["nick"]]
def filter_blacklisted(user, response): def filter_blacklisted(user, response):

Loading…
Cancel
Save