Fix monitors to work properly with multiple groups
This commit is contained in:
parent
4b7c9f83e7
commit
de5baf562b
|
@ -3,15 +3,20 @@ import modules.keyword as keyword
|
|||
from copy import deepcopy
|
||||
|
||||
def testNetTarget(name, target):
|
||||
called = False
|
||||
for i in main.monitor.keys():
|
||||
if "sources" in main.monitor[i].keys():
|
||||
if name in main.monitor[i]["sources"]:
|
||||
if main.monitor[i]["sources"][name] == True:
|
||||
return i
|
||||
yield i
|
||||
called = True
|
||||
elif target in main.monitor[i]["sources"][name]:
|
||||
return i
|
||||
yield i
|
||||
called = True
|
||||
else:
|
||||
return i
|
||||
yield i
|
||||
called = True
|
||||
if not called:
|
||||
return False
|
||||
|
||||
def magicFunction(A, B):
|
||||
|
@ -22,9 +27,10 @@ def magicFunction(A, B):
|
|||
return all(A[k] in B[k] for k in set(A) & set(B)) and set(B) <= set(A)
|
||||
|
||||
def event(name, target, cast):
|
||||
monitorGroup = testNetTarget(name, target)
|
||||
if monitorGroup == False:
|
||||
monitorGroups = testNetTarget(name, target)
|
||||
if monitorGroups == False:
|
||||
return
|
||||
for monitorGroup in monitorGroups:
|
||||
matcher = magicFunction(deepcopy(cast), deepcopy(main.monitor[monitorGroup]))
|
||||
if matcher == True:
|
||||
if "send" in main.monitor[monitorGroup].keys():
|
||||
|
|
Loading…
Reference in New Issue