mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:15:11 +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
|
|
@ -5,8 +5,12 @@
|
|||
#include <Cytoplasm/HttpRouter.h>
|
||||
#include <Cytoplasm/HttpClient.h>
|
||||
#include <Cytoplasm/Stream.h>
|
||||
#include <Cytoplasm/Db.h>
|
||||
|
||||
#include <XMPP.h>
|
||||
|
||||
typedef struct ParseeConfig {
|
||||
/* -------- MATRIX -------- */
|
||||
char *as_token, *hs_token;
|
||||
/* id here is "Parsee XMPP". */
|
||||
char *sender_localpart;
|
||||
|
|
@ -18,11 +22,24 @@ typedef struct ParseeConfig {
|
|||
/* Homeserver port info */
|
||||
char *homeserver_host;
|
||||
int homeserver_port;
|
||||
|
||||
|
||||
/* ------- JABBER -------- */
|
||||
char *component_host;
|
||||
char *shared_comp_secret;
|
||||
int component_port;
|
||||
|
||||
/* ------- DB -------- */
|
||||
char *db_path;
|
||||
} ParseeConfig;
|
||||
|
||||
typedef struct ParseeData {
|
||||
const ParseeConfig *config;
|
||||
HttpRouter *router;
|
||||
|
||||
XMPPComponent *jabber;
|
||||
|
||||
Db *db;
|
||||
} ParseeData;
|
||||
|
||||
/* Initialises a Parsee config from scratch, and writes to it
|
||||
|
|
@ -42,7 +59,7 @@ extern void ParseeExportConfigYAML(Stream *);
|
|||
extern void ParseeConfigFree(void);
|
||||
|
||||
/* Creates and destroys a data structure, stored on the heap. */
|
||||
extern ParseeData * ParseeInitData(void);
|
||||
extern ParseeData * ParseeInitData(XMPPComponent *);
|
||||
extern void ParseeFreeData(ParseeData *);
|
||||
|
||||
/* HTTP server handler for Parsee, takes in a config. */
|
||||
|
|
@ -54,8 +71,17 @@ extern HttpClientContext * ParseeCreateRequest(ParseeConfig *, HttpRequestMethod
|
|||
extern HttpStatus ParseeSetRequestJSON(HttpClientContext *, HashMap *);
|
||||
|
||||
/* This function is called on every event received, and routes/manages it. */
|
||||
extern void ParseeEventHandler(const ParseeConfig *, HashMap *);
|
||||
extern void ParseeEventHandler(ParseeData *, HashMap *);
|
||||
|
||||
/* Verifies if a user is a Parsee puppet user. */
|
||||
extern bool ParseeIsPuppet(const ParseeConfig *, char *);
|
||||
|
||||
/* Decodes a local JID for a user into a string. */
|
||||
extern char * ParseeDecodeLocalJID(const ParseeConfig *, char *);
|
||||
|
||||
/* Gets the localpart of a MXID */
|
||||
extern char * ParseeGetLocal(char *);
|
||||
|
||||
/* Encodes an MXID to a valid Jabber ID head */
|
||||
extern char * ParseeEncodeMXID(char *);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue