mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[MOD] Make functions for creating a "killer stanza"
Cleaning up the mop...
This commit is contained in:
parent
14ebef53ce
commit
e089cea02a
4 changed files with 46 additions and 16 deletions
|
|
@ -54,3 +54,37 @@ XMPPSendPresence(XMPPComponent *comp, char *fr, char *to)
|
|||
XMLFreeElement(presence);
|
||||
Free(from);
|
||||
}
|
||||
void
|
||||
XMPPKillThread(XMPPComponent *jabber)
|
||||
{
|
||||
XMLElement *message, *body, *data;
|
||||
char *from;
|
||||
|
||||
if (!jabber)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
from = StrConcat(2, "jabber_die@", jabber->host);
|
||||
message = XMLCreateTag("message");
|
||||
XMLAddAttr(message, "from", from);
|
||||
XMLAddAttr(message, "to", from);
|
||||
XMLAddAttr(message, "type", "kill_parsee");
|
||||
body = XMLCreateTag("body");
|
||||
XMLAddChild(message, body);
|
||||
|
||||
XMLEncode(jabber->stream, message);
|
||||
StreamFlush(jabber->stream);
|
||||
XMLFreeElement(message);
|
||||
Free(from);
|
||||
}
|
||||
bool
|
||||
XMPPIsKiller(XMLElement *stanza)
|
||||
{
|
||||
if (!stanza)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return StrEquals( HashMapGet(stanza->attrs, "from"),
|
||||
HashMapGet(stanza->attrs, "to"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue