mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-19 13:28:25 +00:00
[Optimization] Handle channel name filter checks in memory (#2767)
* Handle channel name filter checks in memory With this commit, name filters are loaded into memory when the server loads and new channels are compared against these memory values VS hitting the database each time. * Minor formatting tweaks
This commit is contained in:
+24
-1
@@ -803,9 +803,19 @@ bool ChatChannelList::IsOnChannelBlockList(const std::string& channel_name) {
|
||||
}
|
||||
|
||||
// Check if channel_name is already in the BlockedChannelNames vector
|
||||
return Strings::Contains(ChatChannelList::GetBlockedChannelNames(), channel_name);
|
||||
return Strings::Contains(GetBlockedChannelNames(), channel_name);
|
||||
}
|
||||
|
||||
bool ChatChannelList::IsOnFilteredNameList(const std::string& name) {
|
||||
if (name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if name is already in the filtered name vector
|
||||
return Strings::Contains(GetFilteredNames(), name);
|
||||
}
|
||||
|
||||
|
||||
void ChatChannelList::AddToChannelBlockList(const std::string& channel_name) {
|
||||
if (channel_name.empty()) {
|
||||
return;
|
||||
@@ -822,6 +832,19 @@ void ChatChannelList::AddToChannelBlockList(const std::string& channel_name) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannelList::AddToFilteredNames(const std::string& name) {
|
||||
if (name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add name to the filtered names vector if it is not already present
|
||||
if (!Strings::Contains(ChatChannelList::GetFilteredNames(), name)) {
|
||||
auto filtered_names = GetFilteredNames(); // Get current filter name list
|
||||
filtered_names.push_back(name); // Add new name to local filtered names list
|
||||
SetFilteredNameList(filtered_names); // Set filtered names list to match local filtered names list
|
||||
}
|
||||
}
|
||||
|
||||
void ServerToClient45SayLink(std::string& clientSayLink, const std::string& serverSayLink) {
|
||||
if (serverSayLink.find('\x12') == std::string::npos) {
|
||||
clientSayLink = serverSayLink;
|
||||
|
||||
Reference in New Issue
Block a user