51 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. Custom channel saving is disabled.");
66 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. DB table `channels` is empty.");
70 std::vector<std::pair<std::string, uint32>> toDelete;
74 Field* fields = result->Fetch();
75 std::string dbName = fields[0].
GetString();
76 Team team =
Team(fields[1].GetUInt32());
77 bool dbAnnounce = fields[2].
GetBool();
78 bool dbOwnership = fields[3].
GetBool();
79 std::string dbPass = fields[4].
GetString();
80 std::string dbBanned = fields[5].
GetString();
82 std::wstring channelName;
85 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid utf8 sequence? Deleted.", dbName);
86 toDelete.push_back({ dbName, team });
93 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", dbName, team);
94 toDelete.push_back({ dbName, team });
105 }
while (result->NextRow());
107 for (std::pair<std::string, uint32>
const& pair : toDelete)
125 return &neutralChannelMgr;
130 return &hordeChannelMgr;
132 return &allianceChannelMgr;
134 return &neutralChannelMgr;
144 std::wstring channelNamePart;
153 std::wstring channelNameW;
158 if (!channelNameW.compare(0, channelNamePart.size(), channelNamePart))
168 pair.second->UpdateChannelInDB();
174 if (channel->GetGUID() == channelGuid)
194 std::wstring channelName;
213 std::wstring channelName;
232 result = itr->second;
236 std::wstring channelName;
244 result = itr->second;
247 if (!result && notify)
249 std::string channelName = name;
264 Channel* channel = itr->second;
290 zoneId = zoneEntry->
ID;
293 if (std::shared_ptr<Realm const> currentRealm =
sRealmList->GetCurrentRealm())
DB2Storage< Cfg_CategoriesEntry > sCfgCategoriesStore("Cfg_Categories.db2", &CfgCategoriesLoadInfo::Instance)
DB2Storage< ChatChannelsEntry > sChatChannelsStore("ChatChannels.db2", &ChatChannelsLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
std::shared_ptr< ResultSet > QueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
#define TC_LOG_ERROR(filterType__, message__,...)
#define TC_LOG_INFO(filterType__, message__,...)
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)
ObjectGuid CreateBuiltinChannelGuid(uint32 channelId, AreaTableEntry const *zoneEntry=nullptr) const
Channel * GetCustomChannel(std::string const &name) const
void LeftChannel(uint32 channelId, AreaTableEntry const *zoneEntry)
CustomChannelContainer _customChannels
static AreaTableEntry const * SpecialLinkedArea
static ChannelMgr * ForTeam(Team team)
Channel * GetSystemChannel(uint32 channelId, AreaTableEntry const *zoneEntry=nullptr)
ObjectGuidGenerator _guidGenerator
Channel * GetChannel(uint32 channelId, std::string const &name, Player *player, bool notify=true, AreaTableEntry const *zoneEntry=nullptr) const
ObjectGuid CreateCustomChannelGuid()
static Channel * GetChannelForPlayerByNamePart(std::string const &namePart, Player *playerSearcher)
static Channel * GetChannelForPlayerByGuid(ObjectGuid channelGuid, 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.
bool GetBool() const noexcept
std::string GetString() const noexcept
ObjectGuid::LowType Generate()
void SendDirectMessage(WorldPacket const *data) const
WorldSession * GetSession() const
JoinedChannelsList const & GetJoinedChannels() const
void setString(uint8 index, std::string &&value)
void setUInt32(uint8 index, uint32 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
EnumFlag< AreaFlags > GetFlags() const
EnumFlag< ChatChannelFlags > GetFlags() const