summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/commands/cmd_whowas.h2
-rw-r--r--include/ctables.h29
-rw-r--r--include/inspircd.h8
-rw-r--r--include/modules.h14
4 files changed, 16 insertions, 37 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
*/