Add jamulusserver/privateChatMessage RPC method for sending messages to single channels#3731
Add jamulusserver/privateChatMessage RPC method for sending messages to single channels#3731dingodoppelt wants to merge 2 commits into
Conversation
|
Thanks. |
| /// @result {string} result - Always "ok". | ||
| pRpcServer->HandleMethod ( "jamulusserver/privateChatMessage", [=] ( const QJsonObject& params, QJsonObject& response ) { | ||
| auto jsonChatMessage = params["chatMessage"]; | ||
| const int id = params["id"].toInt(); |
There was a problem hiding this comment.
This needs validating, probably in CServer::CreateAndSendChatTextToChannel
There was a problem hiding this comment.
CServer::CreateAndSendChatTextToChannel does actually validate the channel ID and will only send the message if the channel is present. It was copied from the original function for sending chat messages.
There was a problem hiding this comment.
I still think that it should then not return OK.
Furthermore, if the id is not given it "defaults" to 0.
At least if id is unset, it should fail.
There was a problem hiding this comment.
I'm guessing we have a max message length for UDP CM chat messages? The JSONRPC request message length should be validated against that and an error returned.
And yes, it needs to return an error for an incorrect channel id.
There was a problem hiding this comment.
Isn't JSON-RPC using a TCP socket, if so, it should be of basically "infinite" length?
…to single channels
e6483ad to
d54f21d
Compare
| /// @brief Sends a chat message to a single connected client. | ||
| /// @param {string} params.chatMessage - The chat message text. | ||
| /// @param {number} params.id - The client's channel id. | ||
| /// @result {string} result - Always "ok". |
There was a problem hiding this comment.
How do we document errors? It should not rather be "ok" on success, no?
Short description of changes
This makes it possible to query the server over RPC to send a chat text to a connected channel. The method takes the chat text and the channel id as arguments.
CHANGELOG: Add jamulusserver/privateChatMessage RPC method for sending messages to single channels
Context: Fixes an issue?
No
Does this change need documentation? What needs to be documented and how?
Part of auto generated RPC docs
Status of this Pull Request
Requesting review
Checklist