Implement sending of relay messages

This commit is contained in:
Mark Veidemanis 2019-03-20 20:22:46 +00:00
parent fc304d4b25
commit 9e1a6613a4
1 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import main import main
import modules.keyword as keyword import modules.keyword as keyword
from copy import deepcopy from copy import deepcopy
from json import dumps
def testNetTarget(name, target): def testNetTarget(name, target):
called = False called = False
@ -49,6 +50,14 @@ def magicFunction(A, B):
return all(A[k] in B[k] for k in set(A) & set(B)) and set(B) <= set(A) return all(A[k] in B[k] for k in set(A) & set(B)) and set(B) <= set(A)
def event(name, target, cast): def event(name, target, cast):
for i in main.relayConnections.keys():
if main.relayConnections[i].authed and cast["type"] in main.relayConnections[i].subscriptions:
newCast = deepcopy(cast)
if not target == None:
newCast["target"] = target
if "exact" in newCast.keys():
del newCast["exact"]
main.relayConnections[i].send(dumps(newCast))
monitorGroups = testNetTarget(name, target) monitorGroups = testNetTarget(name, target)
if monitorGroups == False: if monitorGroups == False:
return return