]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Create the core_xline module
authorAttila Molnar <attilamolnar@hush.com>
Wed, 5 Mar 2014 15:20:41 +0000 (16:20 +0100)
committerAttila Molnar <attilamolnar@hush.com>
Wed, 5 Mar 2014 15:20:41 +0000 (16:20 +0100)
src/coremods/core_xline/cmd_eline.cpp
src/coremods/core_xline/cmd_gline.cpp
src/coremods/core_xline/cmd_kline.cpp
src/coremods/core_xline/cmd_qline.cpp
src/coremods/core_xline/cmd_zline.cpp
src/coremods/core_xline/core_xline.cpp [new file with mode: 0644]
src/coremods/core_xline/core_xline.h [new file with mode: 0644]

index 509089d3e30f5fd6b1f7e43578bf366aa9c62e1d..c92bed25fb91e4ce60dd47bd3cd91364830b3e02 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
+#include "core_xline.h"
 
-/** Handle /ELINE.
- */
-class CommandEline : public Command
+CommandEline::CommandEline(Module* parent)
+       : Command(parent, "ELINE", 1, 3)
 {
- public:
-       /** Constructor for eline.
-        */
-       CommandEline ( Module* parent) : Command(parent,"ELINE",1,3) { flags_needed = 'o'; syntax = "<ident@host> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the 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);
-};
+       flags_needed = 'o';
+       syntax = "<ident@host> [<duration> :<reason>]";
+}
 
 /** Handle /ELINE
  */
@@ -101,5 +93,3 @@ CmdResult CommandEline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandEline)
index 18a661b24ec3f7569a9b327a8743fda8ffd1ec79..44b2192b5b31987ef9796c3b1e5a2c7455410268 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
+#include "core_xline.h"
 
-/** Handle /GLINE.
- */
-class CommandGline : public Command
+CommandGline::CommandGline(Module* parent)
+       : Command(parent, "GLINE", 1, 3)
 {
- public:
-       /** Constructor for gline.
-        */
-       CommandGline (Module* parent) : Command(parent,"GLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<ident@host> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the 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);
-};
-
+       flags_needed = 'o';
+       Penalty = 0;
+       syntax = "<ident@host> [<duration> :<reason>]";
+}
 
 /** Handle /GLINE
  */
@@ -111,5 +103,3 @@ CmdResult CommandGline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandGline)
index c6a8c7cad6b46483a5d5603ffe30f0cfaee1847d..686f4b9b37b4232b03a393343b8083fbc1b8ee66 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
+#include "core_xline.h"
 
-/** Handle /KLINE.
- */
-class CommandKline : public Command
+CommandKline::CommandKline(Module* parent)
+       : Command(parent, "KLINE", 1, 3)
 {
- 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 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);
-};
-
+       flags_needed = 'o';
+       Penalty = 0;
+       syntax = "<ident@host> [<duration> :<reason>]";
+}
 
 /** Handle /KLINE
  */
@@ -110,5 +102,3 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandKline)
index 003aacbef5fe3ea5238fc1f2fcffad919580ff8e..24e8581b6c5f986459314da2e0e79f6e8722d82e 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
+#include "core_xline.h"
 
-/** Handle /QLINE.  */
-class CommandQline : public Command
+CommandQline::CommandQline(Module* parent)
+       : Command(parent, "QLINE", 1, 3)
 {
- public:
-       /** Constructor for qline.
-        */
-       CommandQline ( Module* parent) : Command(parent,"QLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<nick> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the command
-        * @param pcnt The number of parameters passed to the 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);
-};
-
+       flags_needed = 'o';
+       Penalty = 0;
+       syntax = "<nick> [<duration> :<reason>]";
+}
 
 CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -90,6 +82,3 @@ CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
-
-
-COMMAND_INIT(CommandQline)
index eda5b2a4623fa572da9eb02f73d22a1d5b3f47e1..5eeebf1752bd2916785e9776ba517d6a6cede45b 100644 (file)
 
 #include "inspircd.h"
 #include "xline.h"
-/** Handle /ZLINE.
- */
-class CommandZline : public Command
+#include "core_xline.h"
+
+CommandZline::CommandZline(Module* parent)
+       : Command(parent, "ZLINE", 1, 3)
 {
- public:
-       /** Constructor for zline.
-        */
-       CommandZline ( Module* parent) : Command(parent,"ZLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<ipmask> [<duration> :<reason>]"; }
-       /** Handle command.
-        * @param parameters The parameters to the 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);
-};
+       flags_needed = 'o';
+       Penalty = 0;
+       syntax = "<ipmask> [<duration> :<reason>]";
+}
 
 CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -106,5 +100,3 @@ CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User
 
        return CMD_SUCCESS;
 }
-
-COMMAND_INIT(CommandZline)
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
new file mode 100644 (file)
index 0000000..dcd85b4
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ *
+ * 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 "core_xline.h"
+
+class CoreModXLine : public Module
+{
+       CommandEline cmdeline;
+       CommandGline cmdgline;
+       CommandKline cmdkline;
+       CommandQline cmdqline;
+       CommandZline cmdzline;
+
+ public:
+       CoreModXLine()
+               : cmdeline(this), cmdgline(this), cmdkline(this), cmdqline(this), cmdzline(this)
+       {
+       }
+
+       Version GetVersion() CXX11_OVERRIDE
+       {
+               return Version("Provides the ELINE, GLINE, KLINE, QLINE, and ZLINE commands", VF_VENDOR|VF_CORE);
+       }
+};
+
+MODULE_INIT(CoreModXLine)
diff --git a/src/coremods/core_xline/core_xline.h b/src/coremods/core_xline/core_xline.h
new file mode 100644 (file)
index 0000000..c2e1714
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * InspIRCd -- Internet Relay Chat Daemon
+ *
+ *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
+ *
+ * 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/>.
+ */
+
+
+#pragma once
+
+#include "inspircd.h"
+
+/** Handle /ELINE.
+ */
+class CommandEline : public Command
+{
+ public:
+       /** Constructor for eline.
+        */
+       CommandEline(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the 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 /GLINE.
+ */
+class CommandGline : public Command
+{
+ public:
+       /** Constructor for gline.
+        */
+       CommandGline(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the 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.
+ */
+class CommandKline : public Command
+{
+ public:
+       /** Constructor for kline.
+        */
+       CommandKline(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the 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 /QLINE.
+ */
+class CommandQline : public Command
+{
+ public:
+       /** Constructor for qline.
+        */
+       CommandQline(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the command
+        * @param pcnt The number of parameters passed to the 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 /ZLINE.
+ */
+class CommandZline : public Command
+{
+ public:
+       /** Constructor for zline.
+        */
+       CommandZline(Module* parent);
+
+       /** Handle command.
+        * @param parameters The parameters to the 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);
+};