[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

@ -131,3 +131,26 @@ XMLookForUnique(XMLElement *parent, char *tag)
return NULL;
}
XMLElement *
XMLookForTKV(XMLElement *parent, char *tag, char *k, char *v)
{
size_t i;
if (!parent || !tag || !k || !v)
{
return NULL;
}
for (i = 0; i < ArraySize(parent->children); i++)
{
XMLElement *child = ArrayGet(parent->children, i);
HashMap *attrs = child->attrs;
char *value = HashMapGet(attrs, k);
if (StrEquals(child->name, tag) && StrEquals(value, v))
{
return child;
}
}
return NULL;
}