diff options
-rw-r--r-- | modules/webcpanel/pages/nickserv/info.cpp | 12 | ||||
-rw-r--r-- | modules/webcpanel/templates/nickserv/info.html | 2 |
2 files changed, 8 insertions, 6 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"]; diff --git a/modules/webcpanel/templates/nickserv/info.html b/modules/webcpanel/templates/nickserv/info.html index 794598196..fa279ac99 100644 --- a/modules/webcpanel/templates/nickserv/info.html +++ b/modules/webcpanel/templates/nickserv/info.html @@ -65,7 +65,7 @@ <td><input type="checkbox" name="protect" value="on" {IF EXISTS PROTECT}checked{END IF}></td> </tr> <tr> - <td>Protect after:</td> + <td>Protection delay:</td> <td><input name="protect_after" value="{PROTECT_AFTER}" class="form-control input-sm"></td> </tr> </tbody> |