Skip to content

Add jamulusserver/privateChatMessage RPC method for sending messages to single channels#3731

Open
dingodoppelt wants to merge 2 commits into
jamulussoftware:mainfrom
dingodoppelt:private_message
Open

Add jamulusserver/privateChatMessage RPC method for sending messages to single channels#3731
dingodoppelt wants to merge 2 commits into
jamulussoftware:mainfrom
dingodoppelt:private_message

Conversation

@dingodoppelt

@dingodoppelt dingodoppelt commented Jun 9, 2026

Copy link
Copy Markdown
Member

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

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

@pljones

pljones commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks.

@ann0see ann0see added this to the Release 4.0.0 milestone Jun 10, 2026
@ann0see ann0see added this to Tracking Jun 10, 2026
@github-project-automation github-project-automation Bot moved this to Triage in Tracking Jun 10, 2026
@ann0see ann0see moved this from Triage to Waiting on Team in Tracking Jun 10, 2026
@ann0see ann0see self-requested a review June 10, 2026 17:57
Comment thread src/serverrpc.cpp
/// @result {string} result - Always "ok".
pRpcServer->HandleMethod ( "jamulusserver/privateChatMessage", [=] ( const QJsonObject& params, QJsonObject& response ) {
auto jsonChatMessage = params["chatMessage"];
const int id = params["id"].toInt();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This needs validating, probably in CServer::CreateAndSendChatTextToChannel

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Commented there.

@ann0see ann0see Jun 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't JSON-RPC using a TCP socket, if so, it should be of basically "infinite" length?

@github-project-automation github-project-automation Bot moved this from Waiting on Team to Waiting externally in Tracking Jun 14, 2026
Comment thread src/server.cpp Outdated
Comment thread src/server.cpp
Comment thread src/serverrpc.cpp
/// @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".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How do we document errors? It should not rather be "ok" on success, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Waiting externally

Development

Successfully merging this pull request may close these issues.

3 participants