]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sakick.cpp
Make various self contained methods static.
[user/henk/code/inspircd.git] / src / modules / m_sakick.cpp
index 2cb1f2a0449f1f521e7e8c69c34b4eb19a5b5f66..a947012836647521dddc97e9e91ca013ddb4cbac 100644 (file)
@@ -20,8 +20,6 @@
 
 #include "inspircd.h"
 
-/* $ModDesc: Provides a SAKICK command */
-
 /** Handle /SAKICK
  */
 class CommandSakick : public Command
@@ -30,7 +28,7 @@ class CommandSakick : public Command
        CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3)
        {
                flags_needed = 'o'; Penalty = 0; syntax = "<channel> <nick> [reason]";
-               TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END);
+               TRANSLATE3(TR_TEXT, TR_NICK, TR_TEXT);
        }
 
        CmdResult Handle (const std::vector<std::string>& parameters, User *user)
@@ -39,7 +37,7 @@ class CommandSakick : public Command
                Channel* channel = ServerInstance->FindChan(parameters[0]);
                const char* reason = "";
 
-               if (dest && channel)
+               if ((dest) && (dest->registered == REG_ALL) && (channel))
                {
                        if (parameters.size() > 2)
                        {
@@ -52,7 +50,7 @@ class CommandSakick : public Command
 
                        if (ServerInstance->ULine(dest->server))
                        {
-                               user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client", user->nick.c_str());
+                               user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
                                return CMD_FAILURE;
                        }
 
@@ -68,7 +66,7 @@ class CommandSakick : public Command
                                if (n && n->HasUser(dest))
                                {
                                        /* Sort-of-bug: If the command was issued remotely, this message won't be sent */
-                                       user->WriteServ("NOTICE %s :*** Unable to kick %s from %s", user->nick.c_str(), dest->nick.c_str(), parameters[0].c_str());
+                                       user->WriteNotice("*** Unable to kick " + dest->nick + " from " + parameters[0]);
                                        return CMD_FAILURE;
                                }
                        }
@@ -76,14 +74,14 @@ class CommandSakick : public Command
                        if (IS_LOCAL(user))
                        {
                                /* Locally issued command; send the snomasks */
-                               ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick) + " SAKICKed " + dest->nick + " on " + parameters[0]);
+                               ServerInstance->SNO->WriteGlobalSno('a', user->nick + " SAKICKed " + dest->nick + " on " + parameters[0]);
                        }
 
                        return CMD_SUCCESS;
                }
                else
                {
-                       user->WriteServ("NOTICE %s :*** Invalid nickname or channel", user->nick.c_str());
+                       user->WriteNotice("*** Invalid nickname or channel");
                }
 
                return CMD_FAILURE;
@@ -104,20 +102,13 @@ class ModuleSakick : public Module
  public:
        ModuleSakick()
                : cmd(this)
-       {
-               ServerInstance->AddCommand(&cmd);
-       }
-
-       virtual ~ModuleSakick()
        {
        }
 
-       virtual Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides a SAKICK command", VF_OPTCOMMON|VF_VENDOR);
        }
-
 };
 
 MODULE_INIT(ModuleSakick)
-