mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +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
|
|
@ -30,4 +30,10 @@ extern void ASJoin(const ParseeConfig *, char *, char *);
|
|||
* Said body is freed during the function's execution. */
|
||||
extern void ASSend(const ParseeConfig *, char *, char *, char *, HashMap *);
|
||||
|
||||
/* Sets a state event with a specific type and body */
|
||||
extern void ASSetState(const ParseeConfig *conf, char *id, char *type, char *key, char *mask, HashMap *event);
|
||||
|
||||
/* Creates a room, with a masquerade user as its creator. This function
|
||||
* returns it's ID if it exists. */
|
||||
extern char * ASCreateRoom(const ParseeConfig *c, char *by, char *alias);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11,4 +11,7 @@ extern HashMap * MatrixCreateNotice(char *body);
|
|||
|
||||
/* Creates the content for a normal message. */
|
||||
extern HashMap * MatrixCreateMessage(char *body);
|
||||
|
||||
/* Creates the content for a m.room.name state event */
|
||||
extern HashMap * MatrixCreateNameState(char *name);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -95,6 +95,8 @@ extern void ParseeRequest(HttpServerContext *, void *);
|
|||
/* A pthread callback used for listening to a component */
|
||||
extern void * ParseeXMPPThread(void *data);
|
||||
|
||||
/* Wakes up the XMPP thread from a "suspend" killer stanza */
|
||||
extern void ParseeWakeupThread(void);
|
||||
|
||||
/* Finds the room a DM is associated to, from a Matrix user and a Jabber
|
||||
* ID. */
|
||||
|
|
@ -108,4 +110,26 @@ extern void ParseePushDMRoom(ParseeData *, char *mxid, char *jid, char *r);
|
|||
|
||||
/* Trims the component from a JID */
|
||||
extern char * ParseeTrimJID(char *jid);
|
||||
|
||||
/* Decodes a room alias into a MUC JID */
|
||||
extern char * ParseeDecodeLocalMUC(const ParseeConfig *c, char *alias);
|
||||
|
||||
/* Decodes an encoded string(from an MXID/Room ID) into a JID */
|
||||
extern char * ParseeDecodeJID(char *str, char term);
|
||||
|
||||
/* Creates a Room/MUC mapping, and returns it's chat ID. */
|
||||
extern char * ParseePushMUC(ParseeData *, char *room_id, char *jid);
|
||||
|
||||
/* Finds a chat ID from a MUC JID */
|
||||
extern char * ParseeGetFromMUCID(ParseeData *, char *jid);
|
||||
|
||||
/* Finds a chat ID from a room ID */
|
||||
extern char * ParseeGetFromRoomID(ParseeData *, char *room_id);
|
||||
|
||||
/* Finds the room ID from a chat ID */
|
||||
extern char * ParseeGetRoomID(ParseeData *, char *chat_id);
|
||||
|
||||
/* Finds the MUC JID from a chat ID */
|
||||
extern char * ParseeGetMUCID(ParseeData *, char *chat_id);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ extern XMLElement * XMLCreateText(char *data);
|
|||
extern void XMLAddAttr(XMLElement *element, char *key, char *val);
|
||||
extern void XMLAddChild(XMLElement *element, XMLElement *child);
|
||||
|
||||
extern XMLElement * XMLookForUnique(XMLElement *parent, char *tag);
|
||||
|
||||
/* Frees an XML element properly. */
|
||||
extern void XMLFreeElement(XMLElement *element);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ extern XMPPComponent * XMPPInitialiseCompStream(char *host, int port);
|
|||
* after XMPPInitialiseCompStream. */
|
||||
extern bool XMPPAuthenticateCompStream(XMPPComponent *comp, char *shared);
|
||||
|
||||
/* Sends a presence to a user */
|
||||
extern void XMPPSendPresence(XMPPComponent *comp, char *fr, char *to);
|
||||
/* 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);
|
||||
|
|
@ -30,8 +30,25 @@ extern void XMPPEndCompStream(XMPPComponent *stream);
|
|||
|
||||
/* Sends a loopback stanza (a "killstanza"), used to kill an XMPP listener
|
||||
* thread. */
|
||||
extern void XMPPKillThread(XMPPComponent *jabber);
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue