[ADD/MOD] XMPP->Matrix media bridge, small cleanup

This commit is contained in:
LDA 2024-06-23 15:34:51 +02:00
commit 42d69226f0
14 changed files with 327 additions and 54 deletions

View file

@ -43,4 +43,10 @@ extern void ASSetName(const ParseeConfig *c, char *user, char *name);
/* Returns the user's name in a room, or a copy of the MXID itself, to be
* Free'd. */
extern char * ASGetName(const ParseeConfig *c, char *room, char *user);
/* Uploads data to Matrix to be used later */
extern char * ASUpload(const ParseeConfig *c, Stream *from, unsigned int size);
/* Reuploads a HTTP URL to Matrix, with an optional MIME type returned. */
extern char * ASReupload(const ParseeConfig *c, char *from, char **mime);
#endif

View file

@ -12,6 +12,9 @@ extern HashMap * MatrixCreateNotice(char *body);
/* Creates the content for a normal message. */
extern HashMap * MatrixCreateMessage(char *body);
/* Creates the content for a media file. */
extern HashMap * MatrixCreateMedia(char *mxc, char *body, char *mime);
/* Creates the content for a m.room.name state event */
extern HashMap * MatrixCreateNameState(char *name);

View file

@ -44,6 +44,10 @@ typedef struct ParseeData {
Db *db;
} ParseeData;
#define SECONDS * 1000
#define MINUTES * 60 SECONDS
#define HOURS * 60 MINUTES
/* Initialises a Parsee config from scratch, and writes to it
* as JSON in the CWD. */
extern void ParseeConfigInit(void);
@ -150,4 +154,7 @@ extern bool ParseeVerifyStanza(ParseeData *, char *chat_id, char *stanza_id);
extern void ParseeSendPresence(ParseeData *);
extern bool ParseeInitialiseSignals(HttpServer *, pthread_t, XMPPComponent *);
/* Job used to cleanup Parsee data that isn't necessary anymore. */
extern void ParseeCleanup(void *data);
#endif

View file

@ -64,6 +64,7 @@ extern void XMLAddAttr(XMLElement *element, char *key, char *val);
extern void XMLAddChild(XMLElement *element, XMLElement *child);
extern XMLElement * XMLookForUnique(XMLElement *parent, char *tag);
extern XMLElement * XMLookForTKV(XMLElement *parent, char *tag, char *k, char *v);
/* Frees an XML element properly. */
extern void XMLFreeElement(XMLElement *element);