mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-14 02:15:10 +00:00
[ADD/WIP] Push all the Janet changes
This is still unstable(and I still need to design/document the exposed API)! Do(n't) go and use it!
This commit is contained in:
parent
960599d983
commit
ca87972b3a
50 changed files with 3550 additions and 92 deletions
|
|
@ -15,6 +15,7 @@ typedef struct ParseeData ParseeData;
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <Extension.h>
|
||||
#include <Command.h>
|
||||
#include <XMPP.h>
|
||||
|
||||
|
|
@ -50,6 +51,7 @@ typedef struct ParseeConfig {
|
|||
/* ------- DB -------- */
|
||||
char *db_path;
|
||||
size_t db_size;
|
||||
char *extensions;
|
||||
|
||||
/* - COMMAND-LINE FLAGS - */
|
||||
int xmpp_threads, http_threads;
|
||||
|
|
@ -72,8 +74,10 @@ typedef struct ParseeData {
|
|||
pthread_mutex_t oidl;
|
||||
|
||||
/* If Parsee was intentionally halted */
|
||||
bool halted;
|
||||
volatile bool halted;
|
||||
pthread_mutex_t halt_lock;
|
||||
|
||||
Extensions *exts;
|
||||
} ParseeData;
|
||||
|
||||
typedef struct Argument {
|
||||
|
|
@ -93,6 +97,8 @@ typedef struct Argument {
|
|||
#define GrabObject(obj, ...) JsonValueAsObject(JsonGet(obj, __VA_ARGS__))
|
||||
#define GrabArray(obj, ...) JsonValueAsArray(JsonGet(obj, __VA_ARGS__))
|
||||
|
||||
#define IterateReentrant(h, k, v, i) HashMapIterateReentrant(h, &k, (void **) &v, &i)
|
||||
|
||||
/* Milliseconds to UNIT macros, to be used like 30 SECONDS and 1 MINUTES
|
||||
* in timestamps */
|
||||
#define SECONDS * 1000
|
||||
|
|
@ -121,6 +127,7 @@ extern const char *parsee_ascii[PARSEE_ASCII_LINES];
|
|||
* Modifies: the logger output */
|
||||
extern void ParseePrintASCII(void);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if two versions of Parsee can be considered "compatible".
|
||||
* This is mainly used for things like database operations. TODO:
|
||||
|
|
@ -276,6 +283,12 @@ extern char * ParseeGetRoomID(ParseeData *, char *chat_id);
|
|||
/* Finds the MUC JID from a chat ID */
|
||||
extern char * ParseeGetMUCID(ParseeData *, char *chat_id);
|
||||
|
||||
/** Verifies if a JID maps to a chatroom through Service Discovery.
|
||||
* ----------------
|
||||
* Returns: whenever the JID is a real MUC
|
||||
* Modifies: the XMPP stream */
|
||||
extern bool ParseeIsMUC(ParseeData *data, char *jid);
|
||||
|
||||
/** Fetches a configuration value from a key in a chat(given a Chat ID),
|
||||
* as a string or NULL. Keys are to be stored like Java packages(reveres DNS).
|
||||
* Parsee has the right over any key with the <code>'p.'</code> prefix.
|
||||
|
|
@ -321,6 +334,14 @@ ParseeIsMediaEnabled(ParseeData *data, char *chat_id);
|
|||
extern void ParseePushStanza(ParseeData *, char *chat_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
||||
extern void ParseePushDMStanza(ParseeData *, char *room_id, char *stanza_id, char *origin_id, char *event, char *sender);
|
||||
|
||||
/** Automatically pushes the link between a stanza and a bridged Matrix event.
|
||||
* It behaves like {ParseePushStanza} and {ParseePushDMStanza}, but the routing
|
||||
* is done automatically.
|
||||
* ----------------------------
|
||||
* Returns: NOTHING
|
||||
* Modifies: the database */
|
||||
extern void ParseePushAllStanza(ParseeData *args, XMLElement *stanza, char *event);
|
||||
|
||||
/* Checks if a stanza is not duplicated in a chat ID */
|
||||
extern bool ParseeVerifyStanza(ParseeData *, char *chat_id, char *stanza_id);
|
||||
|
||||
|
|
@ -488,4 +509,8 @@ extern void ParseeUnlinkRoom(ParseeData *data, char *chat_id);
|
|||
* Modifies: NOTHING */
|
||||
extern bool ParseeIsMUCWhitelisted(ParseeData *data, char *muc);
|
||||
|
||||
/* TODO */
|
||||
extern char * ParseeGetBridgedUserI(ParseeData *data, XMLElement *stanza, char *force);
|
||||
#define ParseeGetBridgedUser(data, stanza) ParseeGetBridgedUserI(data, stanza, NULL)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue