diff options
117 files changed, 299 insertions, 720 deletions
diff --git a/include/commands/cmd_whowas.h b/include/commands/cmd_whowas.h index e4fc69533..5109ab54a 100644 --- a/include/commands/cmd_whowas.h +++ b/include/commands/cmd_whowas.h @@ -77,7 +77,7 @@ class CommandWhowas : public Command std::string stats; public: - CommandWhowas(InspIRCd* Instance, Module* parent); + CommandWhowas(Module* parent); /** Handle command. * @param parameters The parameters to the comamnd * @param pcnt The number of parameters passed to teh command diff --git a/include/ctables.h b/include/ctables.h index d3baec041..a2f4e9bb3 100644 --- a/include/ctables.h +++ b/include/ctables.h @@ -84,17 +84,13 @@ struct RouteDescriptor */ class CoreExport Command : public Extensible { - protected: - /** Owner/Creator object - */ - InspIRCd* ServerInstance; public: /** Command name */ std::string command; - /** Creator module, NULL for core commands */ - Module* creator; + /** Creator module - never NULL */ + Module* const creator; /** User flags needed to execute the command or 0 */ @@ -138,7 +134,7 @@ class CoreExport Command : public Extensible /** How many seconds worth of penalty does this command have? */ - const int Penalty; + int Penalty; /** Create a new command. * @param Instance Pointer to creator class @@ -151,20 +147,10 @@ class CoreExport Command : public Extensible * be allowed before the user is 'registered' (has sent USER, * NICK, optionally PASS, and been resolved). */ - Command(InspIRCd* Instance, Module* me, const std::string &cmd, const char *flags, int minpara, bool before_reg = false, int penalty = 1) : - ServerInstance(Instance), command(cmd), creator(me), flags_needed(flags ? *flags : 0), - min_params(minpara), max_params(0), disabled(false), works_before_reg(before_reg), Penalty(penalty) + Command(Module* me, const std::string &cmd, int minpara = 0, int maxpara = 0) : + command(cmd), creator(me), flags_needed(0), min_params(minpara), max_params(maxpara), + use_count(0), total_bytes(0), disabled(false), works_before_reg(false), Penalty(1) { - use_count = 0; - total_bytes = 0; - } - - Command(InspIRCd* Instance, Module* me, const std::string &cmd, const char *flags, int minpara, int maxpara, bool before_reg = false, int penalty = 1) : - ServerInstance(Instance), command(cmd), creator(me), flags_needed(flags ? *flags : 0), - min_params(minpara), max_params(maxpara), disabled(false), works_before_reg(before_reg), Penalty(penalty) - { - use_count = 0; - total_bytes = 0; } /** Handle the command from a user. @@ -222,11 +208,8 @@ class CoreExport Command : public Extensible return works_before_reg; } - /** Standard constructor gubbins - */ virtual ~Command() { - syntax.clear(); } }; diff --git a/include/inspircd.h b/include/inspircd.h index 45b219096..b927f0b1b 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -73,6 +73,9 @@ typedef std::vector< KeyVal > KeyValList; */ typedef std::multimap< std::string, KeyValList > ConfigDataHash; +class InspIRCd; +extern InspIRCd* ServerInstance; + #include "inspircd_config.h" #include "inspircd_version.h" #include "extensible.h" @@ -936,7 +939,6 @@ class CoreExport InspIRCd : public classbase } }; -extern InspIRCd* ServerInstance; ENTRYPOINT; template<class Cmd> @@ -944,9 +946,9 @@ class CommandModule : public Module { Cmd cmd; public: - CommandModule(InspIRCd* me) : Module(me), cmd(me, this) + CommandModule(InspIRCd*) : cmd(this) { - me->AddCommand(&cmd); + ServerInstance->AddCommand(&cmd); } Version GetVersion() diff --git a/include/modules.h b/include/modules.h index 06c0f1dd5..21a6a8f19 100644 --- a/include/modules.h +++ b/include/modules.h @@ -434,7 +434,7 @@ class CoreExport Module : public Extensible * @param Me An instance of the InspIRCd class which will be saved into ServerInstance for your use * \exception ModuleException Throwing this class, or any class derived from ModuleException, causes loading of the module to abort. */ - Module(InspIRCd* Me); + Module(InspIRCd* Me = ServerInstance); /** Default destructor. * destroys a module class @@ -1391,7 +1391,6 @@ class CoreExport Module : public Extensible class CoreExport ConfigReader : public classbase { protected: - InspIRCd* ServerInstance; /** Error code */ long error; @@ -1401,7 +1400,7 @@ class CoreExport ConfigReader : public classbase * This constructor initialises the ConfigReader class to read the inspircd.conf file * as specified when running ./configure. */ - ConfigReader(InspIRCd* Instance); + ConfigReader(InspIRCd* Instance = ServerInstance); /** Default destructor. * This method destroys the ConfigReader class. */ @@ -1483,7 +1482,6 @@ class CoreExport ConfigReader : public classbase */ class CoreExport FileReader : public classbase { - InspIRCd* ServerInstance; /** The file contents */ file_cache fc; @@ -1501,7 +1499,7 @@ class CoreExport FileReader : public classbase * This method does not load any file into memory, you must use the LoadFile method * after constructing the class this way. */ - FileReader(InspIRCd* Instance); + FileReader(InspIRCd* Instance = ServerInstance); /** Secondary constructor. * This method initialises the class with a file loaded into it ready for GetLine and @@ -1587,10 +1585,6 @@ class CoreExport ModuleManager : public classbase */ int ModCount; - /** Our pointer to the main insp instance - */ - InspIRCd* Instance; - /** List of loaded modules and shared object/dll handles * keyed by module name */ @@ -1610,7 +1604,7 @@ class CoreExport ModuleManager : public classbase /** Simple, bog-standard, boring constructor. */ - ModuleManager(InspIRCd* Ins); + ModuleManager(); /** Destructor */ 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]; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 8f763e2b6..ce3bbc06b 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -408,7 +408,7 @@ InspIRCd::InspIRCd(int argc, char** argv) : this->Config = new ServerConfig(this); this->SNO = new SnomaskManager(this); this->BanCache = new BanCacheManager(this); - this->Modules = new ModuleManager(this); + this->Modules = new ModuleManager(); this->stats = new serverstats(); this->Timers = new TimerManager(this); this->Parser = new CommandParser(this); diff --git a/src/modules.cpp b/src/modules.cpp index 32d75f60e..e382f145e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -200,7 +200,7 @@ void Module::OnHookIO(EventHandler*, ListenSocketBase*) { } ModResult Module::OnHostCycle(User*) { return MOD_RES_PASSTHRU; } void Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { } -ModuleManager::ModuleManager(InspIRCd* Ins) : ModCount(0), Instance(Ins) +ModuleManager::ModuleManager() : ModCount(0) { } @@ -379,7 +379,7 @@ bool ModuleManager::Load(const char* filename) if (strchr(filename,'*') || (strchr(filename,'?'))) { int n_match = 0; - DIR* library = opendir(Instance->Config->ModPath.c_str()); + DIR* library = opendir(ServerInstance->Config->ModPath.c_str()); if (library) { /* Try and locate and load all modules matching the pattern */ @@ -402,20 +402,20 @@ bool ModuleManager::Load(const char* filename) } char modfile[MAXBUF]; - snprintf(modfile,MAXBUF,"%s/%s",Instance->Config->ModPath.c_str(),filename); + snprintf(modfile,MAXBUF,"%s/%s",ServerInstance->Config->ModPath.c_str(),filename); std::string filename_str = filename; if (!ServerConfig::FileExists(modfile)) { LastModuleError = "Module file could not be found: " + filename_str; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } if (Modules.find(filename_str) != Modules.end()) { LastModuleError = "Module " + filename_str + " is already loaded, cannot load a module twice!"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -427,7 +427,7 @@ bool ModuleManager::Load(const char* filename) /* This will throw a CoreException if there's a problem loading * the module file or getting a pointer to the init_module symbol. */ - newhandle = new ircd_module(Instance, modfile, "init_module"); + newhandle = new ircd_module(ServerInstance, modfile, "init_module"); newmod = newhandle->CallInit(); if (newmod) @@ -441,12 +441,12 @@ bool ModuleManager::Load(const char* filename) delete newmod; delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Incorrect module API version: " + ConvToStr(v.API) + " (our version: " + ConvToStr(API_VERSION) + ")"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } else { - Instance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %s)%s", filename, v.API, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); + ServerInstance->Logs->Log("MODULE", DEFAULT,"New module introduced: %s (API version %d, Module version %s)%s", filename, v.API, v.version.c_str(), (!(v.Flags & VF_VENDOR) ? " [3rd Party]" : " [Vendor]")); } Modules[filename_str] = std::make_pair(newhandle, newmod); @@ -455,7 +455,7 @@ bool ModuleManager::Load(const char* filename) { delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Probably missing init_module() entrypoint, but dlsym() didn't notice a problem"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } } @@ -468,7 +468,7 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Error when loading: " + modexcept.GetReason(); - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } catch (FindSymbolException& modexcept) @@ -479,7 +479,7 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": Error finding symbol: " + modexcept.GetReason(); - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } catch (CoreException& modexcept) @@ -490,12 +490,12 @@ bool ModuleManager::Load(const char* filename) if (newhandle) delete newhandle; LastModuleError = "Unable to load " + filename_str + ": " + modexcept.GetReason(); - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } this->ModCount++; - FOREACH_MOD_I(Instance,I_OnLoadModule,OnLoadModule(newmod, filename_str)); + FOREACH_MOD_I(ServerInstance,I_OnLoadModule,OnLoadModule(newmod, filename_str)); /* We give every module a chance to re-prioritize when we introduce a new one, * not just the one thats loading, as the new module could affect the preference @@ -510,10 +510,10 @@ bool ModuleManager::Load(const char* filename) if (prioritizationState == PRIO_STATE_LAST) break; if (tries == 19) - Instance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + filename_str); + ServerInstance->Logs->Log("MODULE", DEFAULT, "Hook priority dependency loop detected while loading " + filename_str); } - Instance->BuildISupport(); + ServerInstance->BuildISupport(); return true; } @@ -527,50 +527,50 @@ bool ModuleManager::Unload(const char* filename) if (modfind->second.second->GetVersion().Flags & VF_STATIC) { LastModuleError = "Module " + filename_str + " not unloadable (marked static)"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } std::pair<int,std::string> intercount = GetInterfaceInstanceCount(modfind->second.second); if (intercount.first > 0) { LastModuleError = "Failed to unload module " + filename_str + ", being used by " + ConvToStr(intercount.first) + " other(s) via interface '" + intercount.second + "'"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } /* Give the module a chance to tidy out all its metadata */ - for (chan_hash::iterator c = Instance->chanlist->begin(); c != Instance->chanlist->end(); c++) + for (chan_hash::iterator c = ServerInstance->chanlist->begin(); c != ServerInstance->chanlist->end(); c++) { modfind->second.second->OnCleanup(TYPE_CHANNEL,c->second); } - for (user_hash::iterator u = Instance->Users->clientlist->begin(); u != Instance->Users->clientlist->end(); u++) + for (user_hash::iterator u = ServerInstance->Users->clientlist->begin(); u != ServerInstance->Users->clientlist->end(); u++) { modfind->second.second->OnCleanup(TYPE_USER,u->second); } /* Tidy up any dangling resolvers */ - Instance->Res->CleanResolvers(modfind->second.second); + ServerInstance->Res->CleanResolvers(modfind->second.second); - FOREACH_MOD_I(Instance,I_OnUnloadModule,OnUnloadModule(modfind->second.second, modfind->first)); + FOREACH_MOD_I(ServerInstance,I_OnUnloadModule,OnUnloadModule(modfind->second.second, modfind->first)); this->DetachAll(modfind->second.second); - Instance->Parser->RemoveCommands(modfind->second.second); + ServerInstance->Parser->RemoveCommands(modfind->second.second); Extensible::UnRegister(modfind->second.second); delete modfind->second.second; delete modfind->second.first; Modules.erase(modfind); - Instance->Logs->Log("MODULE", DEFAULT,"Module %s unloaded",filename); + ServerInstance->Logs->Log("MODULE", DEFAULT,"Module %s unloaded",filename); this->ModCount--; - Instance->BuildISupport(); + ServerInstance->BuildISupport(); return true; } LastModuleError = "Module " + filename_str + " is not loaded, cannot unload it!"; - Instance->Logs->Log("MODULE", DEFAULT, LastModuleError); + ServerInstance->Logs->Log("MODULE", DEFAULT, LastModuleError); return false; } @@ -583,7 +583,7 @@ void ModuleManager::LoadAll() printf("\nLoading core commands"); fflush(stdout); - DIR* library = opendir(Instance->Config->ModPath.c_str()); + DIR* library = opendir(ServerInstance->Config->ModPath.c_str()); if (library) { dirent* entry = NULL; @@ -596,9 +596,9 @@ void ModuleManager::LoadAll() if (!Load(entry->d_name)) { - Instance->Logs->Log("MODULE", DEFAULT, this->LastError()); + ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); - Instance->Exit(EXIT_STATUS_MODULE); + ServerInstance->Exit(EXIT_STATUS_MODULE); } } } @@ -606,16 +606,16 @@ void ModuleManager::LoadAll() printf("\n"); } - for(int count = 0; count < Instance->Config->ConfValueEnum("module"); count++) + for(int count = 0; count < ServerInstance->Config->ConfValueEnum("module"); count++) { - Instance->Config->ConfValue("module", "name", count, configToken, MAXBUF); + ServerInstance->Config->ConfValue("module", "name", count, configToken, MAXBUF); printf_c("[\033[1;32m*\033[0m] Loading module:\t\033[1;32m%s\033[0m\n",configToken); if (!this->Load(configToken)) { - Instance->Logs->Log("MODULE", DEFAULT, this->LastError()); + ServerInstance->Logs->Log("MODULE", DEFAULT, this->LastError()); printf_c("\n[\033[1;31m*\033[0m] %s\n\n", this->LastError().c_str()); - Instance->Exit(EXIT_STATUS_MODULE); + ServerInstance->Exit(EXIT_STATUS_MODULE); } } } @@ -874,7 +874,7 @@ const std::vector<std::string> ModuleManager::GetAllModuleNames(int filter) return retval; } -ConfigReader::ConfigReader(InspIRCd* Instance) : ServerInstance(Instance) +ConfigReader::ConfigReader(InspIRCd* Instance) { this->error = 0; } @@ -954,12 +954,12 @@ int ConfigReader::EnumerateValues(const std::string &tag, int index) return ServerInstance->Config->ConfVarEnum(tag, index); } -FileReader::FileReader(InspIRCd* Instance, const std::string &filename) : ServerInstance(Instance) +FileReader::FileReader(InspIRCd* Instance, const std::string &filename) { LoadFile(filename); } -FileReader::FileReader(InspIRCd* Instance) : ServerInstance(Instance) +FileReader::FileReader(InspIRCd* Instance) { } diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp index 063e18798..abf3c0b1b 100644 --- a/src/modules/m_alltime.cpp +++ b/src/modules/m_alltime.cpp @@ -18,9 +18,9 @@ class CommandAlltime : public Command { public: - CommandAlltime(InspIRCd *Instance, Module* Creator) : Command(Instance, Creator, "ALLTIME", "o", 0) + CommandAlltime(Module* Creator) : Command(Creator, "ALLTIME", 0) { - syntax.clear(); + flags_needed = 'o'; syntax.clear(); translation.push_back(TR_END); } @@ -50,7 +50,7 @@ class Modulealltime : public Module CommandAlltime mycommand; public: Modulealltime(InspIRCd *Me) - : Module(Me), mycommand(Me, this) + : Module(Me), mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index dab0d3d43..9248a5a31 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -136,7 +136,7 @@ class CommandAccept : public Command public: CallerIDExtInfo extInfo; unsigned int maxaccepts; - CommandAccept(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "ACCEPT", 0, 1), + CommandAccept(Module* Creator) : Command(Creator, "ACCEPT", 1), extInfo(Creator) { syntax = "{[+|-]<nicks>}|*}"; @@ -342,7 +342,7 @@ private: } public: - ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(Me, this), myumode(Me, this) + ModuleCallerID(InspIRCd* Me) : Module(Me), cmd(this), myumode(Me, this) { OnRehash(NULL); diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 160c7a9c9..355c6d0fb 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -36,9 +36,10 @@ class CommandCAP : public Command { public: LocalIntExt reghold; - CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true), + CommandCAP (Module* mod) : Command(mod, "CAP", 1), reghold("CAP_REGHOLD", mod) { + works_before_reg = true; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -68,7 +69,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_req"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); if (Data.ack.size() > 0) { @@ -96,7 +97,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); std::string Result; if (Data.wanted.size() > 0) @@ -116,7 +117,7 @@ class CommandCAP : public Command reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_clear"); - event.Send(this->ServerInstance); + event.Send(ServerInstance); std::string Result = irc::stringjoiner(" ", Data.ack, 0, Data.ack.size() - 1).GetJoined(); user->WriteServ("CAP * ACK :%s", Result.c_str()); @@ -135,7 +136,7 @@ class ModuleCAP : public Module CommandCAP cmd; public: ModuleCAP(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.reghold); diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 025540d9f..d5e62c98b 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -84,9 +84,9 @@ class CBanFactory : public XLineFactory class CommandCBan : public Command { public: - CommandCBan(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "CBAN", "o", 1, 3) + CommandCBan(Module* Creator) : Command(Creator, "CBAN", 1, 3) { - this->syntax = "<channel> [<duration> :<reason>]"; + flags_needed = 'o'; this->syntax = "<channel> [<duration> :<reason>]"; TRANSLATE4(TR_TEXT,TR_TEXT,TR_TEXT,TR_END); } @@ -166,7 +166,7 @@ class ModuleCBan : public Module CBanFactory f; public: - ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(Me, this), f(Me) + ModuleCBan(InspIRCd* Me) : Module(Me), mycommand(this), f(Me) { ServerInstance->XLines->RegisterFactory(&f); diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index c72e18390..3dc7c627d 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -61,11 +61,12 @@ class CommandWebirc : public Command LocalStringExt webirc_ip; CGIHostlist Hosts; - CommandWebirc(InspIRCd* Instance, Module* Creator, bool bnotify) - : Command(Instance, Creator, "WEBIRC", 0, 4, true), notify(bnotify), + CommandWebirc(Module* Creator, bool bnotify) + : Command(Creator, "WEBIRC", 4), notify(bnotify), realhost("cgiirc_realhost", Creator), realip("cgiirc_realip", Creator), webirc_hostname("cgiirc_webirc_hostname", Creator), webirc_ip("cgiirc_webirc_ip", Creator) { + works_before_reg = true; this->syntax = "password client hostname ip"; } CmdResult Handle(const std::vector<std::string> ¶meters, User *user) @@ -145,7 +146,7 @@ class ModuleCgiIRC : public Module CommandWebirc cmd; bool NotifyOpers; public: - ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(Me, this, NotifyOpers) + ModuleCgiIRC(InspIRCd* Me) : Module(Me), cmd(this, NotifyOpers) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 847e9d5c9..a84bd4dc6 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -20,9 +20,9 @@ class CommandCheck : public Command { public: - CommandCheck (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"CHECK", "o", 1) + CommandCheck(Module* parent) : Command(parent,"CHECK", 1) { - syntax = "<nickname>|<ip>|<hostmask>|<channel> <server>"; + flags_needed = 'o'; syntax = "<nickname>|<ip>|<hostmask>|<channel> <server>"; } std::string timestring(time_t time) @@ -198,7 +198,7 @@ class ModuleCheck : public Module private: CommandCheck mycommand; public: - ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(Me, this) + ModuleCheck(InspIRCd* Me) : Module(Me), mycommand(this) { ServerInstance->AddCommand(&mycommand); } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 0d509b7d9..ef3155cb6 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -22,9 +22,9 @@ class CommandChghost : public Command private: char* hostmap; public: - CommandChghost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"CHGHOST","o",2), hostmap(hmap) + CommandChghost(Module* Creator, char* hmap) : Command(Creator,"CHGHOST", 2), hostmap(hmap) { - syntax = "<nick> <newhost>"; + flags_needed = 'o'; syntax = "<nick> <newhost>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -86,8 +86,7 @@ class ModuleChgHost : public Module CommandChghost cmd; char hostmap[256]; public: - ModuleChgHost(InspIRCd* Me) - : Module(Me), cmd(Me, this, hostmap) + ModuleChgHost(InspIRCd* Me) : cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index d52691054..b570feb46 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -20,9 +20,9 @@ class CommandChgident : public Command { public: - CommandChgident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGIDENT", "o", 2) + CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2) { - syntax = "<nick> <newident>"; + flags_needed = 'o'; syntax = "<nick> <newident>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -80,7 +80,7 @@ class ModuleChgIdent : public Module CommandChgident cmd; public: - ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleChgIdent(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 0f9302a76..11e7f4c9c 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -20,9 +20,9 @@ class CommandChgname : public Command { public: - CommandChgname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CHGNAME", "o", 2, 2) + CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2) { - syntax = "<nick> <newname>"; + flags_needed = 'o'; syntax = "<nick> <newname>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -72,7 +72,7 @@ class ModuleChgName : public Module CommandChgname cmd; public: - ModuleChgName(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleChgName(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp index 407ef7ef3..5a96a08a7 100644 --- a/src/modules/m_clones.cpp +++ b/src/modules/m_clones.cpp @@ -20,9 +20,9 @@ class CommandClones : public Command { public: - CommandClones (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLONES", "o", 1) + CommandClones(Module* Creator) : Command(Creator,"CLONES", 1) { - syntax = "<limit>"; + flags_needed = 'o'; syntax = "<limit>"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -61,7 +61,7 @@ class ModuleClones : public Module private: CommandClones cmd; public: - ModuleClones(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleClones(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_close.cpp b/src/modules/m_close.cpp index 1da88c3d5..e81c29d20 100644 --- a/src/modules/m_close.cpp +++ b/src/modules/m_close.cpp @@ -29,9 +29,9 @@ class CommandClose : public Command { public: /* Command 'close', needs operator */ - CommandClose (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CLOSE", "o", 0) + CommandClose(Module* Creator) : Command(Creator,"CLOSE", 0) { - } + flags_needed = 'o'; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) { @@ -67,7 +67,7 @@ class ModuleClose : public Module CommandClose cmd; public: ModuleClose(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index fc99cd29f..aa5749a04 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -21,7 +21,7 @@ class CommandTitle : public Command { public: StringExtItem ctitle; - CommandTitle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TITLE",0,2), + CommandTitle(Module* Creator) : Command(Creator,"TITLE", 2), ctitle("ctitle", Creator) { syntax = "<user> <password>"; @@ -86,7 +86,7 @@ class ModuleCustomTitle : public Module CommandTitle cmd; public: - ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleCustomTitle(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Extensible::Register(&cmd.ctitle); diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 8caa07b62..55548be95 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -20,9 +20,9 @@ class CommandCycle : public Command { public: - CommandCycle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"CYCLE", 0, 1, false, 3) + CommandCycle(Module* Creator) : Command(Creator,"CYCLE", 1) { - syntax = "<channel> :[reason]"; + Penalty = 3; syntax = "<channel> :[reason]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -81,7 +81,7 @@ class ModuleCycle : public Module CommandCycle cmd; public: ModuleCycle(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index a61582629..fb6847872 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -48,7 +48,7 @@ SimpleExtItem<dccallowlist>* ext; class CommandDccallow : public Command { public: - CommandDccallow(InspIRCd* Me, Module* parent) : Command(Me, parent, "DCCALLOW", 0, 0) + CommandDccallow(Module* parent) : Command(parent, "DCCALLOW", 0) { syntax = "{[+|-]<nick> <time>|HELP|LIST}"; /* XXX we need to fix this so it can work with translation stuff (i.e. move +- into a seperate param */ @@ -240,7 +240,7 @@ class ModuleDCCAllow : public Module public: ModuleDCCAllow(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { Conf = new ConfigReader(ServerInstance); ext = new SimpleExtItem<dccallowlist>("dccallow", this); diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp index ff85dbd67..edc2140e8 100644 --- a/src/modules/m_devoice.cpp +++ b/src/modules/m_devoice.cpp @@ -25,7 +25,7 @@ class CommandDevoice : public Command { public: - CommandDevoice (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"DEVOICE", 0, 1) + CommandDevoice(Module* Creator) : Command(Creator,"DEVOICE", 1) { syntax = "<channel>"; TRANSLATE2(TR_TEXT, TR_END); @@ -54,7 +54,7 @@ class ModuleDeVoice : public Module { CommandDevoice cmd; public: - ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleDeVoice(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index b2986e436..35b72d24c 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -101,9 +101,10 @@ class CommandFilter : public Command { FilterBase* Base; public: - CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) - : Command(Me, reinterpret_cast<Module*>(f), "FILTER", "o", 1, 5), Base(f) + CommandFilter(FilterBase* f, const std::string &ssource) + : Command(reinterpret_cast<Module*>(f), "FILTER", 1, 5), Base(f) { + flags_needed = 'o'; this->syntax = "<filter-definition> <action> <flags> [<gline-duration>] :<reason>"; } CmdResult Handle(const std::vector<std::string>&, User*); @@ -241,7 +242,7 @@ bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags) return true; } -FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, Me, source) +FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me), filtcommand(this, source) { Me->Modules->UseInterface("RegularExpression"); ServerInstance->AddCommand(&filtcommand); diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 817e9cdfc..229a79b97 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -20,9 +20,9 @@ class CommandGloadmodule : public Command { public: - CommandGloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GLOADMODULE", "o", 1) + CommandGloadmodule(Module* Creator) : Command(Creator,"GLOADMODULE", 1) { - syntax = "<modulename> [servermask]"; + flags_needed = 'o'; syntax = "<modulename> [servermask]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -59,9 +59,9 @@ class CommandGloadmodule : public Command class CommandGunloadmodule : public Command { public: - CommandGunloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GUNLOADMODULE", "o", 1) + CommandGunloadmodule(Module* Creator) : Command(Creator,"GUNLOADMODULE", 1) { - syntax = "<modulename> [servermask]"; + flags_needed = 'o'; syntax = "<modulename> [servermask]"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -97,9 +97,9 @@ class CommandGunloadmodule : public Command class CommandGreloadmodule : public Command { public: - CommandGreloadmodule (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "GRELOADMODULE", "o", 1) + CommandGreloadmodule(Module* Creator) : Command(Creator, "GRELOADMODULE", 1) { - syntax = "<modulename> [servermask]"; + flags_needed = 'o'; syntax = "<modulename> [servermask]"; } CmdResult Handle(const std::vector<std::string> ¶meters, User *user) @@ -143,7 +143,7 @@ class ModuleGlobalLoad : public Module public: ModuleGlobalLoad(InspIRCd* Me) - : Module(Me), cmd1(Me, this), cmd2(Me, this), cmd3(Me, this) + : Module(Me), cmd1(this), cmd2(this), cmd3(this) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index fafe19e6e..3798828a7 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -22,9 +22,9 @@ class CommandGlobops : public Command { public: - CommandGlobops (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"GLOBOPS","o",1,1) + CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1) { - syntax = "<any-text>"; + flags_needed = 'o'; syntax = "<any-text>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -52,7 +52,7 @@ class ModuleGlobops : public Module CommandGlobops cmd; public: ModuleGlobops(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->SNO->EnableSnomask('g',"GLOBOPS"); diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 30dd8bcb4..2ff22d4d3 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -55,7 +55,7 @@ class Helpop : public ModeHandler class CommandHelpop : public Command { public: - CommandHelpop (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "HELPOP", 0, 0) + CommandHelpop(Module* Creator) : Command(Creator, "HELPOP", 0) { syntax = "<any-text>"; } @@ -121,7 +121,7 @@ class ModuleHelpop : public Module public: ModuleHelpop(InspIRCd* Me) - : Module(Me), cmd(Me, this), ho(Me, this) + : Module(Me), cmd(this), ho(Me, this) { ReadConfig(); if (!ServerInstance->Modes->AddMode(&ho)) diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index d8492fd5e..6dd8de99a 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -27,9 +27,9 @@ class CommandJumpserver : public Command std::string reason; int port; - CommandJumpserver (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "JUMPSERVER", "o", 0, 4) + CommandJumpserver(Module* Creator) : Command(Creator, "JUMPSERVER", 0, 4) { - syntax = "[<server> <port> <+/-an> <reason>]"; + flags_needed = 'o'; syntax = "[<server> <port> <+/-an> <reason>]"; redirect_to.clear(); reason.clear(); port = 0; @@ -135,8 +135,7 @@ class ModuleJumpServer : public Module { CommandJumpserver js; public: - ModuleJumpServer(InspIRCd* Me) - : Module(Me), js(Me, this) + ModuleJumpServer(InspIRCd* Me) : js(this) { ServerInstance->AddCommand(&js); Implementation eventlist[] = { I_OnUserRegister }; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 718974908..46350d59d 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -20,7 +20,7 @@ class CommandKnock : public Command { public: - CommandKnock (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"KNOCK", 0, 2) + CommandKnock(Module* Creator) : Command(Creator,"KNOCK", 2) { syntax = "<channel> <reason>"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); @@ -85,7 +85,7 @@ class ModuleKnock : public Module CommandKnock cmd; Knock kn; public: - ModuleKnock(InspIRCd* Me) : Module(Me), cmd(Me, this), kn(Me, this) + ModuleKnock(InspIRCd* Me) : Module(Me), cmd(this), kn(Me, this) { if (!ServerInstance->Modes->AddMode(&kn)) throw ModuleException("Could not add new modes!"); diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index ce3ab4c2b..7fa9d4c10 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -25,10 +25,9 @@ class CommandLockserv : public Command { bool& locked; public: - CommandLockserv (InspIRCd* Instance, Module* Creator, bool& lock) - : Command(Instance, Creator, "LOCKSERV", "o", 0), locked(lock) + CommandLockserv(Module* Creator, bool& lock) : Command(Creator, "LOCKSERV", 0), locked(lock) { - syntax.clear(); + flags_needed = 'o'; syntax.clear(); } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -47,10 +46,9 @@ private: bool& locked; public: - CommandUnlockserv (InspIRCd* Instance, Module* Creator, bool &lock) - : Command(Instance, Creator, "UNLOCKSERV", "o", 0), locked(lock) + CommandUnlockserv(Module* Creator, bool &lock) : Command(Creator, "UNLOCKSERV", 0), locked(lock) { - syntax.clear(); + flags_needed = 'o'; syntax.clear(); } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -76,7 +74,7 @@ private: } public: - ModuleLockserv(InspIRCd* Me) : Module(Me), lockcommand(Me, this, locked), unlockcommand(Me, this, locked) + ModuleLockserv(InspIRCd* Me) : lockcommand(this, locked), unlockcommand(this, locked) { ResetLocked(); ServerInstance->AddCommand(&lockcommand); diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 9a3eb3222..c10b9c798 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -21,9 +21,10 @@ class CommandNicklock : public Command { public: LocalIntExt& locked; - CommandNicklock (Module* Creator, LocalIntExt& ext) : Command(ServerInstance, Creator,"NICKLOCK", "o", 2), + CommandNicklock (Module* Creator, LocalIntExt& ext) : Command(Creator,"NICKLOCK", 2), locked(ext) { + flags_needed = 'o'; syntax = "<oldnick> <newnick>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -89,9 +90,10 @@ class CommandNickunlock : public Command { public: LocalIntExt& locked; - CommandNickunlock (Module* Creator, LocalIntExt& ext) : Command(ServerInstance, Creator,"NICKUNLOCK", "o", 1), + CommandNickunlock (Module* Creator, LocalIntExt& ext) : Command(Creator,"NICKUNLOCK", 1), locked(ext) { + flags_needed = 'o'; syntax = "<locked-nick>"; TRANSLATE2(TR_NICK, TR_END); } diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index a5b4b6ffb..b8c12f00a 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -43,9 +43,9 @@ class CommandOjoin : public Command { public: bool active; - CommandOjoin (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"OJOIN", "o", 1, false, 0) + CommandOjoin(Module* parent) : Command(parent,"OJOIN", 1) { - syntax = "<channel>"; + flags_needed = 'o'; Penalty = 0; syntax = "<channel>"; active = false; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -236,7 +236,7 @@ class ModuleOjoin : public Module public: ModuleOjoin(InspIRCd* Me) - : Module(Me), np(NULL), mycommand(Me, this) + : Module(Me), np(NULL), mycommand(this) { /* Load config stuff */ OnRehash(NULL); diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index 6eb3a0540..87e8874e3 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -43,9 +43,9 @@ CmdResult ShowOperMOTD(User* user) class CommandOpermotd : public Command { public: - CommandOpermotd (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"OPERMOTD", "o", 0) + CommandOpermotd(Module* Creator) : Command(Creator,"OPERMOTD", 0) { - syntax = "[<servername>]"; + flags_needed = 'o'; syntax = "[<servername>]"; } CmdResult Handle (const std::vector<std::string>& parameters, User* user) @@ -77,7 +77,7 @@ class ModuleOpermotd : public Module } ModuleOpermotd(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { opermotd = NULL; ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index 94134e45e..61bc742c2 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -26,8 +26,7 @@ class CommandMkpasswd : public Command hashymodules &hashers; std::deque<std::string> &names; public: - CommandMkpasswd (InspIRCd* Instance, Module* Creator, hashymodules &h, std::deque<std::string> &n) - : Command(Instance, Creator, "MKPASSWD", 0, 2), hashers(h), names(n) + CommandMkpasswd(Module* Creator, hashymodules &h, std::deque<std::string> &n) : Command(Creator, "MKPASSWD", 2), hashers(h), names(n) { syntax = "<hashtype> <any-text>"; } @@ -77,7 +76,7 @@ class ModuleOperHash : public Module public: ModuleOperHash(InspIRCd* Me) - : Module(Me), cmd(Me, this, hashers, names) + : Module(Me), cmd(this, hashers, names) { diduseiface = false; diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index fcdfa0226..3b8214865 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -26,7 +26,7 @@ std::string suffix; class CommandRandquote : public Command { public: - CommandRandquote (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"RANDQUOTE", 0, 0) + CommandRandquote(Module* Creator) : Command(Creator,"RANDQUOTE", 0) { } @@ -58,7 +58,7 @@ class ModuleRandQuote : public Module ConfigReader *conf; public: ModuleRandQuote(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { conf = new ConfigReader(ServerInstance); diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index d17deb742..70440e59d 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -29,8 +29,8 @@ class RemoveBase : public Command bool& supportnokicks; public: - RemoveBase(InspIRCd* Instance, Module* Creator, bool& snk, const char* cmdn, const char* a, int b, int c, bool d, int e) - : Command(Instance, Creator, cmdn, a,b,c,d,e), supportnokicks(snk) + RemoveBase(Module* Creator, bool& snk, const char* cmdn) + : Command(Creator, cmdn, 2, 2), supportnokicks(snk) { } @@ -132,8 +132,8 @@ class RemoveBase : public Command class CommandRemove : public RemoveBase { public: - CommandRemove(InspIRCd* Instance, Module* Creator, bool& snk) - : RemoveBase(Instance, Creator, snk, "REMOVE", 0, 2, 2, false, 0) + CommandRemove(Module* Creator, bool& snk) + : RemoveBase(Creator, snk, "REMOVE") { syntax = "<nick> <channel> [<reason>]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); @@ -158,8 +158,8 @@ class CommandRemove : public RemoveBase class CommandFpart : public RemoveBase { public: - CommandFpart(InspIRCd* Instance, Module* Creator, bool& snk) - : RemoveBase(Instance, Creator, snk, "FPART", 0, 2, 2, false, 0) + CommandFpart(Module* Creator, bool& snk) + : RemoveBase(Creator, snk, "FPART") { syntax = "<channel> <nick> [<reason>]"; TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); @@ -187,8 +187,7 @@ class ModuleRemove : public Module public: - ModuleRemove(InspIRCd* Me) - : Module(Me), cmd1(Me, this, supportnokicks), cmd2(Me, this, supportnokicks) + ModuleRemove(InspIRCd*) : cmd1(this, supportnokicks), cmd2(this, supportnokicks) { ServerInstance->AddCommand(&cmd1); ServerInstance->AddCommand(&cmd2); diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 007ac0246..f3f27a9fb 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -121,9 +121,9 @@ class CommandRLine : public Command std::string rxengine; public: - CommandRLine (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"RLINE", "o", 1, 3) + CommandRLine(Module* Creator) : Command(Creator,"RLINE", 1, 3) { - this->syntax = "<regex> [<rline-duration>] :<reason>"; + flags_needed = 'o'; this->syntax = "<regex> [<rline-duration>] :<reason>"; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -198,7 +198,7 @@ class ModuleRLine : public Module std::string RegexEngine; public: - ModuleRLine(InspIRCd* Me) : Module(Me), r(Me, this), f(Me) + ModuleRLine(InspIRCd* Me) : Module(Me), r(this), f(Me) { mymodule = this; OnRehash(NULL); diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 221c49328..bf1cbe450 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -20,9 +20,9 @@ class CommandSajoin : public Command { public: - CommandSajoin (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAJOIN", "o", 2, false, 0) + CommandSajoin(Module* Creator) : Command(Creator,"SAJOIN", 2) { - syntax = "<nick> <channel>"; + flags_needed = 'o'; Penalty = 0; syntax = "<nick> <channel>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -98,7 +98,7 @@ class ModuleSajoin : public Module CommandSajoin cmd; public: ModuleSajoin(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index 8b94c934c..d8eda0956 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -20,9 +20,9 @@ class CommandSakick : public Command { public: - CommandSakick (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAKICK", "o", 2, 3, false, 0) + CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3) { - syntax = "<channel> <nick> [reason]"; + flags_needed = 'o'; Penalty = 0; syntax = "<channel> <nick> [reason]"; TRANSLATE4(TR_TEXT, TR_NICK, TR_TEXT, TR_END); } @@ -98,7 +98,7 @@ class ModuleSakick : public Module CommandSakick cmd; public: ModuleSakick(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 2a185680d..92894f5b8 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -21,9 +21,9 @@ class CommandSamode : public Command { public: bool active; - CommandSamode (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAMODE", "o", 2, false, 0) + CommandSamode(Module* Creator) : Command(Creator,"SAMODE", 2) { - syntax = "<target> <modes> {<mode-parameters>}"; + flags_needed = 'o'; Penalty = 0; syntax = "<target> <modes> {<mode-parameters>}"; active = false; } @@ -43,7 +43,7 @@ class ModuleSaMode : public Module CommandSamode cmd; public: ModuleSaMode(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); ServerInstance->Modules->Attach(I_OnPreMode, this); diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 51797892d..82d1fd3a5 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -20,9 +20,9 @@ class CommandSanick : public Command { public: - CommandSanick (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SANICK", "o", 2, false, 0) + CommandSanick(Module* Creator) : Command(Creator,"SANICK", 2) { - syntax = "<nick> <new-nick>"; + flags_needed = 'o'; Penalty = 0; syntax = "<nick> <new-nick>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -87,7 +87,7 @@ class ModuleSanick : public Module CommandSanick cmd; public: ModuleSanick(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 0c0ac7e13..576ec6e7b 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -20,9 +20,9 @@ class CommandSapart : public Command { public: - CommandSapart (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SAPART", "o", 2, 3, false, 0) + CommandSapart(Module* Creator) : Command(Creator,"SAPART", 2, 3) { - syntax = "<nick> <channel> [reason]"; + flags_needed = 'o'; Penalty = 0; syntax = "<nick> <channel> [reason]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } @@ -98,7 +98,7 @@ class ModuleSapart : public Module CommandSapart cmd; public: ModuleSapart(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index cbd7dfc77..ee49b37ef 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -20,9 +20,9 @@ class CommandSaquit : public Command { public: - CommandSaquit (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "SAQUIT", "o", 2, 2, false, 0) + CommandSaquit(Module* Creator) : Command(Creator, "SAQUIT", 2, 2) { - syntax = "<nick> <reason>"; + flags_needed = 'o'; Penalty = 0; syntax = "<nick> <reason>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -67,7 +67,7 @@ class ModuleSaquit : public Module CommandSaquit cmd; public: ModuleSaquit(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 6c439bc86..8a4d772cc 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -152,9 +152,10 @@ class CommandAuthenticate : public Command public: SimpleExtItem<SaslAuthenticator>& authExt; GenericCap& cap; - CommandAuthenticate (InspIRCd* Instance, Module* Creator, SimpleExtItem<SaslAuthenticator>& ext, GenericCap& Cap) - : Command(Instance, Creator, "AUTHENTICATE", 0, 1, true), authExt(ext), cap(Cap) + CommandAuthenticate(Module* Creator, SimpleExtItem<SaslAuthenticator>& ext, GenericCap& Cap) + : Command(Creator, "AUTHENTICATE", 1), authExt(ext), cap(Cap) { + works_before_reg = true; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -182,8 +183,7 @@ class CommandSASL : public Command { public: SimpleExtItem<SaslAuthenticator>& authExt; - CommandSASL(InspIRCd* Instance, Module* Creator, SimpleExtItem<SaslAuthenticator>& ext) - : Command(Instance, Creator, "SASL", 0, 2), authExt(ext) + CommandSASL(Module* Creator, SimpleExtItem<SaslAuthenticator>& ext) : Command(Creator, "SASL", 2), authExt(ext) { this->disabled = true; // should not be called by users } @@ -224,7 +224,7 @@ class ModuleSASL : public Module CommandSASL sasl; public: ModuleSASL(InspIRCd* Me) - : Module(Me), authExt("sasl_auth", this), cap(this, "sasl"), auth(Me, this, authExt, cap), sasl(Me, this, authExt) + : Module(Me), authExt("sasl_auth", this), cap(this, "sasl"), auth(this, authExt, cap), sasl(this, authExt) { Implementation eventlist[] = { I_OnEvent, I_OnUserRegister, I_OnPostConnect, I_OnUserDisconnect, I_OnCleanup }; ServerInstance->Modules->Attach(eventlist, this, 5); diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 542e8f30d..3a68a98d8 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -20,10 +20,9 @@ class CommandSATopic : public Command { public: - CommandSATopic (InspIRCd* Instance, Module* Creator) - : Command(Instance,Creator,"SATOPIC", "o", 2, 2, false, 0) + CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2) { - syntax = "<target> <topic>"; + flags_needed = 'o'; Penalty = 0; syntax = "<target> <topic>"; } CmdResult Handle (const std::vector<std::string>& parameters, User *user) @@ -57,7 +56,7 @@ class ModuleSATopic : public Module CommandSATopic cmd; public: ModuleSATopic(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 8e397c0e1..af9443efd 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -22,9 +22,9 @@ class CommandSethost : public Command private: char* hostmap; public: - CommandSethost (InspIRCd* Instance, Module* Creator, char* hmap) : Command(Instance,Creator,"SETHOST","o",1), hostmap(hmap) + CommandSethost(Module* Creator, char* hmap) : Command(Creator,"SETHOST", 1), hostmap(hmap) { - syntax = "<new-hostname>"; + flags_needed = 'o'; syntax = "<new-hostname>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -67,7 +67,7 @@ class ModuleSetHost : public Module char hostmap[256]; public: ModuleSetHost(InspIRCd* Me) - : Module(Me), cmd(Me, this, hostmap) + : Module(Me), cmd(this, hostmap) { OnRehash(NULL); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp index 64fd0a689..26d4254b8 100644 --- a/src/modules/m_setident.cpp +++ b/src/modules/m_setident.cpp @@ -20,9 +20,9 @@ class CommandSetident : public Command { public: - CommandSetident (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETIDENT", "o", 1) + CommandSetident(Module* Creator) : Command(Creator,"SETIDENT", 1) { - syntax = "<new-ident>"; + flags_needed = 'o'; syntax = "<new-ident>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -59,7 +59,7 @@ class ModuleSetIdent : public Module CommandSetident cmd; public: - ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleSetIdent(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 17570d989..d5d397321 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -20,9 +20,9 @@ class CommandSetidle : public Command { public: - CommandSetidle (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETIDLE", "o", 1) + CommandSetidle(Module* Creator) : Command(Creator,"SETIDLE", 1) { - syntax = "<duration>"; + flags_needed = 'o'; syntax = "<duration>"; TRANSLATE2(TR_TEXT, TR_END); } @@ -51,7 +51,7 @@ class ModuleSetIdle : public Module CommandSetidle cmd; public: ModuleSetIdle(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 97bb1cfcf..49b0741f0 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -20,7 +20,7 @@ class CommandSetname : public Command { public: - CommandSetname (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SETNAME", 0, 1, 1) + CommandSetname(Module* Creator) : Command(Creator,"SETNAME", 1, 1) { syntax = "<new-gecos>"; TRANSLATE2(TR_TEXT, TR_END); @@ -56,7 +56,7 @@ class ModuleSetName : public Module CommandSetname cmd; public: ModuleSetName(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 8b55c3e96..e42e5fa36 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -20,7 +20,7 @@ class SeeWhois : public ModeHandler { public: - SeeWhois(InspIRCd* Instance, Module* Creator, bool IsOpersOnly) : ModeHandler(Creator, 'W', PARAM_NONE, MODETYPE_USER) + SeeWhois(Module* Creator, bool IsOpersOnly) : ModeHandler(Creator, 'W', PARAM_NONE, MODETYPE_USER) { oper = IsOpersOnly; } @@ -51,7 +51,7 @@ class SeeWhois : public ModeHandler class WhoisNoticeCmd : public Command { public: - WhoisNoticeCmd(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"WHOISNOTICE", 0, 1) + WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 1) { } @@ -81,13 +81,13 @@ class ModuleShowwhois : public Module public: - ModuleShowwhois(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleShowwhois(InspIRCd* Me) : cmd(this) { ConfigReader conf(ServerInstance); bool OpersOnly = conf.ReadFlag("showwhois", "opersonly", "yes", 0); ShowWhoisFromOpers = conf.ReadFlag("showwhois", "showfromopers", "yes", 0); - sw = new SeeWhois(ServerInstance, this, OpersOnly); + sw = new SeeWhois(this, OpersOnly); if (!ServerInstance->Modes->AddMode(sw)) throw ModuleException("Could not add new modes!"); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 3a5901028..193c39349 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -87,9 +87,9 @@ class ShunFactory : public XLineFactory class CommandShun : public Command { public: - CommandShun(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "SHUN", "o", 1, 3) + CommandShun(Module* Creator) : Command(Creator, "SHUN", 1, 3) { - this->syntax = "<nick!user@hostmask> [<shun-duration>] :<reason>"; + flags_needed = 'o'; this->syntax = "<nick!user@hostmask> [<shun-duration>] :<reason>"; } CmdResult Handle(const std::vector<std::string>& parameters, User *user) @@ -187,7 +187,7 @@ class ModuleShun : public Module bool affectopers; public: - ModuleShun(InspIRCd* Me) : Module(Me), cmd(Me, this), f(Me) + ModuleShun(InspIRCd* Me) : Module(Me), cmd(this), f(Me) { ServerInstance->XLines->RegisterFactory(&f); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 3b0709539..be1477a16 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -53,7 +53,7 @@ static int SILENCE_EXCLUDE = 0x0040; /* x exclude this pattern */ class CommandSVSSilence : public Command { public: - CommandSVSSilence(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSSILENCE", 0, 2) + CommandSVSSilence(Module* Creator) : Command(Creator,"SVSSILENCE", 2) { syntax = "<target> {[+|-]<mask> <p|c|i|n|t|a|x>}"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ @@ -94,7 +94,7 @@ class CommandSilence : public Command unsigned int& maxsilence; public: SimpleExtItem<silencelist> ext; - CommandSilence (InspIRCd* Instance, Module* Creator, unsigned int &max) : Command(Instance, Creator, "SILENCE", 0, 0), + CommandSilence(Module* Creator, unsigned int &max) : Command(Creator, "SILENCE", 0), maxsilence(max), ext("silence_list", Creator) { syntax = "{[+|-]<mask> <p|c|i|n|t|a|x>}"; @@ -271,7 +271,7 @@ class ModuleSilence : public Module public: ModuleSilence(InspIRCd* Me) - : Module(Me), maxsilence(32), cmdsilence(Me, this, maxsilence), cmdsvssilence(Me, this) + : Module(Me), maxsilence(32), cmdsilence(this, maxsilence), cmdsvssilence(this) { OnRehash(NULL); ServerInstance->AddCommand(&cmdsilence); diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index ee8c82c8b..8866e8d6d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -36,9 +36,9 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) { ServerInstance->Modules->UseInterface("BufferedSocketHook"); Utils = new SpanningTreeUtilities(ServerInstance, this); - command_rconnect = new CommandRConnect(ServerInstance, this, Utils); + command_rconnect = new CommandRConnect(this, Utils); ServerInstance->AddCommand(command_rconnect); - command_rsquit = new CommandRSQuit(ServerInstance, this, Utils); + command_rsquit = new CommandRSQuit(this, Utils); ServerInstance->AddCommand(command_rsquit); RefreshTimer = new CacheRefreshTimer(ServerInstance, Utils); ServerInstance->Timers->AddTimer(RefreshTimer); diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp index 1811d73a1..a62ef5cf3 100644 --- a/src/modules/m_spanningtree/rconnect.cpp +++ b/src/modules/m_spanningtree/rconnect.cpp @@ -26,9 +26,10 @@ /* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/rconnect.h */ -CommandRConnect::CommandRConnect (InspIRCd* Instance, Module* Creator, SpanningTreeUtilities* Util) - : Command(Instance, Creator, "RCONNECT", "o", 2), Utils(Util) +CommandRConnect::CommandRConnect (Module* Creator, SpanningTreeUtilities* Util) + : Command(Creator, "RCONNECT", 2), Utils(Util) { + flags_needed = 'o'; syntax = "<remote-server-mask> <target-server-mask>"; } diff --git a/src/modules/m_spanningtree/rconnect.h b/src/modules/m_spanningtree/rconnect.h index f038f5c22..dc62d231d 100644 --- a/src/modules/m_spanningtree/rconnect.h +++ b/src/modules/m_spanningtree/rconnect.h @@ -20,7 +20,7 @@ class CommandRConnect : public Command { SpanningTreeUtilities* Utils; /* Utility class */ public: - CommandRConnect (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); + CommandRConnect (Module* Callback, SpanningTreeUtilities* Util); CmdResult Handle (const std::vector<std::string>& parameters, User *user); }; diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp index 7de539905..25b3c54d1 100644 --- a/src/modules/m_spanningtree/rsquit.cpp +++ b/src/modules/m_spanningtree/rsquit.cpp @@ -24,9 +24,10 @@ /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h m_spanningtree/rsquit.h */ -CommandRSQuit::CommandRSQuit (InspIRCd* Instance, Module* Creator, SpanningTreeUtilities* Util) - : Command(Instance, Creator, "RSQUIT", "o", 1), Utils(Util) +CommandRSQuit::CommandRSQuit (Module* Creator, SpanningTreeUtilities* Util) + : Command(Creator, "RSQUIT", 1), Utils(Util) { + flags_needed = 'o'; syntax = "<target-server-mask> [reason]"; } diff --git a/src/modules/m_spanningtree/rsquit.h b/src/modules/m_spanningtree/rsquit.h index 92f6eb159..48abd5c5c 100644 --- a/src/modules/m_spanningtree/rsquit.h +++ b/src/modules/m_spanningtree/rsquit.h @@ -20,7 +20,7 @@ class CommandRSQuit : public Command { SpanningTreeUtilities* Utils; /* Utility class */ public: - CommandRSQuit (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util); + CommandRSQuit (Module* Callback, SpanningTreeUtilities* Util); CmdResult Handle (const std::vector<std::string>& parameters, User *user); void NoticeUser(User* user, const std::string &msg); }; diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 952fcf4a1..cca32d4da 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -72,7 +72,7 @@ class CommandSSLInfo : public Command public: SSLCertExt CertExt; - CommandSSLInfo(InspIRCd* Instance, Module* Creator) : Command(Instance, Creator, "SSLINFO", 0, 1), CertExt(Creator) + CommandSSLInfo(Module* Creator) : Command(Creator, "SSLINFO", 1), CertExt(Creator) { this->syntax = "<nick>"; } @@ -117,7 +117,7 @@ class ModuleSSLInfo : public Module public: ModuleSSLInfo(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index e8cd82806..cbe980d05 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -79,9 +79,9 @@ class SVSHoldFactory : public XLineFactory class CommandSvshold : public Command { public: - CommandSvshold(InspIRCd* Me, Module* Creator) : Command(Me, Creator, "SVSHOLD", "o", 1) + CommandSvshold(Module* Creator) : Command(Creator, "SVSHOLD", 1) { - this->syntax = "<nickname> [<duration> :<reason>]"; + flags_needed = 'o'; this->syntax = "<nickname> [<duration> :<reason>]"; TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END); } @@ -153,7 +153,7 @@ class ModuleSVSHold : public Module public: - ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(Me, this), s(Me) + ModuleSVSHold(InspIRCd* Me) : Module(Me), cmd(this), s(Me) { ServerInstance->XLines->RegisterFactory(&s); ServerInstance->AddCommand(&cmd); diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 918d00e14..272a73758 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -21,9 +21,9 @@ class CommandSwhois : public Command { public: StringExtItem swhois; - CommandSwhois (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SWHOIS","o",2,2), swhois("swhois", Creator) + CommandSwhois(Module* Creator) : Command(Creator,"SWHOIS", 2,2), swhois("swhois", Creator) { - syntax = "<nick> :<swhois>"; + flags_needed = 'o'; syntax = "<nick> :<swhois>"; Extensible::Register(&swhois); TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } @@ -75,7 +75,7 @@ class ModuleSWhois : public Module CommandSwhois cmd; public: - ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleSWhois(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_OnWhoisLine, I_OnPostCommand }; diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 11ff23a12..c4f8feafe 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -33,7 +33,7 @@ timedbans TimedBanList; class CommandTban : public Command { public: - CommandTban (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TBAN", 0, 3) + CommandTban(Module* Creator) : Command(Creator,"TBAN", 3) { syntax = "<channel> <duration> <banmask>"; TRANSLATE4(TR_TEXT, TR_TEXT, TR_TEXT, TR_END); @@ -119,7 +119,7 @@ class ModuleTimedBans : public Module CommandTban cmd; public: ModuleTimedBans(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); TimedBanList.clear(); diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp index b08d5b6c0..2d44a049a 100644 --- a/src/modules/m_tline.cpp +++ b/src/modules/m_tline.cpp @@ -20,9 +20,9 @@ class CommandTline : public Command { public: - CommandTline (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"TLINE", "o", 1) + CommandTline(Module* Creator) : Command(Creator,"TLINE", 1) { - this->syntax = "<mask>"; + flags_needed = 'o'; this->syntax = "<mask>"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -64,7 +64,7 @@ class ModuleTLine : public Module CommandTline cmd; public: ModuleTLine(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index e659ffa23..495ec0511 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -20,7 +20,7 @@ class CommandUninvite : public Command { public: - CommandUninvite (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"UNINVITE", 0, 2) + CommandUninvite(Module* Creator) : Command(Creator,"UNINVITE", 2) { syntax = "<nick> <channel>"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); @@ -87,7 +87,7 @@ class ModuleUninvite : public Module public: - ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleUninvite(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index c58f4a73b..ff4da2828 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -20,9 +20,9 @@ class CommandUserip : public Command { public: - CommandUserip (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"USERIP", "o", 1) + CommandUserip(Module* Creator) : Command(Creator,"USERIP", 1) { - syntax = "<nick>{,<nick>}"; + flags_needed = 'o'; syntax = "<nick>{,<nick>}"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -58,7 +58,7 @@ class ModuleUserIP : public Module CommandUserip cmd; public: ModuleUserIP(InspIRCd* Me) - : Module(Me), cmd(Me, this) + : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); Implementation eventlist[] = { I_On005Numeric }; diff --git a/src/modules/m_vhost.cpp b/src/modules/m_vhost.cpp index 6c630622c..dcba12874 100644 --- a/src/modules/m_vhost.cpp +++ b/src/modules/m_vhost.cpp @@ -20,7 +20,7 @@ class CommandVhost : public Command { public: - CommandVhost (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"VHOST", 0, 2) + CommandVhost(Module* Creator) : Command(Creator,"VHOST", 2) { syntax = "<username> <password>"; } @@ -60,7 +60,7 @@ class ModuleVHost : public Module CommandVhost cmd; public: - ModuleVHost(InspIRCd* Me) : Module(Me), cmd(Me, this) + ModuleVHost(InspIRCd* Me) : Module(Me), cmd(this) { ServerInstance->AddCommand(&cmd); } diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index ab32c6740..92e4116ec 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -103,7 +103,7 @@ watchentries* whos_watching_me; class CommandSVSWatch : public Command { public: - CommandSVSWatch (InspIRCd* Instance, Module* Creator) : Command(Instance, Creator,"SVSWATCH", 0, 2) + CommandSVSWatch(Module* Creator) : Command(Creator,"SVSWATCH", 2) { syntax = "<target> [C|L|S]|[+|-<nick>]"; TRANSLATE3(TR_NICK, TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ @@ -248,8 +248,7 @@ class CommandWatch : public Command return CMD_SUCCESS; } - CommandWatch (InspIRCd* Instance, Module* parent, unsigned int &maxwatch) - : Command(Instance,parent,"WATCH",0,0), MAX_WATCH(maxwatch), ext("watchlist", parent) + CommandWatch(Module* parent, unsigned int &maxwatch) : Command(parent,"WATCH", 0), MAX_WATCH(maxwatch), ext("watchlist", parent) { syntax = "[C|L|S]|[+|-<nick>]"; TRANSLATE2(TR_TEXT, TR_END); /* we watch for a nick. not a UID. */ @@ -369,7 +368,7 @@ class Modulewatch : public Module public: Modulewatch(InspIRCd* Me) - : Module(Me), maxwatch(32), cmdw(Me, this, maxwatch), sw(Me,this) + : Module(Me), maxwatch(32), cmdw(this, maxwatch), sw(this) { OnRehash(NULL); whos_watching_me = new watchentries(); |