]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_kline.cpp
Replace copyright headers with headers granting specific authors copyright
[user/henk/code/inspircd.git] / src / commands / cmd_kline.cpp
index 0a3e7c9303ed3d423d755939391e3cb3914f323f..6c2789557f43597c76d489bcc1c18fb50f650d18 100644 (file)
@@ -1,24 +1,46 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://wiki.inspircd.org/Credits
+ *   Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
+ *   Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
  *
- * This program is free but copyrighted software; see
- *         the file COPYING for details.
+ * This file is part of InspIRCd.  InspIRCd is free software: you can
+ * redistribute it and/or modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation, version 2.
  *
- * ---------------------------------------------------
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+
 #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 +77,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 +103,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 +113,5 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandKline)