1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 01:36:37 +02:00

Require users to use a confirmation code when dropping channels.

This commit is contained in:
Sadie Powell
2024-02-19 22:20:36 +00:00
parent 909b9b2679
commit 22fe5bb724
2 changed files with 33 additions and 17 deletions
+9 -9
View File
@@ -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."
@@ -8622,10 +8626,6 @@ msgstr "You must confirm your account before you may request a vhost."
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."
+24 -8
View File
@@ -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> &params) override
@@ -38,22 +43,33 @@ public:
return;
}
if (params.size() < 2 || !chan.equals_ci(params[1]))
{
source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002%s\002."), chan.c_str());
return;
}
if ((ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
{
source.Reply(ACCESS_DENIED);
return;
}
auto *code = dropcode.Get(ci);
if (params.size() < 2 || !code || !code->equals_ci(params[1]))
{
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") << ")";