diff options
Diffstat (limited to 'modules/database')
| -rw-r--r-- | modules/database/db_atheme.cpp | 29 | ||||
| -rw-r--r-- | modules/database/db_old.cpp | 15 |
2 files changed, 24 insertions, 20 deletions
diff --git a/modules/database/db_atheme.cpp b/modules/database/db_atheme.cpp index 6cac99449..860e81853 100644 --- a/modules/database/db_atheme.cpp +++ b/modules/database/db_atheme.cpp @@ -132,7 +132,6 @@ struct ChannelData final struct UserData final { - bool kill = false; Anope::string info_adder; Anope::string info_message; time_t info_ts = 0; @@ -140,6 +139,8 @@ struct UserData final Anope::string last_quit; Anope::string last_real_mask; bool noexpire = false; + bool protect = false; + std::optional<time_t> protectafter; Anope::string suspend_by; Anope::string suspend_reason; time_t suspend_ts = 0; @@ -1143,22 +1144,9 @@ private: if (key == "private:autojoin") return true; // TODO else if (key == "private:doenforce") - data->kill = true; + data->protect = true; else if (key == "private:enforcetime") - { - if (!data->kill) - return true; // Don't apply this. - - auto kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s"); - auto killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s"); - auto secs = Anope::Convert<time_t>(value, kill); - if (secs >= kill) - nc->Extend<bool>("KILLPROTECT"); - else if (secs >= killquick) - nc->Shrink<bool>("KILL_QUICK"); - else - nc->Shrink<bool>("KILL_IMMED"); - } + data->protectafter = Anope::TryConvert<time_t>(value); else if (key == "private:freeze:freezer") data->suspend_by = value; else if (key == "private:freeze:reason") @@ -1371,7 +1359,7 @@ private: ApplyPassword(nc, flags, pass); // No equivalent: bglmNQrS - ApplyFlags(nc, flags, 'E', "KILLPROTECT"); + ApplyFlags(nc, flags, 'E', "PROTECT"); ApplyFlags(nc, flags, 'e', "MEMO_MAIL"); ApplyFlags(nc, flags, 'n', "NEVEROP"); ApplyFlags(nc, flags, 'o', "AUTOOP", false); @@ -1649,6 +1637,13 @@ public: } } + if (data->protect) + { + nc->Extend<bool>("PROTECT"); + if (data->protectafter) + nc->Extend("PROTECT_AFTER", data->protectafter.value()); + } + if (!data->suspend_reason.empty()) { SuspendInfo si; diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index 7f601068f..9812d291b 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -480,7 +480,10 @@ static void LoadNicks() READ(read_uint32(&u32, f)); if (u32 & OLD_NI_KILLPROTECT) - nc->Extend<bool>("KILLPROTECT"); + { + nc->Extend<bool>("PROTECT"); + nc->Extend("PROTECT_AFTER", 60); + } if (u32 & OLD_NI_MSG) nc->Extend<bool>("MSG"); if (u32 & OLD_NI_MEMO_HARDMAX) @@ -498,9 +501,15 @@ static void LoadNicks() if (u32 & OLD_NI_HIDE_QUIT) nc->Extend<bool>("HIDE_QUIT"); if (u32 & OLD_NI_KILL_QUICK) - nc->Extend<bool>("KILL_QUICK"); + { + nc->Extend<bool>("PROTECT"); + nc->Extend("PROTECT_AFTER", 20); + } if (u32 & OLD_NI_KILL_IMMED) - nc->Extend<bool>("KILL_IMMED"); + { + nc->Extend<bool>("PROTECT"); + nc->Extend<time_t>("PROTECT_AFTER", 0); + } if (u32 & OLD_NI_MEMO_MAIL) nc->Extend<bool>("MEMO_MAIL"); if (u32 & OLD_NI_HIDE_STATUS) |
