fix(chat): resolve /r reply target when name arrives after whisper

Whisper sender name may not be in the player name cache when the packet
arrives. Store the sender GUID and lazily resolve the name from the
cache in getLastWhisperSender(). Also backfill lastWhisperSender_ when
the SMSG_NAME_QUERY_RESPONSE arrives.
This commit is contained in:
Kelsi 2026-04-04 00:03:05 -07:00
parent c85d023329
commit 5538655383
4 changed files with 31 additions and 9 deletions

View file

@ -606,7 +606,16 @@ public:
bool isAfk() const { return afkStatus_; }
bool isDnd() const { return dndStatus_; }
void replyToLastWhisper(const std::string& message);
std::string getLastWhisperSender() const { return lastWhisperSender_; }
std::string getLastWhisperSender() const {
if (!lastWhisperSender_.empty()) return lastWhisperSender_;
// Name may not have been cached when whisper arrived — resolve from GUID
if (lastWhisperSenderGuid_ != 0) {
const auto& cache = getPlayerNameCache();
auto it = cache.find(lastWhisperSenderGuid_);
if (it != cache.end()) return it->second;
}
return "";
}
void setLastWhisperSender(const std::string& name) { lastWhisperSender_ = name; }
// Party/Raid management
@ -2436,6 +2445,7 @@ private:
std::string afkMessage_;
std::string dndMessage_;
std::string lastWhisperSender_;
uint64_t lastWhisperSenderGuid_ = 0;
// ---- Online item tracking ----
struct OnlineItemInfo {