- bool LoadConf(FILE* &conf, const char* filename, bool allowexeinc);
-
- /** Load 'filename' into 'target', with the new config parser everything is parsed into
- * tag/key/value at load-time rather than at read-value time.
- */
- bool LoadConf(FILE* &conf, const std::string &filename, bool allowexeinc);
-
- /** Writes 'length' chars into 'result' as a string
- */
- bool ConfValue(const char* tag, const char* var, int index, char* result, int length, bool allow_linefeeds = false);
-
- /** Writes 'length' chars into 'result' as a string
- */
- bool ConfValue(const char* tag, const char* var, const char* default_value, int index, char* result, int length, bool allow_linefeeds = false);
-
- /** Writes 'length' chars into 'result' as a string
- */
- bool ConfValue(const std::string &tag, const std::string &var, int index, std::string &result, bool allow_linefeeds = false);
-
- /** Writes 'length' chars into 'result' as a string
- */
- bool ConfValue(const std::string &tag, const std::string &var, const std::string &default_value, int index, std::string &result, bool allow_linefeeds = false);
-
- /** Tries to convert the value to an integer and write it to 'result'
- */
- bool ConfValueInteger(const char* tag, const char* var, int index, int &result);
-
- /** Tries to convert the value to an integer and write it to 'result'
- */
- bool ConfValueInteger(const char* tag, const char* var, const char* default_value, int index, int &result);
-
- /** Tries to convert the value to an integer and write it to 'result'
- */
- bool ConfValueInteger(const std::string &tag, const std::string &var, int index, int &result);
-
- /** Tries to convert the value to an integer and write it to 'result'
- */
- bool ConfValueInteger(const std::string &tag, const std::string &var, const std::string &default_value, int index, int &result);
-
- /** Returns true if the value exists and has a true value, false otherwise
- */
- bool ConfValueBool(const char* tag, const char* var, int index);
-
- /** Returns true if the value exists and has a true value, false otherwise
- */
- bool ConfValueBool(const char* tag, const char* var, const char* default_value, int index);
-
- /** Returns true if the value exists and has a true value, false otherwise
- */
- bool ConfValueBool(const std::string &tag, const std::string &var, int index);
-
- /** Returns true if the value exists and has a true value, false otherwise
- */
- bool ConfValueBool(const std::string &tag, const std::string &var, const std::string &default_value, int index);
-
- /** Returns the number of occurences of tag in the config file
- */
- int ConfValueEnum(const char* tag);
- /** Returns the number of occurences of tag in the config file
- */
- int ConfValueEnum(const std::string &tag);
-
- /** Returns the numbers of vars inside the index'th 'tag in the config file
- */
- int ConfVarEnum(const char* tag, int index);
- /** Returns the numbers of vars inside the index'th 'tag in the config file
- */
- int ConfVarEnum(const std::string &tag, int index);
-
- bool ApplyDisabledCommands(const char* data);
-
- /** Returns the fully qualified path to the inspircd directory
- * @return The full program directory
- */
- std::string GetFullProgDir();
-
- /** Clean a filename, stripping the directories (and drives) from string.
- * @param name Directory to tidy
- * @return The cleaned filename
- */
- static const char* CleanFilename(const char* name);
-
- /** Check if a file exists.
- * @param file The full path to a file
- * @return True if the file exists and is readable.
- */
- static bool FileExists(const char* file);
-
- /** If this value is true, invites will bypass more than just +i
- */
- bool InvBypassModes;
-
-};
-
-
-/** Types of data in the core config
- */
-enum ConfigDataType
-{
- DT_NOTHING = 0, /* No data */
- DT_INTEGER = 1, /* Integer */
- DT_CHARPTR = 2, /* Char pointer */
- DT_BOOLEAN = 3, /* Boolean */
- DT_HOSTNAME = 4, /* Hostname syntax */
- DT_NOSPACES = 5, /* No spaces */
- DT_IPADDRESS = 6, /* IP address (v4, v6) */
- DT_CHANNEL = 7, /* Channel name */
- DT_LIMIT = 8, /* size_t */
- DT_ALLOW_WILD = 64, /* Allow wildcards/CIDR in DT_IPADDRESS */
- DT_ALLOW_NEWLINE = 128 /* New line characters allowed in DT_CHARPTR */
-};
-
-/** The maximum number of values in a core configuration tag. Can be increased if needed.
- */
-#define MAX_VALUES_PER_TAG 18
-
-/** Holds a config value, either string, integer or boolean.
- * Callback functions receive one or more of these, either on
- * their own as a reference, or in a reference to a deque of them.
- * The callback function can then alter the values of the ValueItem
- * classes to validate the settings.
- */
-class ValueItem
-{
- /** Actual data */
- std::string v;
- public:
- /** Initialize with an int */
- ValueItem(int value);
- /** Initialize with a bool */
- ValueItem(bool value);
- /** Initialize with a string */
- ValueItem(const char* value) : v(value) { }
- /** Change value to a string */
- void Set(const std::string &val);
- /** Change value to an int */
- void Set(int value);
- /** Get value as an int */
- int GetInteger();
- /** Get value as a string */
- const char* GetString() const;
- /** Get value as a string */
- inline const std::string& GetValue() const { return v; }
- /** Get value as a bool */
- bool GetBool();
-};
-
-/** The base class of the container 'ValueContainer'
- * used internally by the core to hold core values.
- */
-class ValueContainerBase
-{
- public:
- /** Constructor */
- ValueContainerBase() { }
- /** Destructor */
- virtual ~ValueContainerBase() { }