Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT(client): Introduced new mumble API #6425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 127 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,41 @@ 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 two channels are linked to each other.
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param firstID The ID of the first channel
* @param secondID The ID of the second channel
* @param[out] linked A pointer to where the result of the check shall be written to
* @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 firstID,
mumble_channelid_t secondID, bool *linked);

/**
* Gets the set of channels 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] linkedChannels The set of channel IDs linked to the channelID
* @param[out] linkCount 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 **linkedChannels,
size_t *linkCount);

# endif

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

Expand Down Expand Up @@ -1608,7 +1643,98 @@ 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);


/**
* Requests Mumble to remove all links between the provided channels.
*
* @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 remove link
* @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 *requestUnlinkChannelSet)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t *channelSet,
size_t channelCount);


/**
* Starts to listen channel set
*
* @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 listen
* @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 *requestStartListeningToChannels)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t *channelSet,
size_t channelCount);

/**
* Stops to listen channel set
*
* @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 stop listen
* @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 *requestStopListeningToChannels)(mumble_plugin_id_t callerID,
mumble_connection_t connection,
mumble_channelid_t *channelSet,
size_t channelCount);

/**
* Send text message to the given users
*
* @param callerID The ID of the plugin calling this function
* @param connection The ID of the server-connection
* @param users List of IDs of the users to send the message to
* @param userAmount The amount of users contained in the users parameter
* @param message The message to send (UTF-8 encoded)
* @param messageSize The size (in bytes) of the message
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *requestSendUserTextMessage)(
mumble_plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t *users, std::size_t userAmount,
const char *message, std::size_t messageSize);
Comment on lines +1729 to +1735
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param message The message to send (UTF-8 encoded)
* @param messageSize The size (in bytes) of the message
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *requestSendUserTextMessage)(
mumble_plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t *users, std::size_t userAmount,
const char *message, std::size_t messageSize);
* @param message The message to send (UTF-8 encoded as a C-string)
* @returns The error code. If everything went well, STATUS_OK will be returned.
*/
mumble_error_t(MUMBLE_PLUGIN_CALLING_CONVENTION *requestSendUserTextMessage)(
mumble_plugin_id_t callerID, mumble_connection_t connection, mumble_userid_t *users, std::size_t userAmount,
const char *message);

Sorry for reverting my own suggestion here. I noticed that we are using C-strings in other parts of the API already which inhibits null bytes from being part of it but since we use that for passwords, we can certainly use this for text messages which indeed can't contain null bytes.


# endif

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

Expand Down
27 changes: 27 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 firstID, mumble_channelid_t secondID, 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 **linkedChannels,
std::size_t *linkCount, 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,24 @@ 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 requestUnlinkChannelSet_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_channelid_t *unlinkList, std::size_t unlinkCount,
std::shared_ptr< api_promise_t > promise);
void requestStartListeningToChannels_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 requestStopListeningToChannels_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 requestSendUserTextMessage_v_1_3_x(mumble_plugin_id_t callerID, mumble_connection_t connection,
mumble_userid_t *users, std::size_t userAmount, const char *message,
std::size_t messageSize, 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 +198,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