40 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. Custom channel saving is disabled.");
55 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. DB table `channels` is empty.");
59 std::vector<std::pair<std::string, uint32>> toDelete;
63 Field* fields = result->Fetch();
64 std::string dbName = fields[0].
GetString();
66 bool dbAnnounce = fields[2].
GetBool();
67 bool dbOwnership = fields[3].
GetBool();
68 std::string dbPass = fields[4].
GetString();
69 std::string dbBanned = fields[5].
GetString();
71 std::wstring channelName;
74 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid utf8 sequence? Deleted.", dbName);
75 toDelete.push_back({ dbName, team });
82 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", dbName, team);
83 toDelete.push_back({ dbName, team });
94 }
while (result->NextRow());
96 for (
auto pair : toDelete)
113 return &allianceChannelMgr;
116 return &allianceChannelMgr;
119 return &hordeChannelMgr;
126 std::wstring channelNamePart;
135 std::wstring channelNameW;
140 if (!channelNameW.compare(0, channelNamePart.size(), channelNamePart))
150 pair.second->UpdateChannelInDB();
156 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
160 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
173 std::wstring channelName;
192 std::wstring channelName;
212 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
216 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
226 std::wstring channelName;
240 std::string channelName = name;
254 uint32 zoneId = zoneEntry ? zoneEntry->
ID : 0;
258 std::pair<uint32, uint32> key = std::make_pair(channelId, zoneId);
264 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)
static void MakeNotOnPacket(WorldPacket *data, std::string const &name)
BuiltinChannelContainer _channels
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)
void Initialize(uint16 opcode, size_t newres=200)
LocaleConstant GetSessionDbcLocale() const
@ CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL
@ CONFIG_PRESERVE_CUSTOM_CHANNELS