mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 16:45:10 +00:00
[ADD/WIP] Continue MUCwerk
oh man this is gonna be painful to do... xmpp is fine iff youre doing DMs isnt it?
This commit is contained in:
parent
3ac11fd269
commit
d3b7f2fee0
19 changed files with 707 additions and 44 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <Cytoplasm/Memory.h>
|
||||
#include <Cytoplasm/Str.h>
|
||||
#include <Cytoplasm/Log.h>
|
||||
|
||||
#include <XML.h>
|
||||
|
||||
|
|
@ -32,11 +33,11 @@ XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type)
|
|||
Free(from);
|
||||
}
|
||||
void
|
||||
XMPPSendPresence(XMPPComponent *comp, char *fr, char *to)
|
||||
XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
|
||||
{
|
||||
XMLElement *presence, *x;
|
||||
char *from;
|
||||
if (!comp || !fr || !to)
|
||||
if (!comp || !fr || !muc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -44,28 +45,33 @@ XMPPSendPresence(XMPPComponent *comp, char *fr, char *to)
|
|||
presence = XMLCreateTag("presence");
|
||||
x = XMLCreateTag("x");
|
||||
XMLAddAttr(presence, "from", (from = StrConcat(3, fr, "@", comp->host)));
|
||||
XMLAddAttr(presence, "to", to);
|
||||
XMLAddAttr(presence, "to", muc);
|
||||
XMLAddAttr(x, "xmlns", "http://jabber.org/protocol/muc");
|
||||
|
||||
XMLAddChild(presence, x);
|
||||
|
||||
/* A*/
|
||||
XMLEncode(comp->stream, presence);
|
||||
Log(LOG_INFO, "Flushing...");
|
||||
/* B */
|
||||
StreamFlush(comp->stream);
|
||||
|
||||
XMLFreeElement(presence);
|
||||
Free(from);
|
||||
/* How is that leaking */
|
||||
}
|
||||
void
|
||||
XMPPKillThread(XMPPComponent *jabber)
|
||||
XMPPKillThread(XMPPComponent *jabber, char *killer)
|
||||
{
|
||||
XMLElement *message, *body, *data;
|
||||
char *from;
|
||||
|
||||
if (!jabber)
|
||||
if (!jabber || !killer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from = StrConcat(2, "jabber_die@", jabber->host);
|
||||
from = StrConcat(3, killer, "@", jabber->host);
|
||||
message = XMLCreateTag("message");
|
||||
XMLAddAttr(message, "from", from);
|
||||
XMLAddAttr(message, "to", from);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue