[MOD] Do some tricks to make formatting nicer

It just didn't make sense on basic messages and Element Android.
Fluffy behaved as excepted, though.
This commit is contained in:
LDA 2024-09-16 09:32:44 +02:00
commit 05be7fe249
2 changed files with 19 additions and 8 deletions

View file

@ -399,21 +399,37 @@ ShoveXML(XEP393Element *element, XMLElement *xmlparent)
char *
XEP393ToXMLString(XEP393Element *xepd)
{
XMLElement *root;
XMLElement *root, *act_root;
XMLElement *child;
Stream *writer;
char *ret = NULL;
size_t i, children;
if (!xepd)
{
return NULL;
}
root = XMLCreateTag("span");
act_root = root;
ShoveXML(xepd, root);
writer = StrStreamWriter(&ret);
XMLEncode(writer, root);
XMLFreeElement(root);
children = ArraySize(root->children);
child = ArrayGet(root->children, 0);
if (children == 1 && StrEquals(child->name, "p"))
{
children = ArraySize(child->children);
root = child;
}
for (i = 0; i < children; i++)
{
child = ArrayGet(root->children, i);
XMLEncode(writer, child);
}
XMLFreeElement(act_root);
StreamFlush(writer);
StreamClose(writer);