mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 13:45:10 +00:00
54 lines
1.7 KiB
C
54 lines
1.7 KiB
C
#ifndef PARSEE_XMPP_H
|
|
#define PARSEE_XMPP_H
|
|
|
|
#include <Cytoplasm/Stream.h>
|
|
|
|
#include <XML.h>
|
|
|
|
typedef struct XMPPComponent {
|
|
char *host;
|
|
Stream *stream;
|
|
} XMPPComponent;
|
|
|
|
/* Initialises a raw component stream to host, with an optional port.
|
|
* If said port is 0, then it is set to the default Prosody port */
|
|
extern XMPPComponent * XMPPInitialiseCompStream(char *host, int port);
|
|
|
|
/* Authenticates a component stream with a given shared secret,
|
|
* with a stream ID from the server. This should be called right
|
|
* after XMPPInitialiseCompStream. */
|
|
extern bool XMPPAuthenticateCompStream(XMPPComponent *comp, char *shared);
|
|
|
|
/* Makes a user join a MUC */
|
|
extern void XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc);
|
|
|
|
/* TODO: XMPP stuff, I don't fucking know, I'm not a Jabbernerd. */
|
|
extern void XMPPSendPlain(XMPPComponent *c, char *f, char *t, char *m, char *type);
|
|
|
|
/* Closes a raw component stream. */
|
|
extern void XMPPEndCompStream(XMPPComponent *stream);
|
|
|
|
/* Sends a loopback stanza (a "killstanza"), used to kill an XMPP listener
|
|
* thread. */
|
|
extern void XMPPKillThread(XMPPComponent *jabber, char *killer);
|
|
|
|
/* Checks if a stanza is a "killstanza". */
|
|
extern bool XMPPIsKiller(XMLElement *);
|
|
|
|
typedef struct MUCInfo {
|
|
bool exists;
|
|
|
|
XMPPComponent *jabber;
|
|
XMLElement *iq_reply;
|
|
} MUCInfo;
|
|
|
|
/* Queries a MUC's existence, and if $[out] is set, stores information
|
|
* pertaining the MUC itself from an <iq> query, to be freed by
|
|
* XMPPFreeMUCInfo */
|
|
extern bool XMPPQueryMUC(XMPPComponent *jabber, char *muc, MUCInfo *out);
|
|
|
|
/* Retrieves the MUC's name from an IQ reply */
|
|
extern char * XMPPGetMUCName(MUCInfo info);
|
|
|
|
extern void XMPPFreeMUCInfo(MUCInfo info);
|
|
#endif
|