Repository navigation
fix: record say and yell chat again, filter out the private one - #30
Conversation
PR #22 dropped SMSG_MESSAGECHAT from the watch list entirely, so replays lost say and yell along with the whispers they were meant to hide. Keep the opcode and filter on the chat type instead, which is the first byte of the payload: say, yell and emotes are recorded, whisper, party, guild, officer and channel are not. The filter also runs when a replay is loaded, so matches stored before this still play back without the private chat.
📝 WalkthroughWalkthroughArena replay packet capture now records ChangesArena replay chat filtering
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ArenaReplay.cpp`:
- Around line 172-174: Update the chat capture flow around
IsReplayableChatPacket so public chat events are recorded only once, using a
canonical recipient or deduplicating the event before appending to
record.packets; preserve the existing per-team capture behavior for
team-specific packets.
- Around line 105-117: Update the packet validation around the chat-type switch
in ArenaReplay to parse the length-prefixed message and reject packets whose
emote text is empty before returning true. Preserve the existing allowlist for
non-empty supported chat types and continue returning false for unsupported or
malformed messages.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| switch (packet.contents()[0]) | ||
| { | ||
| case CHAT_MSG_SAY: | ||
| case CHAT_MSG_YELL: | ||
| case CHAT_MSG_EMOTE: | ||
| case CHAT_MSG_TEXT_EMOTE: | ||
| case CHAT_MSG_MONSTER_SAY: | ||
| case CHAT_MSG_MONSTER_YELL: | ||
| case CHAT_MSG_MONSTER_EMOTE: | ||
| return true; | ||
| default: | ||
| return false; | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject empty emote messages.
The allowlist checks only the chat type. Player::TextEmote can send an empty CHAT_MSG_EMOTE packet to the other team. That packet passes this switch and is stored for replay. Parse the length-prefixed message and reject empty text before accepting the packet. (raw.githubusercontent.com)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/ArenaReplay.cpp` around lines 105 - 117, Update the packet validation
around the chat-type switch in ArenaReplay to parse the length-prefixed message
and reject packets whose emote text is empty before returning true. Preserve the
existing allowlist for non-empty supported chat types and continue returning
false for unsupported or malformed messages.
| if (!IsReplayableChatPacket(packet)) | ||
| return true; | ||
|
|
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Deduplicate public chat before applying the per-team capture rule.
The capture loop records each watched packet for one reference player per team. Player::Say and Player::Yell broadcast the same SMSG_MESSAGECHAT to TeamFilter::All, so each public message can be stored twice. Capture chat from one canonical recipient or deduplicate the chat event before appending it to record.packets. (raw.githubusercontent.com)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/ArenaReplay.cpp` around lines 172 - 174, Update the chat capture flow
around IsReplayableChatPacket so public chat events are recorded only once,
using a canonical recipient or deduplicating the event before appending to
record.packets; preserve the existing per-team capture behavior for
team-specific packets.
#22 fixed whispers and guild chat leaking into replays (#18), but it did it by dropping
SMSG_MESSAGECHATfrom the watch list, so says and yells are gone from replays too. Those are worth keeping, everyone in the arena hears them anyway.So instead of filtering by opcode, this filters by chat type. It's the first byte of the packet, see
ChatHandler::BuildChatPacket, so no real parsing needed.Recorded: say, yell, emote, text emote and the monster variants.
Not recorded: whisper, party, raid, guild, officer, channel, and everything else. That also covers the arena spectator addon, which sends its data as
CHAT_MSG_WHISPER+LANG_ADDON.The check also runs when a replay is loaded from the DB, so old matches recorded back when every chat type went in now play back without the private stuff.
Closes #18
Tested
Needs an in game pass: say/yell during a match should show up in the replay, whisper/party/guild should not, and a replay saved before this change should no longer leak them either.
Summary by CodeRabbit
New Features
Bug Fixes