[ADD] Respect MIME, start bridging leaves/kicks

Wow, this one _wasn't_ pushed at 3AM, Outstanding.
This commit is contained in:
LDA 2024-07-07 17:30:48 +02:00
commit 43b3f8aaf5
8 changed files with 146 additions and 24 deletions

View file

@ -176,6 +176,44 @@ XMPPSendMUC(XMPPComponent *comp, char *fr, char *as, char *to, char *msg, char *
pthread_mutex_unlock(&comp->write_lock);
}
void
XMPPLeaveMUC(XMPPComponent *comp, char *fr, char *muc, char *reason)
{
XMLElement *presence;
char *from, *id;
if (!comp || !fr || !muc)
{
return;
}
pthread_mutex_lock(&comp->write_lock);
presence = XMLCreateTag("presence");
XMLAddAttr(presence, "from", (from = StrConcat(3, fr, "@", comp->host)));
XMLAddAttr(presence, "to", muc);
XMLAddAttr(presence, "id", (id = StrRandom(8)));
XMLAddAttr(presence, "type", "unavailable");
if (reason)
{
XMLElement *status = XMLCreateTag("status");
XMLElement *string = XMLCreateText(reason);
XMLAddChild(status, string);
XMLAddChild(presence, status);
}
XMPPAnnotatePresence(presence);
XMLEncode(comp->stream, presence);
StreamFlush(comp->stream);
XMLFreeElement(presence);
Free(from);
Free(id);
pthread_mutex_unlock(&comp->write_lock);
}
void
XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
{
XMLElement *presence, *x;