mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 16:55:10 +00:00
[MOD] One-way Matrix->XMPP comms.
This is not sanitised. I need to make an XML writer.
This commit is contained in:
parent
868f0e4d9c
commit
bdb4fd2f68
17 changed files with 421 additions and 61 deletions
43
src/XMPP/Stanza.c
Normal file
43
src/XMPP/Stanza.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <XMPP.h>
|
||||
|
||||
void
|
||||
XMPPSendPlain(XMPPComponent *comp, char *fr, char *to, char *msg, char *type)
|
||||
{
|
||||
if (!comp || !fr || !to || !msg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StreamPrintf(
|
||||
comp->stream, "<message from='%s@%s' to='%s'",
|
||||
fr, comp->host, to
|
||||
);
|
||||
if (type)
|
||||
{
|
||||
StreamPrintf(comp->stream, " type='%s'", type);
|
||||
}
|
||||
StreamPrintf(comp->stream, ">");
|
||||
StreamPrintf(comp->stream,
|
||||
"<body>"
|
||||
"%s"
|
||||
"</body>"
|
||||
"</message>",
|
||||
msg
|
||||
);
|
||||
StreamFlush(comp->stream);
|
||||
}
|
||||
void
|
||||
XMPPSendPresence(XMPPComponent *comp, char *fr, char *to)
|
||||
{
|
||||
if (!comp || !fr || !to)
|
||||
{
|
||||
return;
|
||||
}
|
||||
StreamPrintf(comp->stream,
|
||||
"<presence from='%s@%s' to='%s'>"
|
||||
"<x xmlns='http://jabber.org/protocol/muc'/>"
|
||||
"</presence>",
|
||||
fr, comp->host,
|
||||
to
|
||||
);
|
||||
StreamFlush(comp->stream);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue