diff options
-rw-r--r-- | src/coremods/core_xline/cmd_eline.cpp | 22 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_gline.cpp | 24 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_kline.cpp | 24 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_qline.cpp | 25 | ||||
-rw-r--r-- | src/coremods/core_xline/cmd_zline.cpp | 24 | ||||
-rw-r--r-- | src/coremods/core_xline/core_xline.cpp | 43 | ||||
-rw-r--r-- | src/coremods/core_xline/core_xline.h | 108 |
7 files changed, 186 insertions, 84 deletions
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 = "<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) 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 = "<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) 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 = "<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) 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 = "<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) 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 = "<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 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 <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 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 <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); +}; |