diff --git a/core/runtime/applyconditions.py b/core/runtime/applyconditions.py index 1313ba4..177c233 100644 --- a/core/runtime/applyconditions.py +++ b/core/runtime/applyconditions.py @@ -47,6 +47,11 @@ def applyConditions(definition, dictionary, outputs): print(filter["print"]) return True, filter + if filter["operator"] == "is": + if resolvedvalue is filtervalue: + print(filter["print"]) + return True, filter + except KeyError: print(f"Value not present in runtime for filtering during {definition.name}") #print(filter) diff --git a/plugins/rmass/actions/synapseassignavatar.py b/plugins/rmass/actions/synapseassignavatar.py index 448e74e..c1069c9 100644 --- a/plugins/rmass/actions/synapseassignavatar.py +++ b/plugins/rmass/actions/synapseassignavatar.py @@ -19,6 +19,10 @@ resolve = { {"resolved": "sender"}, ":loxthelion.com", ], + "matrixdm": [ + "rmass_dm_", + {"resolved": "sender"}, + ], }, } @@ -65,11 +69,41 @@ headers = { #} filters = [ +# { +# "filterkey": "avatar_hash", +# "operator": "==", +# "filtervalue": {"outputs": "db_avatar_hash"}, +# "print": f"User avatar up to date. Skipping {name}...", +# }, { - "filterkey": "avatar_hash", - "operator": "==", - "filtervalue": {"outputs": "db_avatar_hash"}, - "print": f"User avatar up to date. Skipping {name}...", + "filterkey": "uploadimage", + "operator": "is", + "filtervalue": None, + "print": f"No avatar for upload. Skipping {name}...", }, ] +#saverow = { +# "table": "user_profiles", +# "columns": [ +# {"rmass_user_id": "INTEGER PRIMARY KEY"}, +# {"rmass_username": "TEXT NOT NULL UNIQUE"}, +# {"rmass_dm_room": "TEXT NOT NULL UNIQUE"}, +# {"rmass_avatar_hash": "TEXT"}, +# ], +# "rowitems": [ +# {"resolved": "sender"}, +# {"resolved": "username"}, +# {"resolved": "matrixdm"}, +# {"outputs": "useravatar_hash"}, +# ], +# "onconflict": { +# "target": "rmass_user_id", +# "update": [ +# "rmass_username", +# "rmass_dm_room", +# "rmass_avatar_hash", +# ], +# "preservenull": True, +# }, +#} \ No newline at end of file diff --git a/plugins/rmass/actions/synapsepushmessages.py b/plugins/rmass/actions/synapsepushmessages.py index 924090b..c2ccefe 100644 --- a/plugins/rmass/actions/synapsepushmessages.py +++ b/plugins/rmass/actions/synapsepushmessages.py @@ -17,8 +17,9 @@ resolve = { "sender": ["messageitem", "senderId"], "message_id": ["messageitem", "id"], "message_body": ["messageitem", "text"], - "room_id": ["dmroom_id"], + "room_id": ["room_id"], "timestamp": ["messageitem", "createdAt"], + #"attachments": ["messageitem", "attachments"] }, "construct": { "matrixuser": [ @@ -114,7 +115,6 @@ readrow = { "rowsearchvalue": [ {"resolved": "message_id"}, ], - "columnnumber": 0, "export": { 0: "db_message_id", } @@ -127,5 +127,18 @@ filters = [ "filtervalue": {"outputs": "db_message_id"}, "print": "Message already forwarded. Continuing...", }, -] - +## To be uncommented once getrmassattachments is introduced +# { +# "filterkey": "attachments", +# "operator": "is not", +# "filtervalue": None, +# "print": "Getting message attachments...", +# "execute": "getrmassattachments" +# }, + { + "filterkey": "room_id", + "operator": "is", + "filtervalue": None, + "print": f"DM room is unavailable. Skipping {name}...", + }, +] \ No newline at end of file