diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:32:27 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:32:27 +0000 |
commit | 069a2ef21425007d092342c8c11ec28da2f410d7 (patch) | |
tree | 30df16dcbf75bdeede41de270efcb055e0415617 /src/commands | |
parent | ca1b136b306784191235a6579da59f7e862003d1 (diff) |
Clean up Command constructor
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11707 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
53 files changed, 72 insertions, 471 deletions
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp index a0d99ea09..1f2641e67 100644 --- a/src/commands/cmd_admin.cpp +++ b/src/commands/cmd_admin.cpp @@ -29,7 +29,7 @@ class CommandAdmin : public Command public: /** Constructor for admin. */ - CommandAdmin (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ADMIN",0,0) { syntax = "[<servername>]"; } + CommandAdmin(Module* parent) : Command(parent,"ADMIN",0,0) { syntax = "[<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index fa91342e0..d93f74559 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -31,7 +31,7 @@ class CommandAway : public Command public: /** Constructor for away. */ - CommandAway (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"AWAY",0,0) { syntax = "[<message>]"; } + CommandAway ( Module* parent) : Command(parent,"AWAY",0,0) { syntax = "[<message>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_clearcache.cpp b/src/commands/cmd_clearcache.cpp index 6303fa528..2334e597c 100644 --- a/src/commands/cmd_clearcache.cpp +++ b/src/commands/cmd_clearcache.cpp @@ -30,7 +30,7 @@ class CommandClearcache : public Command public: /** Constructor for clearcache. */ - CommandClearcache (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CLEARCACHE","o",0) { } + CommandClearcache ( Module* parent) : Command(parent,"CLEARCACHE",0) { flags_needed = 'o'; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 5fa041b8f..63b4b24fb 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -31,7 +31,7 @@ class CommandCommands : public Command public: /** Constructor for commands. */ - CommandCommands (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"COMMANDS",0,0) { } + CommandCommands ( Module* parent) : Command(parent,"COMMANDS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_connect.cpp b/src/commands/cmd_connect.cpp index 7a391592d..65cc4bd6b 100644 --- a/src/commands/cmd_connect.cpp +++ b/src/commands/cmd_connect.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_CONNECT_H__ -#define __CMD_CONNECT_H__ - -#include "users.h" -#include "channels.h" -#include "ctables.h" -#include "modules.h" - /** Handle /CONNECT. 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 @@ -31,7 +23,7 @@ class CommandConnect : public Command public: /** Constructor for connect. */ - CommandConnect (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CONNECT","o",1,false,0) { syntax = "<servername> [<remote-server>]"; } + CommandConnect ( Module* parent) : Command(parent,"CONNECT",1) { flags_needed = 'o'; syntax = "<servername> [<remote-server>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandConnect : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - /* * This is handled by the server linking module, if necessary. Do not remove this stub. */ diff --git a/src/commands/cmd_die.cpp b/src/commands/cmd_die.cpp index 6eb9e0336..658240de8 100644 --- a/src/commands/cmd_die.cpp +++ b/src/commands/cmd_die.cpp @@ -31,7 +31,7 @@ class CommandDie : public Command public: /** Constructor for die. */ - CommandDie (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"DIE","o",1,false,0) { syntax = "<password>"; } + CommandDie ( Module* parent) : Command(parent,"DIE",1) { flags_needed = 'o'; syntax = "<password>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_eline.cpp b/src/commands/cmd_eline.cpp index 0591b9163..1294f1dbb 100644 --- a/src/commands/cmd_eline.cpp +++ b/src/commands/cmd_eline.cpp @@ -44,7 +44,7 @@ class CommandEline : public Command public: /** Constructor for eline. */ - CommandEline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ELINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; } + CommandEline ( Module* parent) : Command(parent,"ELINE",1,3) { flags_needed = 'o'; syntax = "<ident@host> [<duration> :<reason>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_gline.cpp b/src/commands/cmd_gline.cpp index 9da5f7071..cc29954d5 100644 --- a/src/commands/cmd_gline.cpp +++ b/src/commands/cmd_gline.cpp @@ -13,26 +13,6 @@ #include "inspircd.h" #include "xline.h" -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __CMD_GLINE_H__ -#define __CMD_GLINE_H__ - -// include the common header file - -#include "users.h" -#include "channels.h" /** Handle /GLINE. These command handlers can be reloaded by the core, * and handle basic RFC1459 commands. Commands within modules work @@ -44,7 +24,7 @@ class CommandGline : public Command public: /** Constructor for gline. */ - CommandGline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"GLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; } + 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 comamnd * @param pcnt The number of parameters passed to teh command @@ -54,8 +34,6 @@ class CommandGline : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - /** Handle /GLINE */ diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp index 43f8286f2..f239b9f78 100644 --- a/src/commands/cmd_info.cpp +++ b/src/commands/cmd_info.cpp @@ -31,7 +31,7 @@ class CommandInfo : public Command public: /** Constructor for info. */ - CommandInfo (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"INFO",0,0) { syntax = "[<servermask>]"; } + CommandInfo ( Module* parent) : Command(parent,"INFO",0,0) { syntax = "[<servermask>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 79aee9da5..89437e252 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_INVITE_H__ -#define __CMD_INVITE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /INVITE. 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 @@ -31,7 +23,7 @@ class CommandInvite : public Command public: /** Constructor for invite. */ - CommandInvite (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"INVITE", 0, 0, false, 4) { syntax = "[<nick> <channel>]"; } + CommandInvite ( Module* parent) : Command(parent,"INVITE", 0, 0) { Penalty = 4; syntax = "[<nick> <channel>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandInvite : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - /** Handle /INVITE */ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, User *user) diff --git a/src/commands/cmd_ison.cpp b/src/commands/cmd_ison.cpp index 2f64547e6..ca7639b58 100644 --- a/src/commands/cmd_ison.cpp +++ b/src/commands/cmd_ison.cpp @@ -31,7 +31,7 @@ class CommandIson : public Command public: /** Constructor for ison. */ - CommandIson (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ISON",0,0) { syntax = "<nick> {nick}"; } + CommandIson ( Module* parent) : Command(parent,"ISON",0,0) { syntax = "<nick> {nick}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp index d86516aaa..1213c78b1 100644 --- a/src/commands/cmd_join.cpp +++ b/src/commands/cmd_join.cpp @@ -31,7 +31,7 @@ class CommandJoin : public Command public: /** Constructor for join. */ - CommandJoin (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"JOIN", 0, 1, false, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; } + CommandJoin ( Module* parent) : Command(parent,"JOIN", 0, 1) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; Penalty = 2; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp index 54a5bd888..90655ba6f 100644 --- a/src/commands/cmd_kick.cpp +++ b/src/commands/cmd_kick.cpp @@ -31,7 +31,7 @@ class CommandKick : public Command public: /** Constructor for kick. */ - CommandKick (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; } + CommandKick ( Module* parent) : Command(parent,"KICK",0,2) { syntax = "<channel> <nick>{,<nick>} [<reason>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index 15cf58f47..1001d4c8a 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_KILL_H__ -#define __CMD_KILL_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /KILL. 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 @@ -31,7 +23,7 @@ class CommandKill : public Command public: /** Constructor for kill. */ - CommandKill (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KILL","o",2,false,0) { syntax = "<nickname> <reason>"; } + CommandKill ( Module* parent) : Command(parent,"KILL",2,2) { flags_needed = 'o'; syntax = "<nickname> <reason>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandKill : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - /** Handle /KILL */ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User *user) diff --git a/src/commands/cmd_kline.cpp b/src/commands/cmd_kline.cpp index 79e2e7292..ecc2aca5c 100644 --- a/src/commands/cmd_kline.cpp +++ b/src/commands/cmd_kline.cpp @@ -13,26 +13,6 @@ #include "inspircd.h" #include "xline.h" -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __CMD_KLINE_H__ -#define __CMD_KLINE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" /** Handle /KLINE. These command handlers can be reloaded by the core, * and handle basic RFC1459 commands. Commands within modules work @@ -44,7 +24,7 @@ class CommandKline : public Command public: /** Constructor for kline. */ - CommandKline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"KLINE","o",1,3,false,0) { syntax = "<ident@host> [<duration> :<reason>]"; } + 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 @@ -54,8 +34,6 @@ class CommandKline : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - /** Handle /KLINE */ diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp index 5de58e90f..d722fa65d 100644 --- a/src/commands/cmd_links.cpp +++ b/src/commands/cmd_links.cpp @@ -31,7 +31,7 @@ class CommandLinks : public Command public: /** Constructor for links. */ - CommandLinks (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LINKS",0,0) { } + CommandLinks ( Module* parent) : Command(parent,"LINKS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 1560487c5..b7023072b 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_LIST_H__ -#define __CMD_LIST_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /LIST. 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 @@ -31,7 +23,7 @@ class CommandList : public Command public: /** Constructor for list. */ - CommandList (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LIST", 0, 0, false, 5) { } + CommandList ( Module* parent) : Command(parent,"LIST", 0, 0) { Penalty = 5; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,8 +33,6 @@ class CommandList : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - /** Handle /LIST */ diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp index d6456d7d2..d4cda20ab 100644 --- a/src/commands/cmd_loadmodule.cpp +++ b/src/commands/cmd_loadmodule.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_LOADMODULE_H__ -#define __CMD_LOADMODULE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /LOADMODULE. 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 @@ -31,7 +23,7 @@ class CommandLoadmodule : public Command public: /** Constructor for loadmodule. */ - CommandLoadmodule (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LOADMODULE","o",1) { syntax = "<modulename>"; } + CommandLoadmodule ( Module* parent) : Command(parent,"LOADMODULE",1,1) { flags_needed='o'; syntax = "<modulename>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,8 +33,6 @@ class CommandLoadmodule : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - /** Handle /LOADMODULE */ diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp index ea278a406..a79466ae4 100644 --- a/src/commands/cmd_lusers.cpp +++ b/src/commands/cmd_lusers.cpp @@ -31,7 +31,7 @@ class CommandLusers : public Command public: /** Constructor for lusers. */ - CommandLusers (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"LUSERS",0,0) { } + CommandLusers ( Module* parent) : Command(parent,"LUSERS",0,0) { } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp index 780caf081..edc8aa124 100644 --- a/src/commands/cmd_map.cpp +++ b/src/commands/cmd_map.cpp @@ -13,25 +13,12 @@ #include "inspircd.h" -#ifndef __CMD_MAP_H__ -#define __CMD_MAP_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - -/** Handle /MAP. 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 CommandMap : public Command { public: /** Constructor for map. */ - CommandMap (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MAP",0,0,false,2) { } + CommandMap ( Module* parent) : Command(parent,"MAP",0,0) { Penalty=2; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +28,6 @@ class CommandMap : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - /** Handle /MAP */ CmdResult CommandMap::Handle (const std::vector<std::string>&, User *user) diff --git a/src/commands/cmd_mode.cpp b/src/commands/cmd_mode.cpp index 9b80b77a4..5c27c8df8 100644 --- a/src/commands/cmd_mode.cpp +++ b/src/commands/cmd_mode.cpp @@ -30,7 +30,7 @@ class CommandMode : public Command public: /** Constructor for mode. */ - CommandMode (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; } + CommandMode ( Module* parent) : Command(parent,"MODE",0,1) { syntax = "<target> <modes> {<mode-parameters>}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index 619cf1cb6..599eb611b 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -31,7 +31,7 @@ class CommandModules : public Command public: /** Constructor for modules. */ - CommandModules (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MODULES",0,0) { syntax = "[debug]"; } + CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[debug]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_motd.cpp b/src/commands/cmd_motd.cpp index 36306603c..0a6aaeac3 100644 --- a/src/commands/cmd_motd.cpp +++ b/src/commands/cmd_motd.cpp @@ -34,7 +34,7 @@ class CommandMotd : public Command public: /** Constructor for motd. */ - CommandMotd (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"MOTD",0,0) { syntax = "[<servername>]"; } + CommandMotd ( Module* parent) : Command(parent,"MOTD",0,0) { syntax = "[<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp index 642fafb5d..537c477c8 100644 --- a/src/commands/cmd_names.cpp +++ b/src/commands/cmd_names.cpp @@ -31,7 +31,7 @@ class CommandNames : public Command public: /** Constructor for names. */ - CommandNames (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; } + CommandNames ( Module* parent) : Command(parent,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 52c6a2254..a447f7d70 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -24,7 +24,7 @@ class CommandNick : public Command public: /** Constructor for nick. */ - CommandNick (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NICK", 0, 1, true, 3) { syntax = "<newnick>"; } + CommandNick ( Module* parent) : Command(parent,"NICK", 1, 1) { works_before_reg = true; syntax = "<newnick>"; Penalty = 3; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp index 2028f8c56..0b82c5485 100644 --- a/src/commands/cmd_notice.cpp +++ b/src/commands/cmd_notice.cpp @@ -22,7 +22,7 @@ class CommandNotice : public Command public: /** Constructor for notice. */ - CommandNotice (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; } + CommandNotice ( Module* parent) : Command(parent,"NOTICE",0,2) { syntax = "<target>{,<target>} <message>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 3efafca5b..da53d2b1a 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -12,14 +12,7 @@ */ #include "inspircd.h" - -#ifndef __CMD_OPER_H__ -#define __CMD_OPER_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" +#include "hashcomp.h" bool OneOfMatches(const char* host, const char* ip, const char* hostlist); @@ -33,7 +26,7 @@ class CommandOper : public Command public: /** Constructor for oper. */ - CommandOper (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"OPER",0,2,false,2) { syntax = "<username> <password>"; } + CommandOper ( Module* parent) : Command(parent,"OPER",2,2) { syntax = "<username> <password>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -43,10 +36,6 @@ class CommandOper : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - -#include "hashcomp.h" - bool OneOfMatches(const char* host, const char* ip, const char* hostlist) { std::stringstream hl(hostlist); diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp index e9753c456..e2e4e59a0 100644 --- a/src/commands/cmd_part.cpp +++ b/src/commands/cmd_part.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_PART_H__ -#define __CMD_PART_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /PART. 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 @@ -31,7 +23,7 @@ class CommandPart : public Command public: /** Constructor for part. */ - CommandPart (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PART", 0, 1, false, 5) { syntax = "<channel>{,<channel>} [<reason>]"; } + CommandPart (Module* parent) : Command(parent,"PART", 1, 2) { Penalty = 5; syntax = "<channel>{,<channel>} [<reason>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandPart : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User *user) { std::string reason; diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp index 8429a494f..6219118ee 100644 --- a/src/commands/cmd_pass.cpp +++ b/src/commands/cmd_pass.cpp @@ -13,17 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_PASS_H__ -#define __CMD_PASS_H__ - -// include the common header files - -#include <string> -#include <vector> -#include "inspircd.h" -#include "users.h" -#include "channels.h" - /** Handle /PASS. 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 @@ -34,7 +23,7 @@ class CommandPass : public Command public: /** Constructor for pass. */ - CommandPass (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PASS",0,1,true,0) { syntax = "<password>"; } + CommandPass ( Module* parent) : Command(parent,"PASS",1,1) { works_before_reg = true; Penalty = 0; syntax = "<password>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -44,8 +33,6 @@ class CommandPass : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - CmdResult CommandPass::Handle (const std::vector<std::string>& parameters, User *user) { diff --git a/src/commands/cmd_ping.cpp b/src/commands/cmd_ping.cpp index feea84f59..c83d1b38f 100644 --- a/src/commands/cmd_ping.cpp +++ b/src/commands/cmd_ping.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_PING_H__ -#define __CMD_PING_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /PING. 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 @@ -31,7 +23,7 @@ class CommandPing : public Command public: /** Constructor for ping. */ - CommandPing (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PING", 0, 1, false, 0) { syntax = "<servername> [:<servername>]"; } + CommandPing ( Module* parent) : Command(parent,"PING", 0, 1) { Penalty = 0; syntax = "<servername> [:<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandPing : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - CmdResult CommandPing::Handle (const std::vector<std::string>& parameters, User *user) { user->WriteServ("PONG %s :%s", ServerInstance->Config->ServerName, parameters[0].c_str()); diff --git a/src/commands/cmd_pong.cpp b/src/commands/cmd_pong.cpp index 5ca5b4cfc..225be147a 100644 --- a/src/commands/cmd_pong.cpp +++ b/src/commands/cmd_pong.cpp @@ -13,15 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_PONG_H__ -#define __CMD_PONG_H__ - -// include the common header files - -#include "inspircd.h" -#include "users.h" -#include "channels.h" - /** Handle /PONG. 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 @@ -32,7 +23,7 @@ class CommandPong : public Command public: /** Constructor for pong. */ - CommandPong (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PONG", 0, 1, false, 0) { syntax = "<ping-text>"; } + CommandPong ( Module* parent) : Command(parent,"PONG", 0, 1) { Penalty = 0; syntax = "<ping-text>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -42,9 +33,6 @@ class CommandPong : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - CmdResult CommandPong::Handle (const std::vector<std::string>&, User *user) { // set the user as alive so they survive to next ping diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index e05366fa0..de2ef5a1b 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -23,7 +23,7 @@ class CommandPrivmsg : public Command public: /** Constructor for privmsg. */ - CommandPrivmsg (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; } + CommandPrivmsg ( Module* parent) : Command(parent,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_qline.cpp b/src/commands/cmd_qline.cpp index ebd1d6b31..97e219f9b 100644 --- a/src/commands/cmd_qline.cpp +++ b/src/commands/cmd_qline.cpp @@ -13,38 +13,14 @@ #include "inspircd.h" #include "xline.h" -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __CMD_QLINE_H__ -#define __CMD_QLINE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" -/** Handle /QLINE. 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. - */ +/** Handle /QLINE. */ class CommandQline : public Command { public: /** Constructor for qline. */ - CommandQline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"QLINE","o",1,3,false,0) { syntax = "<nick> [<duration> :<reason>]"; } + 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 comamnd * @param pcnt The number of parameters passed to teh command @@ -54,10 +30,6 @@ class CommandQline : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - CmdResult CommandQline::Handle (const std::vector<std::string>& parameters, User *user) { diff --git a/src/commands/cmd_quit.cpp b/src/commands/cmd_quit.cpp index 46c728881..d041fc031 100644 --- a/src/commands/cmd_quit.cpp +++ b/src/commands/cmd_quit.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_QUIT_H__ -#define __CMD_QUIT_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /QUIT. 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 @@ -31,7 +23,7 @@ class CommandQuit : public Command public: /** Constructor for quit. */ - CommandQuit (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"QUIT",0,0,true) { syntax = "[<message>]"; } + CommandQuit ( Module* parent) : Command(parent,"QUIT",0,1) { works_before_reg = true; syntax = "[<message>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,10 +33,6 @@ class CommandQuit : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - CmdResult CommandQuit::Handle (const std::vector<std::string>& parameters, User *user) { diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index 60b1e12b6..a689801aa 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -13,27 +13,6 @@ #include "inspircd.h" #include "xline.h" -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __CMD_REHASH_H__ -#define __CMD_REHASH_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /REHASH. 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 @@ -44,7 +23,7 @@ class CommandRehash : public Command public: /** Constructor for rehash. */ - CommandRehash (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"REHASH","o",0,false,3) { syntax = "[<servermask>]"; } + CommandRehash ( Module* parent) : Command(parent,"REHASH",0) { flags_needed = 'o'; Penalty = 2; syntax = "[<servermask>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -54,10 +33,6 @@ class CommandRehash : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, User *user) { std::string param = parameters.size() ? parameters[0] : ""; diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp index 5d84fc7d5..3e3a3a617 100644 --- a/src/commands/cmd_reloadmodule.cpp +++ b/src/commands/cmd_reloadmodule.cpp @@ -18,7 +18,7 @@ class CommandReloadmodule : public Command public: /** Constructor for reloadmodule. */ - CommandReloadmodule (InspIRCd* Instance, Module* parent) : Command(Instance, parent, "RELOADMODULE","o",1) { syntax = "<modulename>"; } + CommandReloadmodule ( Module* parent) : Command( parent, "RELOADMODULE",1) { flags_needed = 'o'; syntax = "<modulename>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -30,6 +30,13 @@ class CommandReloadmodule : public Command CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameters, User *user) { + if (parameters[0] == "cmd_reloadmodule.so") + { + user->WriteNumeric(975, "%s %s :You cannot reload cmd_reloadmodule.so (unload and load it)", + user->nick.c_str(), parameters[0].c_str()); + return CMD_FAILURE; + } + if (ServerInstance->Modules->Unload(parameters[0].c_str())) { ServerInstance->SNO->WriteToSnoMask('a', "RELOAD MODULE: %s unloaded %s",user->nick.c_str(), parameters[0].c_str()); diff --git a/src/commands/cmd_restart.cpp b/src/commands/cmd_restart.cpp index ffd0323b7..e83f3f381 100644 --- a/src/commands/cmd_restart.cpp +++ b/src/commands/cmd_restart.cpp @@ -13,28 +13,14 @@ #include "inspircd.h" -#ifndef __CMD_RESTART_H__ -#define __CMD_RESTART_H__ - -// include the common header files - -#include <string> -#include <deque> -#include <vector> -#include "users.h" -#include "channels.h" - -/** Handle /RESTART. 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. +/** Handle /RESTART */ class CommandRestart : public Command { public: /** Constructor for restart. */ - CommandRestart (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"RESTART","o",1,false,0) { syntax = "<password>"; } + CommandRestart(Module* parent) : Command(parent,"RESTART",1,1) { flags_needed = 'o'; syntax = "<password>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -44,9 +30,6 @@ class CommandRestart : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - CmdResult CommandRestart::Handle (const std::vector<std::string>& parameters, User *user) { ServerInstance->Logs->Log("COMMAND",DEFAULT,"Restart: %s",user->nick.c_str()); diff --git a/src/commands/cmd_rules.cpp b/src/commands/cmd_rules.cpp index b5b5fbc15..3cc5c15f4 100644 --- a/src/commands/cmd_rules.cpp +++ b/src/commands/cmd_rules.cpp @@ -34,7 +34,7 @@ class CommandRules : public Command public: /** Constructor for rules. */ - CommandRules (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"RULES",0,0) { syntax = "[<servername>]"; } + CommandRules ( Module* parent) : Command(parent,"RULES",0,0) { syntax = "[<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp index c350dd2a6..e5a7622b8 100644 --- a/src/commands/cmd_server.cpp +++ b/src/commands/cmd_server.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_SERVER_H__ -#define __CMD_SERVER_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /SERVER. 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 @@ -31,7 +23,7 @@ class CommandServer : public Command public: /** Constructor for server. */ - CommandServer (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"SERVER",0,0,true) { } + CommandServer ( Module* parent) : Command(parent,"SERVER") { works_before_reg = true;} /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,11 +33,6 @@ class CommandServer : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - - CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user) { if (user->registered == REG_ALL) diff --git a/src/commands/cmd_squit.cpp b/src/commands/cmd_squit.cpp index ada5655d1..f742dd964 100644 --- a/src/commands/cmd_squit.cpp +++ b/src/commands/cmd_squit.cpp @@ -13,17 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_SQUIT_H__ -#define __CMD_SQUIT_H__ - -// include the common header files - -#include <string> -#include <vector> -#include "inspircd.h" -#include "users.h" -#include "channels.h" - /** Handle /SQUIT. 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 @@ -34,7 +23,7 @@ class CommandSquit : public Command public: /** Constructor for squit. */ - CommandSquit (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"SQUIT","o",1) { syntax = "<servername> [<reason>]"; } + CommandSquit ( Module* parent) : Command(parent,"SQUIT",1,2) { flags_needed = 'o'; syntax = "<servername> [<reason>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -44,8 +33,6 @@ class CommandSquit : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - /* * This is handled by the server linking module, if necessary. Do not remove this stub. diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index e3961a906..9f2890bd7 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -36,7 +36,7 @@ class CommandStats : public Command public: /** Constructor for stats. */ - CommandStats (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; } + CommandStats ( Module* parent) : Command(parent,"STATS",0,1) { syntax = "<stats-symbol> [<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp index 4fdcb8aa6..8ff588c2d 100644 --- a/src/commands/cmd_time.cpp +++ b/src/commands/cmd_time.cpp @@ -31,7 +31,7 @@ class CommandTime : public Command public: /** Constructor for time. */ - CommandTime (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TIME",0,0) { syntax = "[<servername>]"; } + CommandTime ( Module* parent) : Command(parent,"TIME",0,0) { syntax = "[<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index 97321460e..e0fa79d1c 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_TOPIC_H__ -#define __CMD_TOPIC_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /TOPIC. 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 @@ -31,7 +23,7 @@ class CommandTopic : public Command public: /** Constructor for topic. */ - CommandTopic (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TOPIC",0,1,false,2) { syntax = "<channel> [<topic>]"; } + CommandTopic ( Module* parent) : Command(parent,"TOPIC",1, 2) { syntax = "<channel> [<topic>]"; Penalty = 2; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,10 +33,6 @@ class CommandTopic : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - CmdResult CommandTopic::Handle (const std::vector<std::string>& parameters, User *user) { Channel* c; diff --git a/src/commands/cmd_trace.cpp b/src/commands/cmd_trace.cpp deleted file mode 100644 index 9ac590ee1..000000000 --- a/src/commands/cmd_trace.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" - -#ifndef __CMD_TRACE_H__ -#define __CMD_TRACE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - -/** Handle /TRACE. 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 CommandTrace : public Command -{ - public: - /** Constructor for trace. - */ - CommandTrace (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"TRACE","o",0) { syntax = "[<object>]"; } - /** 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); -}; - -#endif - - -/** XXX: This is crap. someone fix this when you have time, to be more useful. - */ -CmdResult CommandTrace::Handle (const std::vector<std::string>&, User *user) -{ - /*for (user_hash::iterator i = ServerInstance->clientlist->begin(); i != ServerInstance->clientlist->end(); i++) - { - if (i->second->registered == REG_ALL) - { - if (IS_OPER(i->second)) - { - user->WriteNumeric(205, "%s :Oper 0 %s",user->nick,i->second->nick); - } - else - { - user->WriteNumeric(204, "%s :User 0 %s",user->nick,i->second->nick); - } - } - else - { - user->WriteNumeric(203, "%s :???? 0 [%s]",user->nick,i->second->host); - } - }*/ - return CMD_SUCCESS; -} - -COMMAND_INIT(CommandTrace) diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp index af51067dd..bdc516aac 100644 --- a/src/commands/cmd_unloadmodule.cpp +++ b/src/commands/cmd_unloadmodule.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_UNLOADMODULE_H__ -#define __CMD_UNLOADMODULE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /UNLOADMODULE. 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 @@ -31,7 +23,7 @@ class CommandUnloadmodule : public Command public: /** Constructor for unloadmodule. */ - CommandUnloadmodule (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"UNLOADMODULE","o",1) { syntax = "<modulename>"; } + CommandUnloadmodule ( Module* parent) : Command(parent,"UNLOADMODULE",1) { flags_needed = 'o'; syntax = "<modulename>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,13 +33,14 @@ class CommandUnloadmodule : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - - CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameters, User *user) { + if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so") + { + user->WriteNumeric(972, "%s %s :You cannot unload module loading commands!", user->nick.c_str(), parameters[0].c_str()); + return CMD_FAILURE; + } + if (ServerInstance->Modules->Unload(parameters[0].c_str())) { ServerInstance->SNO->WriteToSnoMask('a', "MODULE UNLOADED: %s unloaded %s", user->nick.c_str(), parameters[0].c_str()); diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp index 9edfb46b6..8f2a30908 100644 --- a/src/commands/cmd_user.cpp +++ b/src/commands/cmd_user.cpp @@ -13,14 +13,6 @@ #include "inspircd.h" -#ifndef __CMD_USER_H__ -#define __CMD_USER_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /USER. 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 @@ -31,7 +23,7 @@ class CommandUser : public Command public: /** Constructor for user. */ - CommandUser (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"USER",0,4,true,0) { syntax = "<username> <localhost> <remotehost> <GECOS>"; } + CommandUser ( Module* parent) : Command(parent,"USER",0,4) { works_before_reg = true; Penalty = 0; syntax = "<username> <localhost> <remotehost> <GECOS>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command @@ -41,9 +33,6 @@ class CommandUser : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - CmdResult CommandUser::Handle (const std::vector<std::string>& parameters, User *user) { /* A user may only send the USER command once */ diff --git a/src/commands/cmd_userhost.cpp b/src/commands/cmd_userhost.cpp index acb67cf1b..2833d56ba 100644 --- a/src/commands/cmd_userhost.cpp +++ b/src/commands/cmd_userhost.cpp @@ -31,7 +31,7 @@ class CommandUserhost : public Command public: /** Constructor for userhost. */ - CommandUserhost (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; } + CommandUserhost ( Module* parent) : Command(parent,"USERHOST",0,1) { syntax = "<nick>{,<nick>}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp index 86be41a41..bfe82d4d9 100644 --- a/src/commands/cmd_version.cpp +++ b/src/commands/cmd_version.cpp @@ -31,7 +31,7 @@ class CommandVersion : public Command public: /** Constructor for version. */ - CommandVersion (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"VERSION",0,0) { syntax = "[<servername>]"; } + CommandVersion ( Module* parent) : Command(parent,"VERSION",0,0) { syntax = "[<servername>]"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_wallops.cpp b/src/commands/cmd_wallops.cpp index 98b3d3f34..7894419c1 100644 --- a/src/commands/cmd_wallops.cpp +++ b/src/commands/cmd_wallops.cpp @@ -31,7 +31,7 @@ class CommandWallops : public Command public: /** Constructor for wallops. */ - CommandWallops (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WALLOPS","o",1,1) { syntax = "<any-text>"; } + CommandWallops ( Module* parent) : Command(parent,"WALLOPS",1,1) { flags_needed = 'o'; syntax = "<any-text>"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index ff39c4552..89ca60d02 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -37,7 +37,7 @@ class CommandWho : public Command public: /** Constructor for who. */ - CommandWho (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WHO", 0, 1, false, 2) { syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; } + CommandWho ( Module* parent) : Command(parent,"WHO", 1) { Penalty = 2; syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]"; } void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults); /** Handle command. * @param parameters The parameters to the comamnd diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index 9b64d5e8b..972b0439e 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -23,7 +23,7 @@ class CommandWhois : public Command public: /** Constructor for whois. */ - CommandWhois (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"WHOIS",0,1,false,2) { syntax = "<nick>{,<nick>}"; } + CommandWhois ( Module* parent) : Command(parent,"WHOIS",1) { Penalty = 2; syntax = "<nick>{,<nick>}"; } /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index 3df97086e..78a7e7544 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -16,11 +16,12 @@ WhoWasMaintainTimer * timer; -CommandWhowas::CommandWhowas(InspIRCd* Instance, Module* parent) : Command(Instance,parent, "WHOWAS", 0, 1, false, 2) +CommandWhowas::CommandWhowas( Module* parent) : Command(parent, "WHOWAS", 1) { syntax = "<nick>{,<nick>}"; - timer = new WhoWasMaintainTimer(Instance, 3600); - Instance->Timers->AddTimer(timer); + Penalty = 2; + timer = new WhoWasMaintainTimer(ServerInstance, 3600); + ServerInstance->Timers->AddTimer(timer); } CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, User* user) @@ -308,7 +309,7 @@ class ModuleWhoWas : public Module { CommandWhowas cmd; public: - ModuleWhoWas(InspIRCd *Me) : Module(Me), cmd(Me, this) + ModuleWhoWas(InspIRCd *Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/commands/cmd_zline.cpp b/src/commands/cmd_zline.cpp index 81476a032..e2b470805 100644 --- a/src/commands/cmd_zline.cpp +++ b/src/commands/cmd_zline.cpp @@ -13,27 +13,6 @@ #include "inspircd.h" #include "xline.h" -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#ifndef __CMD_ZLINE_H__ -#define __CMD_ZLINE_H__ - -// include the common header files - -#include "users.h" -#include "channels.h" - /** Handle /ZLINE. 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 @@ -44,7 +23,7 @@ class CommandZline : public Command public: /** Constructor for zline. */ - CommandZline (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"ZLINE","o",1,3,false,0) { syntax = "<ipmask> [<duration> :<reason>]"; } + 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 comamnd * @param pcnt The number of parameters passed to teh command @@ -54,11 +33,6 @@ class CommandZline : public Command CmdResult Handle(const std::vector<std::string>& parameters, User *user); }; -#endif - - - - CmdResult CommandZline::Handle (const std::vector<std::string>& parameters, User *user) { std::string target = parameters[0]; |