diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:33 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-02 00:51:33 +0000 |
commit | 54e89b822e36b36eb9b080bbb4befe097471cec2 (patch) | |
tree | 8150e55f05808b4fc1b6eb77caf8b11f9786f491 /src/modules | |
parent | 0145d909d207e0117c0d10ee2195b53b4b823fb4 (diff) |
Change SAMODE to source from the acting user, not the server
This is a merge of the OOMODE command into SAMODE.
This fixes SAMODE not working because of mode merging.
An additional access check for umode changes is added for this command.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11647 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_samode.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index ccd40a3e7..584199345 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -20,34 +20,21 @@ class CommandSamode : public Command { public: + bool active; CommandSamode (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAMODE", "o", 2, false, 0) { syntax = "<target> <modes> {<mode-parameters>}"; + active = false; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) { - /* - * Handles an SAMODE request. Notifies all +s users. - */ - ServerInstance->SendMode(parameters, ServerInstance->FakeClient); - + this->active = true; + ServerInstance->Parser->CallHandler("MODE", parameters, user); if (ServerInstance->Modes->GetLastParse().length()) - { - ServerInstance->SNO->WriteToSnoMask('a', std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse()); - ServerInstance->PI->SendSNONotice("A", user->nick + " used SAMODE: " + ServerInstance->Modes->GetLastParse()); - - std::string channel = parameters[0]; - ServerInstance->PI->SendMode(channel, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate()); - - return CMD_LOCALONLY; - } - else - { - user->WriteServ("NOTICE %s :*** Invalid SAMODE sequence.", user->nick.c_str()); - } - - return CMD_FAILURE; + ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick) + " used SAMODE: " +ServerInstance->Modes->GetLastParse()); + this->active = false; + return CMD_LOCALONLY; } }; @@ -59,6 +46,7 @@ class ModuleSaMode : public Module : Module(Me), cmd(Me, this) { ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->Attach(I_OnAccessCheck, this); } virtual ~ModuleSaMode() @@ -69,6 +57,19 @@ class ModuleSaMode : public Module { return Version("$Id$", VF_VENDOR, API_VERSION); } + + virtual ModResult OnAccessCheck(User* source,User* dest,Channel* channel,int access_type) + { + if (cmd.active) + return MOD_RES_ALLOW; + return MOD_RES_PASSTHRU; + } + + void Prioritize() + { + Module *override = ServerInstance->Modules->Find("m_override.so"); + ServerInstance->Modules->SetPriority(this, I_OnAccessCheck, PRIORITY_BEFORE, &override); + } }; MODULE_INIT(ModuleSaMode) |