diff options
Diffstat (limited to 'src/modules/m_samode.cpp')
-rw-r--r-- | src/modules/m_samode.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index ea2ae24ab..14f79aaf7 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -20,8 +20,6 @@ */ -/* $ModDesc: Provides command SAMODE to allow opers to change modes on channels and users */ - #include "inspircd.h" /** Handle /SAMODE @@ -48,9 +46,14 @@ class CommandSamode : public Command return CMD_FAILURE; } } - + User* target = ServerInstance->FindNick(parameters[0]); + if ((target) && (target != user)) + { + if (!user->HasPrivPermission("users/samode-usermodes", true)) + return CMD_FAILURE; + } this->active = true; - ServerInstance->Parser->CallHandler("MODE", parameters, user); + ServerInstance->Modes->Process(parameters, user); if (ServerInstance->Modes->GetLastParse().length()) ServerInstance->SNO->WriteGlobalSno('a', user->nick + " used SAMODE: " +ServerInstance->Modes->GetLastParse()); this->active = false; @@ -67,22 +70,12 @@ class ModuleSaMode : public Module { } - void init() - { - ServerInstance->Modules->AddService(cmd); - ServerInstance->Modules->Attach(I_OnPreMode, this); - } - - ~ModuleSaMode() - { - } - - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Provides command SAMODE to allow opers to change modes on channels and users", VF_VENDOR); } - ModResult OnPreMode(User* source,User* dest,Channel* channel, const std::vector<std::string>& parameters) + ModResult OnPreMode(User* source,User* dest,Channel* channel, const std::vector<std::string>& parameters) CXX11_OVERRIDE { if (cmd.active) return MOD_RES_ALLOW; |