summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-10-11 15:45:02 +0100
committerSadie Powell <sadie@witchery.services>2024-10-11 15:45:02 +0100
commit6d34054b7889d9271e06f67889209f3f9f566f58 (patch)
treefc37d1225965023bfca21b41a7906330653f2e45 /modules
parentcc37e6d69a6e473814793c0badf14e4f19a23c4f (diff)
Change the mode lock before removing/adding the PERM mode.
This fixes being unable to unset mlock on the first attempt.
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/cs_set.cpp10
1 files changed, 6 insertions, 4 deletions
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>("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>("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