41 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. Custom channel saving is disabled.");
56 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. DB table `channels` is empty.");
60 std::vector<std::pair<std::string, uint32>> toDelete;
64 Field* fields = result->Fetch();
65 std::string dbName = fields[0].
GetString();
67 bool dbAnnounce = fields[2].
GetBool();
68 bool dbOwnership = fields[3].
GetBool();
69 std::string dbPass = fields[4].
GetString();
70 std::string dbBanned = fields[5].
GetString();
72 std::wstring channelName;
75 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid utf8 sequence? Deleted.", dbName);
76 toDelete.emplace_back(std::move(dbName), team);
83 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", dbName, team);
84 toDelete.emplace_back(std::move(dbName), team);
88 auto [itr, isNew] = mgr->
_customChannels.try_emplace(std::move(channelName));
92 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' (team {}) from database - a channel with the same name is already loaded. Skipped.", dbName, team);
96 Channel* channel = itr->second =
new Channel(dbName, team, dbBanned);
102 }
while (result->NextRow());
104 for (
auto const& [dbName, team] : toDelete)
121 return &allianceChannelMgr;
124 return &allianceChannelMgr;
127 return &hordeChannelMgr;
134 std::wstring channelNamePart;
143 std::wstring channelNameW;
148 if (!channelNameW.compare(0, channelNamePart.size(), channelNamePart))
158 pair.second->UpdateChannelInDB();
164 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
168 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
181 std::wstring channelName;
200 std::wstring channelName;
220 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
224 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
234 std::wstring channelName;
248 std::string channelName = name;
260 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
264 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
270 Channel* channel = itr->second;
@ CHANNEL_DBC_FLAG_CITY_ONLY
@ CHANNEL_DBC_FLAG_GLOBAL
DBCStorage< ChatChannelsEntry > sChatChannelsStore(ChatChannelsEntryfmt)
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
void wstrToLower(std::wstring &str)
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
Channel * CreateCustomChannel(std::string const &name)
Channel * GetCustomChannel(std::string const &name) const
void LeftChannel(uint32 channelId, AreaTableEntry const *zoneEntry)
CustomChannelContainer _customChannels
Channel * GetChannel(uint32 channelId, std::string const &name, Player *player, bool pkt=true, AreaTableEntry const *zoneEntry=nullptr) const
static ChannelMgr * ForTeam(uint32 team)
Channel * GetSystemChannel(uint32 channelId, AreaTableEntry const *zoneEntry=nullptr)
static Channel * GetChannelForPlayerByNamePart(std::string const &namePart, Player *playerSearcher)
BuiltinChannelContainer _channels
static void SendNotOnChannelNotify(Player const *player, std::string const &name)
void SetPassword(std::string const &password)
static void GetChannelName(std::string &channelName, uint32 channelId, LocaleConstant locale, AreaTableEntry const *zoneEntry)
void SetAnnounce(bool announce)
void SetOwnership(bool ownership)
uint32 GetNumPlayers() const
Class used to access individual fields of database query result.
std::string GetString() const
void SendDirectMessage(WorldPacket const *data) const
WorldSession * GetSession() const
JoinedChannelsList const & GetJoinedChannels() const
void setUInt32(uint8 index, uint32 value)
void setString(uint8 index, std::string const &value)
std::string _Channel
Channel Name.
WorldPacket const * Write() override
LocaleConstant GetSessionDbcLocale() const
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL
@ CONFIG_PRESERVE_CUSTOM_CHANNELS