]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_remove.cpp
Add ConfigTag::getUInt for reading unsigned config values.
[user/henk/code/inspircd.git] / src / modules / m_remove.cpp
index 5b0efe2a27a6e14c095d06a7c92fbb4af6cafc6e..35b7fbf0379e565d069f18daf393ef320f5a1e96 100644 (file)
@@ -74,9 +74,14 @@ class RemoveBase : public Command
                channel = ServerInstance->FindChan(channame);
 
                /* Fix by brain - someone needs to learn to validate their input! */
-               if ((!target) || (target->registered != REG_ALL) || (!channel))
+               if (!channel)
                {
-                       user->WriteNumeric(Numerics::NoSuchNick(channel ? username.c_str() : channame.c_str()));
+                       user->WriteNumeric(Numerics::NoSuchChannel(channame));
+                       return CMD_FAILURE;
+               }
+               if ((!target) || (target->registered != REG_ALL))
+               {
+                       user->WriteNumeric(Numerics::NoSuchNick(username));
                        return CMD_FAILURE;
                }
 
@@ -108,7 +113,7 @@ class RemoveBase : public Command
                                if (!IS_LOCAL(target))
                                {
                                        // Send an ENCAP REMOVE with parameters being in the old <user> <chan> order which is
-                                       // compatible with both 2.0 and 2.2. This also turns FPART into REMOVE.
+                                       // compatible with both 2.0 and 3.0. This also turns FPART into REMOVE.
                                        std::vector<std::string> p;
                                        p.push_back(target->uuid);
                                        p.push_back(channel->name);
@@ -130,7 +135,7 @@ class RemoveBase : public Command
                                /* Build up the part reason string. */
                                reason = "Removed by " + user->nick + ": " + reasonparam;
 
-                               channel->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :%s removed %s from the channel", channel->name.c_str(), user->nick.c_str(), target->nick.c_str());
+                               channel->WriteNotice(InspIRCd::Format("%s removed %s from the channel", user->nick.c_str(), target->nick.c_str()));
                                target->WriteNotice("*** " + user->nick + " removed you from " + channel->name + " with the message: " + reasonparam);
 
                                channel->PartUser(target, reason);
@@ -164,7 +169,7 @@ class CommandRemove : public RemoveBase
                TRANSLATE3(TR_NICK, TR_TEXT, TR_TEXT);
        }
 
-       CmdResult Handle (const std::vector<std::string>& parameters, User *user)
+       CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE
        {
                return HandleRMB(parameters, user, false);
        }
@@ -182,7 +187,7 @@ class CommandFpart : public RemoveBase
                TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT);
        }
 
-       CmdResult Handle (const std::vector<std::string>& parameters, User *user)
+       CmdResult Handle(const std::vector<std::string>& parameters, User* user) CXX11_OVERRIDE
        {
                return HandleRMB(parameters, user, true);
        }
@@ -212,7 +217,7 @@ class ModuleRemove : public Module
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("remove");
                supportnokicks = tag->getBool("supportnokicks");
-               cmd1.protectedrank = cmd2.protectedrank = tag->getInt("protectedrank", 50000);
+               cmd1.protectedrank = cmd2.protectedrank = tag->getUInt("protectedrank", 50000);
        }
 
        Version GetVersion() CXX11_OVERRIDE