Improvements to query and self event detection, implement all command and debug flags

This commit is contained in:
2019-08-15 21:20:49 +01:00
parent 1ec0e1f7e6
commit f34ddab6fc
13 changed files with 103 additions and 25 deletions

View File

@@ -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