[ADD/WIP] Editing support XMPP->Matrix

This commit is contained in:
LDA 2024-06-25 17:20:00 +02:00
commit ae740878c8
13 changed files with 249 additions and 106 deletions

View file

@ -129,3 +129,31 @@ MatrixGetReply(HashMap *event)
"event_id")
));
}
HashMap *
MatrixCreateReplace(char *event, char *body)
{
HashMap *map;
HashMap *new;
HashMap *rel;
if (!body || !event)
{
return NULL;
}
map = HashMapCreate();
HashMapSet(map, "msgtype", JsonValueString("m.text"));
HashMapSet(map, "body", JsonValueString(body));
new = HashMapCreate();
HashMapSet(new, "msgtype", JsonValueString("m.text"));
HashMapSet(new, "body", JsonValueString(body));
rel = HashMapCreate();
HashMapSet(rel, "rel_type", JsonValueString("m.replace"));
HashMapSet(rel, "event_id", JsonValueString(event));
HashMapSet(map, "m.new_content", JsonValueObject(new));
HashMapSet(map, "m.relates_to", JsonValueObject(rel));
return map;
}