[ADD/WIP] Chat settings

Right now, they are currently unused. Extensions, and Parsee itself
will be able to use those, though.
This commit is contained in:
LDA 2024-10-29 14:44:55 +01:00
commit 064040c18f
17 changed files with 449 additions and 14 deletions

View file

@ -276,6 +276,44 @@ extern char * ParseeGetRoomID(ParseeData *, char *chat_id);
/* Finds the MUC JID from a chat ID */
extern char * ParseeGetMUCID(ParseeData *, char *chat_id);
/** 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.
* -----------------------------------
* Returns: a valid string[HEAP] | NULL
* Modifies: NOTHING
* See-Also: ParseeGetFromMUCID, ParseeGetFromRoomID, ParseeSetChatSetting */
extern char *
ParseeGetChatSetting(ParseeData *data, char *chat, char *key);
/** Fetches the entire configuration in a chat(given a Chat ID), as an hashmap
* of strings.
* -----------------------------------
* Returns: a valid string[HEAP] | NULL
* Modifies: NOTHING
* Thrasher: ParseeFreeChatSettings
* See-Also: ParseeGetFromMUCID, ParseeGetFromRoomID, ParseeSetChatSetting, ParseeGetChatSetting */
extern HashMap *
ParseeGetChatSettings(ParseeData *data, char *chat);
/** Destroys memory allocated from a call to {ParseeGetChatSettings}.
* -----------------------
* Returns: NOTHING
* Modifies: {settings}
* Thrashes: {settings}
* See-Also: ParseeGetChatSettings */
extern void
ParseeFreeChatSettings(HashMap *settings);
/** Replaces a configuration key-value pair within the chat's context, which
* can be read with {ParseeGetChatSetting}.
* -------------------------------------
* Returns: NOTHING
* Modifies: the chat context
* See-Also: ParseeGetFromMUCID, ParseeGetFromRoomID, ParseeGetChatSetting */
extern void
ParseeSetChatSetting(ParseeData *data, char *chat, char *key, char *val);
/* Pushes a stanza ID to a 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);
@ -327,6 +365,11 @@ extern void ParseePushOIDTable(char *muc, char *occupant);
extern char *ParseeLookupOID(char *muc);
extern void ParseeDestroyOIDTable(void);
extern void ParseeInitialiseAffiliationTable(void);
extern void ParseePushAffiliationTable(char *user, char *affiliation, char *role);
extern bool ParseeLookupAffiliation(char *muc, char **affiliation, char **role);
extern void ParseeDestroyAffiliationTable(void);
extern void ParseeInitialiseJIDTable(void);
extern void ParseePushJIDTable(char *muc, char *bare);
extern char *ParseeLookupJID(char *muc);