summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-04-11 00:08:28 -0500
committerAdam <Adam@anope.org>2013-04-11 00:08:28 -0500
commit4f9b7874d6b3a41939ecc2e872ec08d03af7b5f1 (patch)
tree43162205d31b277c9ff12ee28b7e3a60d6382316 /include
parent207c46c871e85b55ae66acc456c6bc412c0c79f9 (diff)
Pass new config and the new config reader to the OnReload event, aswell as call it on module load on modules that hook to it
Diffstat (limited to 'include')
-rw-r--r--include/config.h16
-rw-r--r--include/modules.h10
2 files changed, 18 insertions, 8 deletions
diff --git a/include/config.h b/include/config.h
index 36a4836c8..901fe0138 100644
--- a/include/config.h
+++ b/include/config.h
@@ -707,11 +707,12 @@ class ConfigException : public CoreException
virtual ~ConfigException() throw() { }
};
-#define CONF_NO_ERROR 0x000000
-#define CONF_NOT_A_NUMBER 0x000010
-#define CONF_INT_NEGATIVE 0x000080
-#define CONF_VALUE_NOT_FOUND 0x000100
-#define CONF_FILE_NOT_FOUND 0x000200
+enum
+{
+ CONF_NO_ERROR,
+ CONF_INT_NEGATIVE = 1 << 1,
+ CONF_VALUE_NOT_FOUND = 1 << 2
+};
/** Allows reading of values from configuration files
* This class allows a module to read from either the main configuration file (services.conf) or from
@@ -721,6 +722,7 @@ class ConfigException : public CoreException
*/
class CoreExport ConfigReader
{
+ ServerConfig *conf;
protected:
/** True if an error occured reading the config file
*/
@@ -737,6 +739,10 @@ class CoreExport ConfigReader
* This constructor initialises the ConfigReader class to read a user-specified config file
*/
ConfigReader(const Anope::string &);
+ /** Overloaded constructor
+ * This constructor initialises the ConfigReader class to use a user sepcific ServerConfig object,
+ */
+ ConfigReader(ServerConfig *);
/** Default destructor.
* This method destroys the ConfigReader class.
*/
diff --git a/include/modules.h b/include/modules.h
index ae7ceb651..20d27b0ab 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -112,6 +112,8 @@ if (true) \
else \
static_cast<void>(0)
+class ConfigReader;
+
/** Possible return types from events.
*/
enum EventReturn
@@ -124,7 +126,6 @@ enum EventReturn
enum ModuleReturn
{
MOD_ERR_OK,
- MOD_ERR_MEMORY,
MOD_ERR_PARAMS,
MOD_ERR_EXISTS,
MOD_ERR_NOEXIST,
@@ -285,9 +286,12 @@ class CoreExport Module : public Extensible
*/
virtual void OnUserKicked(Channel *c, User *target, MessageSource &source, const Anope::string &kickmsg) { }
- /** Called when Services' configuration has been loaded.
+ /** Called when Services' configuration is being (re)loaded.
+ * @param conf The config that is being built now and will replace the global Config object
+ * @param reader A config reader for conf
+ * @throws A ConfigException to abort the config (re)loading process.
*/
- virtual void OnReload() { }
+ virtual void OnReload(ServerConfig *conf, ConfigReader &reader) { }
/** Called before a bot is assigned to a channel.
* @param sender The user assigning the bot