mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-09 11:33:25 -08:00
* [Server] Let users fetch their own private chat history Players lose their private conversations on reconnect or on another device. Servatrice can already log private messages, but only moderators can read the logs. Add Command_GetPrivateChatHistory / Response_PrivateChatHistory so a registered user can page through their own logged conversation with one other user. Operators opt in with logging/allow_user_chat_history (default off, and log_user_msg_chat must be on). The caller is matched by account id so reused guest or deleted-account names can't read older messages; only time, sender name and text are returned. Pages hold 1..200 messages and never split a second, since log_time has 1-second resolution. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * [Server] Harden private chat history identity matching Match both participants by account id and name so a federated user's remote id cannot collide with a local account, and stop storing foreign ids in the local chat log. Extract the paging assembly into a pure helper and cover the whole-second boundary rules with gtests. --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Lukas Brübach <44814898+BruebachL@users.noreply.github.com>
96 lines
6.3 KiB
Protocol Buffer
96 lines
6.3 KiB
Protocol Buffer
syntax = "proto2";
|
||
|
||
/// Server response envelope linking to a command
|
||
/**
|
||
* This message is sent immediately after a client command, using the same `cmd_id`
|
||
* to connect the response to the command.
|
||
*
|
||
* Responses may contain standard outcome codes (`ResponseCode`) and indicate
|
||
* what type of response the server is sending (`ResponseType`).
|
||
*/
|
||
message Response {
|
||
|
||
// Outcome of the command sent by the client
|
||
enum ResponseCode {
|
||
RespNotConnected = -1; // Client is not connected or session expired
|
||
RespNothing = 0; // No response required
|
||
RespOk = 1; // Command succeeded
|
||
RespNotInRoom = 2; // Client is not in the room for this command
|
||
RespInternalError = 3; // Server encountered an unexpected error
|
||
RespInvalidCommand = 4; // Command was invalid or unrecognized
|
||
RespInvalidData = 5; // Command data was invalid or malformed
|
||
RespNameNotFound = 6; // Target user not found
|
||
RespLoginNeeded = 7; // Client must log in first
|
||
RespFunctionNotAllowed = 8; // Client tried to perform a restricted action
|
||
RespGameNotStarted = 9; // Game has not started yet
|
||
RespGameFull = 10; // Game is full
|
||
RespContextError = 11; // Context (room/game) mismatch
|
||
RespWrongPassword = 12; // Password for this room or game is incorrect
|
||
RespSpectatorsNotAllowed = 13; // Spectators are not allowed in this room/game
|
||
RespOnlyBuddies = 14; // Only buddies can perform this action
|
||
RespUserLevelTooLow = 15; // User’s permission level is insufficient
|
||
RespInIgnoreList = 16; // Target user has ignored the client
|
||
RespWouldOverwriteOldSession = 17; // Would overwrite an existing session
|
||
RespChatFlood = 18; // Too many messages sent in short time
|
||
RespUserIsBanned = 19; // Client is banned
|
||
RespAccessDenied = 20; // Access to this action is denied
|
||
RespUsernameInvalid = 21; // Username is invalid
|
||
RespRegistrationRequired = 22; // Registration is required
|
||
RespRegistrationAccepted = 23; // Server agrees to process client's registration request
|
||
RespUserAlreadyExists = 24; // Client attempted to register a name which is already registered
|
||
RespEmailRequiredToRegister = 25; // Server requires email to register accounts but client did not provide one
|
||
RespTooManyRequests = 26; // Server refused to complete command because client has sent too many too quickly
|
||
RespPasswordTooShort = 27; // Server requires a decent password
|
||
RespAccountNotActivated =
|
||
28; // Client attempted to log into a registered username but the account hasn't been activated
|
||
RespRegistrationDisabled = 29; // Server does not allow clients to register
|
||
RespRegistrationFailed = 30; // Server accepted a reg request but failed to perform the registration
|
||
RespActivationAccepted = 31; // Server accepted a reg user activation token
|
||
RespActivationFailed = 32; // Server didn't accept a reg user activation token
|
||
RespRegistrationAcceptedNeedsActivation =
|
||
33; // Server accepted client registration, but it will need token activation
|
||
RespClientIdRequired = 34; // Server requires client to generate and send its client id before allowing access
|
||
RespClientUpdateRequired = 35; // Client is missing features that the server is requiring
|
||
RespServerFull = 36; // Server user limit reached
|
||
RespEmailBlackListed = 37; // Server has blocked the email address provided for registration for some reason
|
||
RespPasswordChangeRequired = 38; // Server requires the user to change their password before proceeding
|
||
}
|
||
|
||
// Type of response, used to route handling on the client
|
||
enum ResponseType {
|
||
JOIN_ROOM = 1000; // Response for joining a room
|
||
LIST_USERS = 1001; // Response listing users
|
||
GET_GAMES_OF_USER = 1002; // Response with user's games
|
||
GET_USER_INFO = 1003; // Response with user info
|
||
DUMP_ZONE = 1004; // Response with zone dump
|
||
LOGIN = 1005; // Response to login attempt
|
||
DECK_LIST = 1006; // Response with deck list
|
||
DECK_DOWNLOAD = 1007; // Response for deck download
|
||
DECK_UPLOAD = 1008; // Response for deck upload
|
||
REGISTER = 1009; // Response to registration
|
||
ACTIVATE = 1010; // Response to activation
|
||
ADJUST_MOD = 1011; // Response to mod adjustments
|
||
BAN_HISTORY = 1012; // Response with ban history
|
||
WARN_HISTORY = 1013; // Response with warn history
|
||
WARN_LIST = 1014; // Response with current warnings
|
||
VIEW_LOG = 1015; // Response with logs
|
||
FORGOT_PASSWORD_REQUEST = 1016; // Response to password reset request
|
||
PASSWORD_SALT = 1017; // Response containing password salt
|
||
GET_ADMIN_NOTES = 1018; // Response with admin notes
|
||
GET_SERVER_STATS = 1019; // Response with server status statistics
|
||
PRIVATE_CHAT_HISTORY = 1020; // Response with the caller's private conversation
|
||
REPLAY_LIST = 1100; // Response listing replays
|
||
REPLAY_DOWNLOAD = 1101; // Response for replay download
|
||
REPLAY_GET_CODE = 1102; // Response containing replay code
|
||
DECK_SHARE_CREATE = 1103; // Response to deck share creation
|
||
DECK_SHARE_LIST = 1104; // Response listing shared decks
|
||
DECK_SHARE_DOWNLOAD = 1105; // Response for shared deck download
|
||
DECK_SHARE_LIST_MINE = 1106; // Response listing the caller's own shares
|
||
CARD_ART_RULE_LIST = 1200; // Response containing a list of card art rules
|
||
}
|
||
|
||
required uint64 cmd_id = 1; // Command ID that this response corresponds to
|
||
optional ResponseCode response_code = 2; // Outcome code of the command
|
||
|
||
extensions 100 to max; // Protobuf extensions reserved for future use
|
||
}
|