[Command]: Update (#826)

This commit is contained in:
Edo 2023-03-10 23:22:00 +00:00 committed by GitHub
parent e02e833ee5
commit b44aa534dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 10 deletions

View File

@ -174,6 +174,41 @@ namespace Components
}
}
bool Command::IsSendingNotifiesDisabled()
{
static std::optional<bool> flag;
if (!flag.has_value())
{
flag.emplace(Flags::HasFlag("disable-notifies"));
}
return flag.value();
}
const std::vector<std::string>& Command::GetExceptions()
{
static const auto exceptions = []() -> std::vector<std::string>
{
std::vector<std::string> values =
{
"cmd",
"exec",
"map",
};
if (IsSendingNotifiesDisabled())
{
values.emplace_back("vstr");
values.emplace_back("wait");
}
return values;
}();
return exceptions;
}
bool Command::CL_ShouldSendNotify_Hk(const char* cmd)
{
if (!cmd)
@ -181,18 +216,10 @@ namespace Components
return false;
}
static std::array exceptions =
{
"cmd",
"exec",
"map",
"vstr",
"wait",
};
const auto& exceptions = GetExceptions();
for (const auto& entry : exceptions)
{
if (!_stricmp(cmd, entry))
if (!_stricmp(cmd, entry.data()))
{
return false;
}

View File

@ -73,6 +73,8 @@ namespace Components
static void MainCallback();
static void MainCallbackSV();
static bool IsSendingNotifiesDisabled();
static const std::vector<std::string>& GetExceptions();
static bool CL_ShouldSendNotify_Hk(const char* cmd);
};
}