[ADD/MOD] XMPP->Matrix media bridge, small cleanup

This commit is contained in:
LDA 2024-06-23 15:34:51 +02:00
commit 42d69226f0
14 changed files with 327 additions and 54 deletions

View file

@ -5,7 +5,6 @@
XMLElement *
XMLDecode(Stream *stream, bool autofree)
{
/* TODO: Use the existing SAX parser to decode everything */
#define push(x) ArrayAdd(stack, x)
#define pop(x) ArrayDelete(stack, ArraySize(stack) - 1)
#define peek(x) ArrayGet(stack, ArraySize(stack) - 1)
@ -14,6 +13,7 @@ XMLDecode(Stream *stream, bool autofree)
XMLElement *ret = NULL;
XMLElement *top;
char *key, *val;
size_t i;
Array *stack;
@ -85,6 +85,15 @@ XMLDecode(Stream *stream, bool autofree)
event = NULL;
}
XMLFreeEvent(event);
for (i = 0; i < ArraySize(stack); i++)
{
XMLElement *e = ArrayGet(stack, i);
if (e == ret)
{
continue;
}
XMLFreeElement(e);
}
ArrayFree(stack);
XMLFreeLexer(lexer);
return ret;
@ -158,8 +167,6 @@ XMLEncodeTag(Stream *stream, XMLElement *element)
void
XMLEncode(Stream *stream, XMLElement *element)
{
/* TODO: Write the entire XML element. This shouldn't be
* too hard. */
if (!stream || !element)
{
return;