diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index 4f39574af..a68aefa3c 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -513,12 +513,13 @@ public: /* 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. @@ -556,12 +557,13 @@ public: /* 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