summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-14 22:38:43 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-14 22:38:43 +0000
commit004217daed4e60162bcb3f99c85e2efe41c21a03 (patch)
treebece4451184b827e623226c0d7117ead5ff37090 /include
parent4482876dd3d7d4e6f06ac43dcdbe98db04512ab2 (diff)
Tons of tweaks to the config stuff for the core
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5744 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/configreader.h47
-rw-r--r--include/users.h5
-rw-r--r--include/xline.h8
3 files changed, 47 insertions, 13 deletions
diff --git a/include/configreader.h b/include/configreader.h
index 516c6a6ed..023121ffc 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -31,19 +31,52 @@
class ServerConfig;
class InspIRCd;
+/** Types of data in the core config
+ */
+enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN };
+
+class ValueItem
+{
+ std::string v;
+ public:
+ ValueItem(int value)
+ {
+ std::stringstream n;
+ n << value;
+ v = n.str();
+ }
+
+ ValueItem(bool value)
+ {
+ std::stringstream n;
+ n << value;
+ v = n.str();
+ }
+
+ ValueItem(char* value)
+ {
+ v = value;
+ }
+
+ int GetInteger() { return atoi(v.c_str()); };
+
+ const char* GetString() { return v.c_str(); };
+
+ bool GetBool() { return GetInteger(); };
+};
+
+typedef std::deque<ValueItem> ValueList;
+
/** A callback for validating a single value
*/
typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, void*);
/** A callback for validating multiple value entries
*/
-typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, void**, int*);
+typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, ValueList&, int*);
/** A callback indicating the end of a group of entries
*/
typedef bool (*MultiNotify)(ServerConfig* conf, const char*);
-/** Types of data in the core config
- */
-enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN };
/** Holds a core configuration item and its callbacks
*/
@@ -498,4 +531,10 @@ class ServerConfig : public Extensible
bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
+bool InitTypes(ServerConfig* conf, const char* tag);
+bool InitClasses(ServerConfig* conf, const char* tag);
+bool DoType(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoClass(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
+
#endif
diff --git a/include/users.h b/include/users.h
index d94511660..d82b3d2cc 100644
--- a/include/users.h
+++ b/include/users.h
@@ -845,10 +845,5 @@ namespace irc
/* Configuration callbacks */
class ServerConfig;
-bool InitTypes(ServerConfig* conf, const char* tag);
-bool InitClasses(ServerConfig* conf, const char* tag);
-bool DoType(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoClass(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoneClassesAndTypes(ServerConfig* conf, const char* tag);
#endif
diff --git a/include/xline.h b/include/xline.h
index daefe8a1e..3e8739a7e 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -191,10 +191,10 @@ class InspIRCd;
bool InitXLine(ServerConfig* conf, const char* tag);
bool DoneXLine(ServerConfig* conf, const char* tag);
-bool DoZLine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoQLine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoKLine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool DoELine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
+bool DoZLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoQLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoKLine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
+bool DoELine(ServerConfig* conf, const char* tag, char** entries, ValueList &values, int* types);
typedef std::pair<std::string, std::string> IdentHostPair;