From 6d34054b7889d9271e06f67889209f3f9f566f58 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 11 Oct 2024 15:45:02 +0100 Subject: Change the mode lock before removing/adding the PERM mode. This fixes being unable to unset mlock on the first attempt. --- modules/commands/cs_set.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'modules/commands/cs_set.cpp') diff --git a/modules/commands/cs_set.cpp b/modules/commands/cs_set.cpp index 3c015d6fd..1d510adcc 100644 --- a/modules/commands/cs_set.cpp +++ b/modules/commands/cs_set.cpp @@ -510,12 +510,13 @@ class CommandCSSetPersist : public Command /* Set the perm mode */ if (cm) { - if (ci->c && !ci->c->HasMode("PERM")) - ci->c->SetMode(NULL, cm); /* Add it to the channels mlock */ ModeLocks *ml = ci->Require("modelocks"); if (ml) ml->SetMLock(cm, true, "", source.GetNick()); + + if (ci->c && !ci->c->HasMode("PERM")) + ci->c->SetMode(NULL, cm); } /* No botserv bot, no channel mode, give them ChanServ. * Yes, this works fine with no BotServ. @@ -553,12 +554,13 @@ class CommandCSSetPersist : public Command /* Unset perm mode */ if (cm) { - if (ci->c && ci->c->HasMode("PERM")) - ci->c->RemoveMode(NULL, cm); /* Remove from mlock */ ModeLocks *ml = ci->GetExt("modelocks"); if (ml) ml->RemoveMLock(cm, true); + + if (ci->c && ci->c->HasMode("PERM")) + ci->c->RemoveMode(NULL, cm); } /* No channel mode, no BotServ, but using ChanServ as the botserv bot * which was assigned when persist was set on -- cgit