mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 19:45:11 +00:00
[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:
parent
55ac682d26
commit
064040c18f
17 changed files with 449 additions and 14 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -45,5 +45,18 @@ typedef enum XMPPCommandFlags {
|
|||
XMPP_COMMAND(WhitelistCallback, XMPPCMD_ADMINS, "wl", "Get Parsee's chat whitelist", {}) \
|
||||
XMPP_COMMAND(MUCInformationID, XMPPCMD_MUC, "muc-info-id", "Get bridged Matrix room ID", {}) \
|
||||
XMPP_COMMAND(MUCInformationCID, XMPPCMD_MUC, "muc-info-cid", "Get MUC's internal ID", {}) \
|
||||
XMPP_COMMAND(MUCUnlink, XMPPCMD_MUC, "muc-unlink", "Unlinks MUC", {}) \
|
||||
XMPP_COMMAND(MUCSetKey, XMPPCMD_MUC, "muc-set-key", "Sets a key within the MUC/room's context", { \
|
||||
XMPPOption *key = XMPPCreateText(true, "key", ""); \
|
||||
XMPPOption *val = XMPPCreateText(true, "val", ""); \
|
||||
XMPPSetDescription(key, "Key"); \
|
||||
XMPPSetDescription(val, "Value"); \
|
||||
XMPPAddOption(cmd, key); \
|
||||
XMPPAddOption(cmd, val); \
|
||||
\
|
||||
XMPPSetFormTitle(cmd, "Set a key-value pair"); \
|
||||
XMPPSetFormInstruction(cmd, "Replace a key with a specific value"); \
|
||||
}) \
|
||||
XMPP_COMMAND(MUCGetKeys, XMPPCMD_MUC, "muc-get-keys", "Get all key-values in the MUC/room.", {}) \
|
||||
|
||||
XMPPCOMMANDS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue