]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_kline.cpp
More WriteGlobalSno conversions in rehash, patch by dKingston
[user/henk/code/inspircd.git] / src / commands / cmd_kline.cpp
index 0a3e7c9303ed3d423d755939391e3cb3914f323f..9184a3505e42acbfef188b006a27a1582cb19b3d 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-#include "commands/cmd_kline.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /KLINE. These command handlers can be reloaded by the core,
+ * and handle basic RFC1459 commands. Commands within modules work
+ * the same way, however, they can be fully unloaded, where these
+ * may not.
+ */
+class CommandKline : public Command
 {
-       return new CommandKline(Instance);
-}
+ public:
+       /** Constructor for kline.
+        */
+       CommandKline ( Module* parent) : Command(parent,"KLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<ident@host> [<duration> :<reason>]"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
+
 
 /** Handle /KLINE
  */
@@ -55,7 +70,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
                }
 
                long duration = ServerInstance->Duration(parameters[1].c_str());
-               KLine* kl = new KLine(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
+               KLine* kl = new KLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
                if (ServerInstance->XLines->AddLine(kl,user))
                {
                        if (!duration)
@@ -81,7 +96,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
        {
                if (ServerInstance->XLines->DelLine(target.c_str(),"K",user))
                {
-                       ServerInstance->SNO->WriteToSnoMask('x',"%s Removed K-line on %s.",user->nick.c_str(),target.c_str());
+                       ServerInstance->SNO->WriteToSnoMask('x',"%s removed K-line on %s",user->nick.c_str(),target.c_str());
                }
                else
                {
@@ -91,3 +106,5 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandKline)