diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 14:20:04 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-09 14:20:04 +0000 |
commit | f0680338833dd76966ba1769980abb9eafb50467 (patch) | |
tree | 4dbfcefd4a49f325e5f9d4a9d60e65702aaef81c /include | |
parent | 542eca81f416df9891e24399b540d8a309950fe1 (diff) |
Tidy up loglevel enum (remove some C-ish defines)
change ServerConfig to pass a pointer to 'this' to Validation etc functions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4811 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r-- | include/configreader.h | 12 | ||||
-rw-r--r-- | include/helperfuncs.h | 17 | ||||
-rw-r--r-- | include/modules.h | 4 | ||||
-rw-r--r-- | include/users.h | 11 | ||||
-rw-r--r-- | include/xline.h | 14 |
5 files changed, 32 insertions, 26 deletions
diff --git a/include/configreader.h b/include/configreader.h index e2ff1c2c9..79384c2db 100644 --- a/include/configreader.h +++ b/include/configreader.h @@ -26,9 +26,11 @@ #include "globals.h" #include "modules.h" -typedef bool (*Validator)(const char*, const char*, void*); -typedef bool (*MultiValidator)(const char*, char**, void**, int*); -typedef bool (*MultiNotify)(const char*); +class ServerConfig; + +typedef bool (*Validator)(ServerConfig* conf, const char*, const char*, void*); +typedef bool (*MultiValidator)(ServerConfig* conf, const char*, char**, void**, int*); +typedef bool (*MultiNotify)(ServerConfig* conf, const char*); enum ConfigDataType { DT_NOTHING, DT_INTEGER, DT_CHARPTR, DT_BOOLEAN }; @@ -365,6 +367,10 @@ class ServerConfig : public Extensible */ void Read(bool bail, userrec* user); + /** Read a file into a file_cache object + */ + bool ReadFile(file_cache &F, const char* fname); + /** 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. */ diff --git a/include/helperfuncs.h b/include/helperfuncs.h index 44f9aba49..b4089fa18 100644 --- a/include/helperfuncs.h +++ b/include/helperfuncs.h @@ -27,13 +27,16 @@ #include <deque> #include <sstream> -/** Flags for use with log() +/** Debug levels for use with InspIRCd::Log() */ -#define DEBUG 10 -#define VERBOSE 20 -#define DEFAULT 30 -#define SPARSE 40 -#define NONE 50 +enum DebugLevel +{ + DEBUG = 10, + VERBOSE = 20, + DEFAULT = 30, + SPARSE = 40, + NONE = 50, +}; /* I'm not entirely happy with this, the ## before 'args' is a g++ extension. * The problem is that if you #define log(l, x, args...) and then call it @@ -45,8 +48,6 @@ #define STRINGIFY(x) STRINGIFY2(x) #define log(l, x, args...) InspIRCd::Log(l, __FILE__ ":" STRINGIFY(__LINE__) ": " x, ##args) -void readfile(file_cache &F, const char* fname); - void WriteOpers(const char* text, ...); void WriteOpers_NoFormat(const char* text); diff --git a/include/modules.h b/include/modules.h index f687c9ffe..6104b8715 100644 --- a/include/modules.h +++ b/include/modules.h @@ -18,10 +18,6 @@ #ifndef __MODULES_H #define __MODULES_H -/** log levels - */ -enum DebugLevels { DEBUG, VERBOSE, DEFAULT, SPARSE, NONE }; - /** Used with OnAccessCheck() method of modules */ enum AccessControlType { diff --git a/include/users.h b/include/users.h index 82da66c19..42d0f7376 100644 --- a/include/users.h +++ b/include/users.h @@ -699,10 +699,11 @@ namespace irc }; /* Configuration callbacks */ -bool InitTypes(const char* tag); -bool InitClasses(const char* tag); -bool DoType(const char* tag, char** entries, void** values, int* types); -bool DoClass(const char* tag, char** entries, void** values, int* types); -bool DoneClassesAndTypes(const char* tag); +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 740ed395d..b04d2224d 100644 --- a/include/xline.h +++ b/include/xline.h @@ -123,13 +123,15 @@ class QLine : public XLine bool is_global; }; -bool InitXLine(const char* tag); -bool DoneXLine(const char* tag); +class ServerConfig; -bool DoZLine(const char* tag, char** entries, void** values, int* types); -bool DoQLine(const char* tag, char** entries, void** values, int* types); -bool DoKLine(const char* tag, char** entries, void** values, int* types); -bool DoELine(const char* tag, char** entries, void** values, int* types); +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 add_gline(long duration, const char* source, const char* reason, const char* hostmask); bool add_qline(long duration, const char* source, const char* reason, const char* nickname); |