[MOD/WIP] Try doing fallbacks

This commit is contained in:
LDA 2024-06-24 02:05:11 +02:00
commit cc85859cca
5 changed files with 56 additions and 2 deletions

View file

@ -4,6 +4,7 @@
#include <Cytoplasm/Str.h>
#include <Cytoplasm/Log.h>
#include <Parsee.h>
#include <XML.h>
void
@ -52,11 +53,27 @@ XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type, ch
if (rst && rse)
{
int off = ParseeFindDatastart(msg);
char *ostr = StrInt(off);
XMLElement *reply = XMLCreateTag("reply");
XMLElement *fallback = XMLCreateTag("fallback");
XMLElement *fall_body = XMLCreateTag("body");
XMLAddAttr(reply, "to", rse);
XMLAddAttr(reply, "id", rst);
XMLAddAttr(reply, "xmlns", "urn:xmpp:reply:0");
XMLAddAttr(fallback, "xmlns", "urn:xmpp:feature-fallback:0");
XMLAddAttr(fallback, "for", "urn:xmpp:reply:0");
XMLAddAttr(fall_body, "start", "0");
XMLAddAttr(fall_body, "end", ostr);
XMLAddChild(fallback, fall_body);
XMLAddChild(message, reply);
XMLAddChild(message, fallback);
Free(ostr);
}
XMLAddChild(message, body);