Improvements to query and self event detection, implement all command and debug flags
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
from copy import deepcopy
|
||||
from json import dumps
|
||||
from datetime import datetime
|
||||
|
||||
import main
|
||||
from core.relay import sendRelayNotification
|
||||
from modules import userinfo
|
||||
from utils.dedup import dedup
|
||||
|
||||
def testNetTarget(name, target):
|
||||
called = False
|
||||
@@ -51,10 +53,12 @@ def magicFunction(A, B):
|
||||
else:
|
||||
return all(A[k] in B[k] for k in set(A) & set(B)) and set(B) <= set(A)
|
||||
|
||||
def event(c): # yes I'm using a short variable because otherwise it goes off the screen
|
||||
def event(numName, c): # yes I'm using a short variable because otherwise it goes off the screen
|
||||
if not "target" in c.keys():
|
||||
c["target"] = None
|
||||
|
||||
if dedup(numName, c):
|
||||
return
|
||||
# metadata scraping
|
||||
# need to check if this was received from a relay
|
||||
# in which case, do not do this
|
||||
@@ -68,9 +72,9 @@ def event(c): # yes I'm using a short variable because otherwise it goes off the
|
||||
elif c["type"] == "quit":
|
||||
userinfo.delUserByNetwork(c["name"], c["nick"], c["muser"])
|
||||
elif c["type"] == "join":
|
||||
userinfo.addUser(c["name"], c["target"], c["nick"], c["user"])
|
||||
userinfo.addUser(c["name"], c["target"], c["nick"], c["muser"])
|
||||
elif c["type"] == "part":
|
||||
userinfo.delUser(c["name"], c["target"], c["nick"], c["user"])
|
||||
userinfo.delUser(c["name"], c["target"], c["nick"], c["muser"])
|
||||
|
||||
if "mtype" in c.keys():
|
||||
if c["mtype"] == "nick":
|
||||
@@ -79,6 +83,8 @@ def event(c): # yes I'm using a short variable because otherwise it goes off the
|
||||
if "muser" in c.keys():
|
||||
del c["muser"]
|
||||
sendRelayNotification(c)
|
||||
|
||||
# only monitors below
|
||||
monitorGroups = testNetTarget(c["name"], c["target"])
|
||||
if monitorGroups == False:
|
||||
return
|
||||
|
||||
@@ -34,7 +34,7 @@ def provisionNetworkData(relay, alias, network, host, port, security, auth, pass
|
||||
elif auth == "ns":
|
||||
stage2commands["status"] = []
|
||||
stage2commands["nickserv"] = []
|
||||
stage2commands["status"].append("LoadMod NickServ")
|
||||
stage2commands["status"].append("LoadMod nickserv")
|
||||
stage2commands["nickserv"].append("Set %s" % password)
|
||||
if not main.config["ConnectOnCreate"]:
|
||||
stage3commands["status"] = []
|
||||
@@ -42,6 +42,7 @@ def provisionNetworkData(relay, alias, network, host, port, security, auth, pass
|
||||
if main.config["Toggles"]["CycleChans"]:
|
||||
stage2commands["status"] = []
|
||||
stage2commands["status"].append("LoadMod disconkick")
|
||||
stage2commands["status"].append("LoadMod chansaver")
|
||||
deliverRelayCommands(relay, commands,
|
||||
stage2=[[alias+"/"+network, stage2commands],
|
||||
[alias+"/"+network, stage3commands]])
|
||||
|
||||
@@ -23,6 +23,13 @@ def getChansSingle(name, nick):
|
||||
return None
|
||||
return [i.decode() for i in result]
|
||||
|
||||
def getChanList(name, nick):
|
||||
chanspace = "live.chan."+name+"."+nick
|
||||
result = main.r.smembers(chanspace)
|
||||
if len(result) == 0:
|
||||
return None
|
||||
return [i.decode() for i in result]
|
||||
|
||||
def getChans(nick):
|
||||
result = {}
|
||||
for i in main.nets():
|
||||
|
||||
Reference in New Issue
Block a user