From: Attila Molnar Date: Wed, 5 Mar 2014 15:20:41 +0000 (+0100) Subject: Create the core_xline module X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=8de3635fab6d3de02b4a352380448316ebefe825;p=user%2Fhenk%2Fcode%2Finspircd.git Create the core_xline module --- diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 509089d3e..c92bed25f 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -20,22 +20,14 @@ #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 = " [ :]"; } - /** 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& parameters, User *user); -}; + flags_needed = 'o'; + syntax = " [ :]"; +} /** Handle /ELINE */ @@ -101,5 +93,3 @@ CmdResult CommandEline::Handle (const std::vector& parameters, User return CMD_SUCCESS; } - -COMMAND_INIT(CommandEline) diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index 18a661b24..44b2192b5 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -20,23 +20,15 @@ #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 = " [ :]"; } - /** 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& parameters, User *user); -}; - + flags_needed = 'o'; + Penalty = 0; + syntax = " [ :]"; +} /** Handle /GLINE */ @@ -111,5 +103,3 @@ CmdResult CommandGline::Handle (const std::vector& parameters, User return CMD_SUCCESS; } - -COMMAND_INIT(CommandGline) diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index c6a8c7cad..686f4b9b3 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -20,23 +20,15 @@ #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 = " [ :]"; } - /** 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& parameters, User *user); -}; - + flags_needed = 'o'; + Penalty = 0; + syntax = " [ :]"; +} /** Handle /KLINE */ @@ -110,5 +102,3 @@ CmdResult CommandKline::Handle (const std::vector& parameters, User return CMD_SUCCESS; } - -COMMAND_INIT(CommandKline) diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index 003aacbef..24e8581b6 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -21,23 +21,15 @@ #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 = " [ :]"; } - /** 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& parameters, User *user); -}; - + flags_needed = 'o'; + Penalty = 0; + syntax = " [ :]"; +} CmdResult CommandQline::Handle (const std::vector& parameters, User *user) { @@ -90,6 +82,3 @@ CmdResult CommandQline::Handle (const std::vector& parameters, User return CMD_SUCCESS; } - - -COMMAND_INIT(CommandQline) diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp index eda5b2a46..5eeebf175 100644 --- a/src/coremods/core_xline/cmd_zline.cpp +++ b/src/coremods/core_xline/cmd_zline.cpp @@ -21,21 +21,15 @@ #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 = " [ :]"; } - /** 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& parameters, User *user); -}; + flags_needed = 'o'; + Penalty = 0; + syntax = " [ :]"; +} CmdResult CommandZline::Handle (const std::vector& parameters, User *user) { @@ -106,5 +100,3 @@ CmdResult CommandZline::Handle (const std::vector& 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 index 000000000..dcd85b4f6 --- /dev/null +++ b/src/coremods/core_xline/core_xline.cpp @@ -0,0 +1,43 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2014 Attila Molnar + * + * 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 . + */ + + +#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 index 000000000..c2e171410 --- /dev/null +++ b/src/coremods/core_xline/core_xline.h @@ -0,0 +1,108 @@ +/* + * InspIRCd -- Internet Relay Chat Daemon + * + * Copyright (C) 2014 Attila Molnar + * + * 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 . + */ + + +#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& 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& 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& 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& 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& parameters, User* user); +};