Skip to content

Commit

Permalink
FEAT(client): Introduced new mumble API to link and unlink
Browse files Browse the repository at this point in the history
This patch introduces a new API to link and unlink the channels

Co-Authored-By: Abdullah Ömer Yamaç <[email protected]>
  • Loading branch information
mryamac committed Apr 6, 2024
1 parent df2b949 commit 88b6501
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 1 deletion.
70 changes: 69 additions & 1 deletion plugins/MumblePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# define MUMBLE_PLUGIN_API_MAJOR_MACRO 1
# endif
# ifndef MUMBLE_PLUGIN_API_MINOR_MACRO
# define MUMBLE_PLUGIN_API_MINOR_MACRO 2
# define MUMBLE_PLUGIN_API_MINOR_MACRO 3
# endif
# ifndef MUMBLE_PLUGIN_API_PATCH_MACRO
# define MUMBLE_PLUGIN_API_PATCH_MACRO 0
Expand Down Expand Up @@ -1515,6 +1515,42 @@ struct MUMBLE_API_STRUCT_NAME {
mumble_channelid_t channelID,
const char **description);

# if SELECTED_API_VERSION >= MUMBLE_PLUGIN_VERSION_CHECK(1, 3, 0)

/**
* Checks whether the linkedChannelID is linked to channelID.
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param channelID The ID of the channel
* @param linkedChannelID The ID of the linked channel
* @param[out] linked A pointer to where the result of the check
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *isChannelLinkedTo)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t channelID,
mumble_channelid_t linkedChannelID,
bool *linked);

/**
* Gets the channel set the given channel is linked to.
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param channelID The ID of the channel
* @param[out] channels The set of channel IDs linked to the channelID
* @param[out] channelCount The amount of linked channels
* @returns The error code. If everything went well, STATUS_OK will be returned. Only then the passed pointers
* may be accessed.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *getLinkedChannels)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t channelID,
mumble_channelid_t **channels,
size_t *channelCount);

# endif

// -------- Request functions --------

Expand Down Expand Up @@ -1608,7 +1644,39 @@ struct MUMBLE_API_STRUCT_NAME {
mumble_connection_t connection,
const char *comment);

# if SELECTED_API_VERSION >= MUMBLE_PLUGIN_VERSION_CHECK(1, 3, 0)

/**
* Requests Mumble to link all channels in the given set to each other.
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param channelSet The set of channel IDs to link
* @param channelCount The number of elements in the channel list
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *requestLinkChannels)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t *channelSet,
size_t channelCount);

/**
* Requests Mumble to remove any existing links between the provided channel and channels in the provided set.
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param channelID The ID of the channel to unlink
* @param channelSet The set of channel IDs to remove link from the channelID
* @param channelCount The number of elements in the channel set
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *requestUnlinkChannels)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t channelID,
mumble_channelid_t *channelSet,
size_t channelCount);

# endif

// -------- Find functions --------

Expand Down
15 changes: 15 additions & 0 deletions src/mumble/API.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ public slots:
void isLocalUserMuted_v_1_0_x(mumble_plugin_id_t callerID, bool *muted, std::shared_ptr< api_promise_t > promise);
void isLocalUserDeafened_v_1_0_x(mumble_plugin_id_t callerID, bool *deafened,
std::shared_ptr< api_promise_t > promise);
void isChannelLinkedTo_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t channelID, mumble_channelid_t linkedChannelID, bool *linked,
std::shared_ptr< api_promise_t > promise);
void getUserHash_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t userID,
const char **hash, std::shared_ptr< api_promise_t > promise);
void getServerHash_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection, const char **hash,
Expand All @@ -119,6 +122,9 @@ public slots:
void getChannelDescription_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t channelID, const char **description,
std::shared_ptr< api_promise_t > promise);
void getLinkedChannels_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t channelID, mumble_channelid_t **channels,
std::size_t *channelCount, std::shared_ptr< api_promise_t > promise);
void requestUserMove_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t userID,
mumble_channelid_t channelID, const char *password,
std::shared_ptr< api_promise_t > promise);
Expand All @@ -132,6 +138,12 @@ public slots:
std::shared_ptr< api_promise_t > promise);
void requestSetLocalUserComment_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
const char *comment, std::shared_ptr< api_promise_t > promise);
void requestLinkChannels_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t *channelList, std::size_t channelCount,
std::shared_ptr< api_promise_t > promise);
void requestUnlinkChannels_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t channelID, mumble_channelid_t *unlinkList,
std::size_t unlinkCount, std::shared_ptr< api_promise_t > promise);
void findUserByName_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection, const char *userName,
mumble_userid_t *userID, std::shared_ptr< api_promise_t > promise);
void findChannelByName_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_t connection, const char *channelName,
Expand Down Expand Up @@ -174,6 +186,9 @@ MumbleAPI_v_1_0_x getMumbleAPI_v_1_0_x();
/// @returns The Mumble API struct (v1.2.x)
MumbleAPI_v_1_2_x getMumbleAPI_v_1_2_x();

/// @returns The Mumble API struct (v1.3.x)
MumbleAPI_v_1_3_x getMumbleAPI_v_1_3_x();

/// Converts from the Qt key-encoding to the API's key encoding.
///
/// @param keyCode The Qt key-code that shall be converted
Expand Down
Loading

0 comments on commit 88b6501

Please sign in to comment.