47 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. Custom channel saving is disabled.");
62 TC_LOG_INFO(
"server.loading",
">> Loaded 0 custom chat channels. DB table `channels` is empty.");
66 std::vector<std::pair<std::string, uint32>> toDelete;
70 Field* fields = result->Fetch();
71 std::string dbName = fields[0].
GetString();
73 bool dbAnnounce = fields[2].
GetBool();
74 bool dbOwnership = fields[3].
GetBool();
75 std::string dbPass = fields[4].
GetString();
76 std::string dbBanned = fields[5].
GetString();
78 std::wstring channelName;
81 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid utf8 sequence? Deleted.", dbName);
82 toDelete.push_back({ dbName, team });
89 TC_LOG_ERROR(
"server.loading",
"Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", dbName, team);
90 toDelete.push_back({ dbName, team });
101 }
while (result->NextRow());
103 for (std::pair<std::string, uint32>
const& pair : toDelete)
120 return &allianceChannelMgr;
123 return &allianceChannelMgr;
126 return &hordeChannelMgr;
133 std::wstring channelNamePart;
142 std::wstring channelNameW;
147 if (!channelNameW.compare(0, channelNamePart.size(), channelNamePart))
157 pair.second->UpdateChannelInDB();
163 if (channel->GetGUID() == channelGuid)
183 std::wstring channelName;
202 std::wstring channelName;
221 result = itr->second;
225 std::wstring channelName;
233 result = itr->second;
236 if (!result && notify)
238 std::string channelName = name;
253 Channel* channel = itr->second;
279 zoneId = zoneEntry->
ID;
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__,...)
#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)
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(uint32 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.
std::string GetString() const
ObjectGuid::LowType Generate()
void SendDirectMessage(WorldPacket const *data) const
WorldSession * GetSession() const
JoinedChannelsList const & GetJoinedChannels() const
void setUInt32(const uint8 index, const uint32 value)
void setString(const uint8 index, const std::string &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