1
0
mirror of https://github.com/anope/anope.git synced 2026-07-03 02:43:13 +02:00

Allow skipping user modes in keepmodes.

This commit is contained in:
Sadie Powell
2025-01-13 15:35:13 +00:00
parent 3582bc0f58
commit 9d165f13e7
2 changed files with 15 additions and 5 deletions
+4 -4
View File
@@ -191,13 +191,13 @@ public:
{
if (keep_modes.HasExt(u->Account()))
{
const auto norestore = Config->GetModule(this)->Get<const Anope::string>("norestore");
User::ModeList modes = u->Account()->last_modes;
for (const auto &[last_mode, last_value] : modes)
{
UserMode *um = ModeManager::FindUserModeByName(last_mode);
/* if the null user can set the mode, then it's probably safe */
if (um && um->CanSet(NULL))
u->SetMode(NULL, last_mode, last_value);
auto *um = ModeManager::FindUserModeByName(last_mode);
if (um && um->CanSet(nullptr) && norestore.find(um->mchar) == Anope::string::npos)
u->SetMode(nullptr, last_mode, last_value);
}
}
}