Add chat channels, chat settings, and fix missing chat text

Fix WotLK chat parser not stripping null terminators from messages,
fix channel message local echo missing channelName, expand default
channels to General/Trade/LocalDefense/LookingForGroup with
configurable auto-join, add Classic packet format for join/leave
channel, display channel index prefix in chat, and add Chat settings
tab with timestamps, font size, and auto-join toggles.
This commit is contained in:
Kelsi 2026-02-14 18:27:59 -08:00
parent 54ad8f38b2
commit 6b392a5dd8
8 changed files with 197 additions and 7 deletions

View file

@ -234,6 +234,16 @@ public:
void leaveChannel(const std::string& channelName);
const std::vector<std::string>& getJoinedChannels() const { return joinedChannels_; }
std::string getChannelByIndex(int index) const;
int getChannelIndex(const std::string& channelName) const;
// Chat auto-join settings (set by UI before autoJoinDefaultChannels)
struct ChatAutoJoin {
bool general = true;
bool trade = true;
bool localDefense = true;
bool lfg = true;
};
ChatAutoJoin chatAutoJoin;
// Chat bubble callback: (senderGuid, message, isYell)
using ChatBubbleCallback = std::function<void(uint64_t, const std::string&, bool)>;

View file

@ -136,6 +136,18 @@ public:
return GuildQueryResponseParser::parse(packet, data);
}
// --- Channels ---
/** Build CMSG_JOIN_CHANNEL */
virtual network::Packet buildJoinChannel(const std::string& channelName, const std::string& password) {
return JoinChannelPacket::build(channelName, password);
}
/** Build CMSG_LEAVE_CHANNEL */
virtual network::Packet buildLeaveChannel(const std::string& channelName) {
return LeaveChannelPacket::build(channelName);
}
// --- Utility ---
/** Read a packed GUID from the packet */
@ -216,6 +228,8 @@ public:
bool parseMessageChat(network::Packet& packet, MessageChatData& data) override;
bool parseGuildRoster(network::Packet& packet, GuildRosterData& data) override;
bool parseGuildQueryResponse(network::Packet& packet, GuildQueryResponseData& data) override;
network::Packet buildJoinChannel(const std::string& channelName, const std::string& password) override;
network::Packet buildLeaveChannel(const std::string& channelName) override;
};
/**

View file

@ -11,6 +11,7 @@
#include <string>
#include <map>
#include <unordered_map>
#include <chrono>
namespace wowee {
namespace game {
@ -653,6 +654,7 @@ struct MessageChatData {
std::string message;
std::string channelName; // For channel messages
uint8_t chatTag = 0; // Player flags (AFK, DND, GM, etc.)
std::chrono::system_clock::time_point timestamp = std::chrono::system_clock::now();
bool isValid() const { return !message.empty(); }
};