diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-08 14:44:32 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-08 14:45:26 +0000 |
| commit | c98602bf19c3b3fa4966dd4fe4f990e5977e163a (patch) | |
| tree | 88b2e58515aa6e87dce1c2da1dbbe290f2e37b46 /modules/webcpanel/pages/nickserv | |
| parent | 50bec959e50837493f679518edc6d535f08bd7a6 (diff) | |
Fix various webcpanel bugs relating to nickname protection.
Diffstat (limited to 'modules/webcpanel/pages/nickserv')
| -rw-r--r-- | modules/webcpanel/pages/nickserv/info.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp index be8b110f5..9846f6b9c 100644 --- a/modules/webcpanel/pages/nickserv/info.cpp +++ b/modules/webcpanel/pages/nickserv/info.cpp @@ -58,7 +58,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str } if (na->nc->HasExt("PROTECT") != !!message.post_data.count("protect")) { - if (!na->nc->HasExt("PROTECT")) + if (na->nc->HasExt("PROTECT")) { na->nc->Shrink<bool>("PROTECT"); na->nc->Shrink<time_t>("PROTECT_AFTER"); @@ -75,20 +75,22 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str auto minprotect = block.Get<time_t>("minprotect", "10s"); auto maxprotect = block.Get<time_t>("maxprotect", "10m"); - auto secs = Anope::TryConvert<time_t>(message.post_data["greet"]); + auto secs = Anope::TryConvert<time_t>(message.post_data["protect_after"]); if (!secs) - replacements["ERRORS"] = "Protection after seconds are not valid"; + replacements["ERRORS"] = "Protection delay must be a number of seconds"; else if (*secs < minprotect || *secs > maxprotect) { replacements["ERRORS"] = Anope::printf("Protection delay must be between %ld and %ld seconds.", minprotect, maxprotect); } - else + else if (!na->nc->HasExt("PROTECT_AFTER") || *secs != *na->nc->GetExt<time_t>("PROTECT_AFTER")) { na->nc->Extend<time_t>("PROTECT_AFTER", *secs); replacements["MESSAGES"] = "Protect after updated"; } } + else if (na->nc->HasExt("PROTECT") && !message.post_data.count("protect_after")) + na->nc->Shrink<time_t>("PROTECT_AFTER"); if (na->nc->HasExt("NS_KEEP_MODES") != !!message.post_data.count("keepmodes")) { if (!na->nc->HasExt("NS_KEEP_MODES")) @@ -133,7 +135,7 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str replacements["PROTECT"]; auto *protectafter = na->nc->GetExt<time_t>("PROTECT_AFTER"); if (protectafter) - replacements["PROTECT_AFTER"] = *protectafter; + replacements["PROTECT_AFTER"] = Anope::ToString(*protectafter); } if (na->nc->HasExt("NS_KEEP_MODES")) replacements["KEEPMODES"]; |
