From ffc62aee625a650c08ffd68dc0d5763eec34edbc Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 26 Feb 2026 23:11:41 +0000 Subject: Fix some incorrect uses of SharedData in sacommands. --- modules/sacommands.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'modules') diff --git a/modules/sacommands.cpp b/modules/sacommands.cpp index d0e995798..078f4f790 100644 --- a/modules/sacommands.cpp +++ b/modules/sacommands.cpp @@ -197,7 +197,7 @@ private: public: bool active = false; - CommandSAMode(Module* mod, SharedData &sd) + CommandSAMode(Module* mod, SharedData& sd) : Command(mod, "SAMODE", 2) , data(sd) { @@ -216,6 +216,11 @@ public: user->WriteNumeric(Numerics::NoSuchNick(targetstr)); return CmdResult::FAILURE; } + if (target->IsModeSet(data.servprotectmode)) + { + user->WriteRemoteNumeric(Numerics::NoPrivileges("you can not use the {} command on a protected service", this->name)); + return CmdResult::FAILURE; + } // Changing the modes of another user requires a special permission. if (target != user && !user->HasPrivPermission("users/samode-usermodes")) @@ -260,7 +265,7 @@ class CommandSANick final : public Command { private: - SharedData data; + SharedData& data; public: CommandSANick(Module* mod, SharedData& sd) @@ -449,13 +454,9 @@ public: class CommandSATopic final : public Command { -private: - SharedData& data; - public: - CommandSATopic(Module* mod, SharedData& sd) + CommandSATopic(Module* mod) : Command(mod, "SATOPIC", 2, 2) - , data(sd) { access_needed = CmdAccess::OPERATOR; allow_empty_last_param = true; @@ -511,7 +512,7 @@ public: , cmdsanick(this, data) , cmdsapart(this, data) , cmdsaquit(this, data) - , cmdsatopic(this, data) + , cmdsatopic(this) { } -- cgit v1.3.1-10-gc9f91