Chat private messages (protocol v2) - #15291
Conversation
Route optional toPlayerId on the server to sender+recipient sessions only, bump chatVersion to 2, and add a recipient selector in ChatPopup when the server supports it. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Conflict note (merge order is not under our control — happy to rebase when asked): Preferred order if more than one of these lands, to minimize rebase pain:
After reworks: #15290 and #15291 both reshape message storage ( |
|
Happy to rebase / fix merge conflicts (and any review feedback) — just say the word. |
|
is |
|
So, mainly too many unnecessary properties. |
|
Ok @Fanfblrik , I have added your protocol v2 support in UncivServer.xyz. The gist of it is below:
Kindly test with the server and see if it works. |
|
Also, I think you need to add a 4th pull request or modify this to add UI support for sending private messages. |
Address review: drop toCivName/toPlayerId echo; render (private); left-align To: selector. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Addressed review feedback in 3cd1e0a82:
|
Does UncivServer.xyz work? |
|
I tested against a locally built Unciv server jar from this PR branch, not against UncivServer.xyz. Local server matches the protocol we settled on: outbound Looking at the current UncivServer.xyz side, a few gaps would block the same client path:
Once those are aligned, I can retest on UncivServer.xyz. |
|
Do we really need to increment |
|
If I leave it at 1, how will the client distinguish a server with real private routing from an old Unciv jar? |
Ok I will increment |
|
Can you check if it works now? |
|
Verified against a local UncivServer.xyz checkout (current Setup: two registered users, packed Preview+game uploaded, both WS clients Results:
Sender only got a server error: Recipient got nothing; no Cause looks to be in |
Seems like I was deleting Fixed in touhidurrr/UncivServer.xyz@832e7b2, Should be working now. |
|
Retested against a local UncivServer.xyz checkout at Same setup as before: two registered users, packed Preview+game uploaded, both WS clients Results:
Looks good on the xyz side — thanks for the fix. |
I guess that is a problem. How do we fix this? |
|
Already handled on the Unciv jar side in this PR: So for UncivServer.xyz the fix is the same idea — when routing a private message, publish to the target and the sender, not only the target. Then the sender’s chat log gets the echo over the wire like everyone else; no client-side special case needed. |
Ok. Fixed. It should work find now. Although it feels like something is missing. Anyways, can you debug another issue when you are at it? It seems like when the Server sends an error message it is printed to chat but then somehow the client gets disconnected. Can you debug it also? |
|
Checked this against the Unciv jar chat server from this PR ( Does not reproduce for in-session chat errors — the socket stays up:
On the client, The one jar path that does send |
touhidurrr
left a comment
There was a problem hiding this comment.
My requirements for backend is done. The UI can be better but we can gradually improve it. Ok from me.
Replace reserved toCivName with isPrivate so local history matches yairm210#15291 inbound private: true when that PR lands. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace reserved toCivName with isPrivate so local history matches yairm210#15291 inbound private: true when that PR lands. Co-authored-by: Cursor <cursoragent@cursor.com>
Replace reserved toCivName with isPrivate so local history matches yairm210#15291 inbound private: true when that PR lands. Co-authored-by: Cursor <cursoragent@cursor.com>
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
Resolve ChatPopup conflict: keep master's ColorMarkup nation colors and retain private-message recipient UI / isPrivate display. Keep pre-merge workflow files so the push does not require workflow scope. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Conflicts have been resolved. |


Summary
userIdon chat messages (null = public broadcast). Public chat unchanged when omitted.private: true(no recipient id/name on the wire).chatVersionis 2 when chat is enabled.ChatPopupshows a To: selector (Everyone + other human major civs) whenchatVersion >= 2. Private lines render asSender (private): text. Spectators / Unknown keep Everyone-only.ignoreUnknownKeysenabled on client/server chat JSON for forward compatibility.chatVersion: 2, private delivery + sender echo).Conflict note: preferred rebase order with sibling chat PRs is #15289 → #15290 → #15291. When rebasing onto #15290, fold
isPrivateinto existingChat.Line(history branch already uses that field name) and keep #15289 coloring inChatPopup. Happy to rebase when conflicts appear.Test plan
.\gradlew :core:compileKotlin :server:compileKotlinSender (private)display is clear enough without recipient name in the log