diff --git a/core/runtime/__pycache__/applyconditions.cpython-314.pyc b/core/runtime/__pycache__/applyconditions.cpython-314.pyc new file mode 100644 index 0000000..0841e47 Binary files /dev/null and b/core/runtime/__pycache__/applyconditions.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/outputs.cpython-314.pyc b/core/runtime/__pycache__/outputs.cpython-314.pyc index d4124be..aa58071 100644 Binary files a/core/runtime/__pycache__/outputs.cpython-314.pyc and b/core/runtime/__pycache__/outputs.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/recursive.cpython-314.pyc b/core/runtime/__pycache__/recursive.cpython-314.pyc index 980851d..4f3c28a 100644 Binary files a/core/runtime/__pycache__/recursive.cpython-314.pyc and b/core/runtime/__pycache__/recursive.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/resolver.cpython-314.pyc b/core/runtime/__pycache__/resolver.cpython-314.pyc index 4cd847b..f3f5c4f 100644 Binary files a/core/runtime/__pycache__/resolver.cpython-314.pyc and b/core/runtime/__pycache__/resolver.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/skipstep.cpython-314.pyc b/core/runtime/__pycache__/skipstep.cpython-314.pyc index 84fc027..1fd5435 100644 Binary files a/core/runtime/__pycache__/skipstep.cpython-314.pyc and b/core/runtime/__pycache__/skipstep.cpython-314.pyc differ diff --git a/core/runtime/applyconditions.py b/core/runtime/applyconditions.py new file mode 100644 index 0000000..7cd6287 --- /dev/null +++ b/core/runtime/applyconditions.py @@ -0,0 +1,26 @@ +def applyConditions(definition, outputs): + if hasattr(definition, "filters"): + for filter in definition.filters: + print("DEBUG applyConditons filter item consumption") + print(outputs["event"]) + + item = outputs["event"] + + #current_value = item[filter["filterkey"]] + + if filter["operator"] == ">=": + if item[filter["filterkey"]] >= filter["filtervalue"]: + print("Applying filters") + return True + + if filter["operator"] == "==": + if item[filter["filterkey"]] == filter["filtervalue"]: + print("Applying filters") + return True + + if filter["operator"] == "in": + if filter["filtervalue"] in outputs[filter["filterkey"]]: + print("Applying filters") + return True + + return False \ No newline at end of file diff --git a/core/runtime/outputs.py b/core/runtime/outputs.py index 3719817..f5dc045 100644 --- a/core/runtime/outputs.py +++ b/core/runtime/outputs.py @@ -20,7 +20,7 @@ def buildOutput(response, action, outputs): for output_name, response_key in action.outputs.items(): if key == response_key: outputs[output_name] = value - + #print (response_data) else: print("No response received"), diff --git a/core/server/__pycache__/createlistener.cpython-314.pyc b/core/server/__pycache__/createlistener.cpython-314.pyc index 4ad6ddc..fd42732 100644 Binary files a/core/server/__pycache__/createlistener.cpython-314.pyc and b/core/server/__pycache__/createlistener.cpython-314.pyc differ diff --git a/core/server/__pycache__/server.cpython-314.pyc b/core/server/__pycache__/server.cpython-314.pyc index f84e151..a1d6105 100644 Binary files a/core/server/__pycache__/server.cpython-314.pyc and b/core/server/__pycache__/server.cpython-314.pyc differ diff --git a/core/server/createlistener.py b/core/server/createlistener.py index d0b119f..75faac2 100644 --- a/core/server/createlistener.py +++ b/core/server/createlistener.py @@ -1,5 +1,6 @@ import json from core.runtime.outputs import buildOutput +from core.runtime.applyconditions import applyConditions from core.execution.operation import buildOperation def buildListener(listener, self): @@ -20,23 +21,31 @@ def buildListener(listener, self): #if applyConditions(listener, outputs) # continue - print(outputs) - for event in outputs[listener.recursive["source"]]: + #print(outputs) + - print("DEBUG") - print(listener.recursive["source"]) + for item in outputs[listener.recursive["source"]]: + outputs[listener.recursive["label"]] = item - if "state_key" in event: - continue - if event.get("sender") != "@lyncoln:loxthelion.com": - continue - if "com.loxthelion.rmass_message_id" in event.get("content", {}): - continue - if event.get("type") == "m.room.message": + print("DEBUG item selection") + #print(listener.recursive["label"]) + print(item) + print(outputs["event"]) + + if applyConditions(listener, outputs): + continue + + #if "state_key" in event: + #continue + #if event.get("sender") != "@lyncoln:loxthelion.com": + #continue + #if "com.loxthelion.rmass_message_id" in event.get("content", {}): + #continue + #if event.get("type") == "m.room.message": # Process and forward to RMASS - outputs = buildOperation(listener.execute, outputs) - + #outputs = buildOperation(listener.execute, outputs) + #print(event) self.send_response(200) self.send_header("Content-Type", "application/json") diff --git a/plugins/rmass/actions/__pycache__/rmassmessagepush.cpython-314.pyc b/plugins/rmass/actions/__pycache__/rmassmessagepush.cpython-314.pyc index cbeb82c..6a2091b 100644 Binary files a/plugins/rmass/actions/__pycache__/rmassmessagepush.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/rmassmessagepush.cpython-314.pyc differ diff --git a/plugins/rmass/listeners/__pycache__/synapselistener.cpython-314.pyc b/plugins/rmass/listeners/__pycache__/synapselistener.cpython-314.pyc index db393d2..2440a4a 100644 Binary files a/plugins/rmass/listeners/__pycache__/synapselistener.cpython-314.pyc and b/plugins/rmass/listeners/__pycache__/synapselistener.cpython-314.pyc differ diff --git a/plugins/rmass/listeners/synapselistener.py b/plugins/rmass/listeners/synapselistener.py index 69a7bd4..09c9a86 100644 --- a/plugins/rmass/listeners/synapselistener.py +++ b/plugins/rmass/listeners/synapselistener.py @@ -15,7 +15,24 @@ execute = rmassmessagepush recursive = { "source": "events", "reverse": False, - "label": "outboundmessage", + "label": "event", } +filters = [ + { + "filterkey": "event", + "operator": "in", + "filtervalue": "state_key", + }, + { + "filterkey": "sender", + "operator": "!=", + "filtervalue": "@lyncoln:loxthelion.com", + }, + { + "filterkey": "type", + "operator": "==", + "filtervalue": "m.room.message", + }, +] diff --git a/savedata/rmmanager.db b/savedata/rmmanager.db index c5cc505..8b30ea3 100644 Binary files a/savedata/rmmanager.db and b/savedata/rmmanager.db differ diff --git a/savedata/tokens.json b/savedata/tokens.json index edbae19..4f64dc8 100644 --- a/savedata/tokens.json +++ b/savedata/tokens.json @@ -1 +1 @@ -{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTIyMjI5MjQsIm5iZiI6MTc5MjIyMjc0NCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcH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c3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MjI0NDA5MX0.9dWUqLM3EYm68Dvk4_BzlEgbxJky8OtJtufM7S9MqOFF3gB3waVX9Q4usf4fbpy1BokDou8EJ4y3mR26PDrQnQ", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ4MzYwOTEsIm5iZiI6MTc5MjI0NDAzMSwianRpIjoiUDNkY2JFeVRYRTBOc0tDTS9vNG5NMUtmRXVLdkdhNmlMRHBWS3AxSWQraz0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MjI0NDA5MSwic3ViIjoiMjM4MzAyIn0.ttcy40iHuhgVqXq1zgRre1Xxufs3m2auyKFTPsl9qHCFXIz6xixABmy4XEvTx5960qPlMtCtRiqOLWBf_-Bqcw"} \ No newline at end of file