diff options
-rw-r--r-- | language/anope.en_US.po | 18 | ||||
-rw-r--r-- | modules/chanserv/cs_drop.cpp | 28 |
2 files changed, 31 insertions, 15 deletions
diff --git a/language/anope.en_US.po b/language/anope.en_US.po index d0a1b3af1..c2ad3d060 100644 --- a/language/anope.en_US.po +++ b/language/anope.en_US.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: Anope\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-01-08 13:20+0000\n" -"PO-Revision-Date: 2024-01-08 13:26+0000\n" +"POT-Creation-Date: 2024-02-19 22:16+0000\n" +"PO-Revision-Date: 2024-02-19 22:17+0000\n" "Last-Translator: Sadie Powell <sadie@witchery.services>\n" "Language-Team: English\n" "Language: en_US\n" @@ -496,9 +496,6 @@ msgstr "channel" msgid "channel bantype" msgstr "channel bantype" -msgid "channel channel" -msgstr "channel channel" - msgid "channel command method [status]" msgstr "channel command method [status]" @@ -601,6 +598,9 @@ msgstr "channel VIEW [mask | entry-num | list]" msgid "channel VIEW [mask | list]" msgstr "channel VIEW [mask | list]" +msgid "channel [code]" +msgstr "channel [code]" + msgid "channel [description]" msgstr "channel [description]" @@ -5399,6 +5399,10 @@ msgstr "Peace option for %s is now on." msgid "Persistent" msgstr "Persistent" +#, c-format +msgid "Please confirm that you want to drop %s with with DROP %s %s." +msgstr "Please confirm that you want to drop %s with with DROP %s %s." + msgid "Please contact an Operator to get a vHost assigned to this nick." msgstr "Please contact an Operator to get a vHost assigned to this nick." @@ -8623,10 +8627,6 @@ msgid "You must confirm your account before you may send a memo." msgstr "You must confirm your account before you may send a memo." #, c-format -msgid "You must enter the channel name twice as a confirmation that you wish to drop %s." -msgstr "You must enter the channel name twice as a confirmation that you wish to drop %s." - -#, c-format msgid "You must have been using this nick for at least %lu seconds to register." msgstr "You must have been using this nick for at least %lu seconds to register." diff --git a/modules/chanserv/cs_drop.cpp b/modules/chanserv/cs_drop.cpp index fa613efa7..2bc0e76a7 100644 --- a/modules/chanserv/cs_drop.cpp +++ b/modules/chanserv/cs_drop.cpp @@ -14,11 +14,16 @@ class CommandCSDrop final : public Command { +private: + PrimitiveExtensibleItem<Anope::string> dropcode; + public: - CommandCSDrop(Module *creator) : Command(creator, "chanserv/drop", 1, 2) + CommandCSDrop(Module *creator) + : Command(creator, "chanserv/drop", 1, 2) + , dropcode(creator, "dropcode") { this->SetDesc(_("Cancel the registration of a channel")); - this->SetSyntax(_("\037channel\037 \037channel\037")); + this->SetSyntax(_("\037channel\037 [\037code\037]")); } void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override @@ -38,22 +43,33 @@ public: return; } - if (params.size() < 2 || !chan.equals_ci(params[1])) + if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) { - source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002%s\002."), chan.c_str()); + source.Reply(ACCESS_DENIED); return; } - if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop")) + auto *code = dropcode.Get(ci); + if (params.size() < 2 || !code || !code->equals_ci(params[1])) { - source.Reply(ACCESS_DENIED); + if (!code) + { + code = ci->Extend<Anope::string>("dropcode"); + *code = Anope::Random(15); + } + + source.Reply(_("Please confirm that you want to drop \002%s\002 with with \002DROP %s %s\002."), + chan.c_str(), chan.c_str(), code->c_str()); return; } EventReturn MOD_RESULT; FOREACH_RESULT(OnChanDrop, MOD_RESULT, (source, ci)); if (MOD_RESULT == EVENT_STOP) + { + dropcode.Unset(ci); return; + } bool override = (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")); Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->display : "none") << ")"; |