]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_samode.cpp
Fix various warnings when building with LLVM 3.5.
[user/henk/code/inspircd.git] / src / modules / m_samode.cpp
index c0cf1b93d2e6f02d79738238392f2a9f04d45106..ea2ae24ab3d525cc5fc56a156e703a8056f9f0c3 100644 (file)
@@ -32,12 +32,23 @@ class CommandSamode : public Command
        bool active;
        CommandSamode(Module* Creator) : Command(Creator,"SAMODE", 2)
        {
+               allow_empty_last_param = false;
                flags_needed = 'o'; Penalty = 0; syntax = "<target> <modes> {<mode-parameters>}";
                active = false;
        }
 
        CmdResult Handle (const std::vector<std::string>& parameters, User *user)
        {
+               if (parameters[0].c_str()[0] != '#')
+               {
+                       User* target = ServerInstance->FindNickOnly(parameters[0]);
+                       if ((!target) || (target->registered != REG_ALL))
+                       {
+                               user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str());
+                               return CMD_FAILURE;
+                       }
+               }
+
                this->active = true;
                ServerInstance->Parser->CallHandler("MODE", parameters, user);
                if (ServerInstance->Modes->GetLastParse().length())