[ADD/WIP] Baisic VCards, worst XEP-0393 parser

Blocks coming soon. Took me a day to get a system I remotely liked, and
now I feel ashamed of that a bit. It's truly over...
This commit is contained in:
LDA 2024-07-12 19:24:59 +02:00
commit 4007232716
6 changed files with 409 additions and 12 deletions

View file

@ -3,6 +3,8 @@
#include <Cytoplasm/Memory.h>
#include <Cytoplasm/Str.h>
#include <XEP393.h>
#include <string.h>
HashMap *
@ -25,6 +27,7 @@ HashMap *
MatrixCreateMessage(char *body)
{
HashMap *map;
char *text = NULL;
if (!body)
{
return NULL;
@ -33,6 +36,17 @@ MatrixCreateMessage(char *body)
map = HashMapCreate();
HashMapSet(map, "msgtype", JsonValueString("m.text"));
HashMapSet(map, "body", JsonValueString(body));
{
/* TODO */
XEP393Element *e = XEP393(body);
text = XEP393ToXMLString(e);
XEP393FreeElement(e);
HashMapSet(map, "formatted_body", JsonValueString(text));
HashMapSet(map, "format", JsonValueString("org.matrix.custom.html"));
Free(text);
}
return map;
}