]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/configreader.h
Add more features to modestacker so that we can stack +, -, and parameterless modes
[user/henk/code/inspircd.git] / include / configreader.h
index 3bb7bb4ed4368aac2bb0a8cbeb6a614f9fb0138f..44551b1329cbace399038e42a86e6fc3d64d92c9 100644 (file)
 #include "inspircd.h"
 #include "globals.h"
 #include "modules.h"
+#include "socketengine.h"
+#include "socket.h"
 
-typedef bool (*Validator)(const char*, const char*, void*);
-typedef bool (*MultiValidator)(const char*, char**, void**, int*);
-typedef bool (*MultiNotify)(const char*);
+class ServerConfig;
+class InspIRCd;
+
+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 };
 
-struct InitialConfig {
+/** Holds a core configuration item and its callbacks
+ */
+struct InitialConfig
+{
        char* tag;
        char* value;
        void* val;
@@ -40,7 +48,11 @@ struct InitialConfig {
        Validator validation_function;
 };
 
-struct MultiConfig {
+/** Holds a core configuration item and its callbacks
+ * where there may be more than one item
+ */
+struct MultiConfig
+{
        const char* tag;
        char* items[12];
        int datatype[12];
@@ -57,6 +69,8 @@ struct MultiConfig {
 class ServerConfig : public Extensible
 {
   private:
+       InspIRCd* ServerInstance;
+
        /** This variable holds the names of all
         * files included from the main one. This
         * is used to make sure that no files are
@@ -77,6 +91,8 @@ class ServerConfig : public Extensible
        bool CheckOnce(char* tag, bool bail, userrec* user);
   
   public:
+
+       InspIRCd* GetInstance();
          
        /** This holds all the information in the config file,
         * it's indexed by tag name to a vector of key/values.
@@ -299,6 +315,10 @@ class ServerConfig : public Extensible
         */
        int ports[255];
 
+       /** A list of the file descriptors for the listening client ports
+        */
+       ListenSocket* openSockfd[255];
+
        /** Boolean sets of which modules implement which functions
         */
        char implement_lists[255][255];
@@ -338,10 +358,22 @@ class ServerConfig : public Extensible
         */
        std::map<std::string,int> maxbans;
 
-       ServerConfig();
+       /** If set to true, no user DNS lookups are to be performed
+        */
+       bool NoUserDns;
+
+       /** If set to true, provide syntax hints for unknown commands
+        */
+       bool SyntaxHints;
+
+       /** If set to true, users appear to quit then rejoin when their hosts change.
+        * This keeps clients synchronized properly.
+        */
+       bool CycleHosts;
+
+       ServerConfig(InspIRCd* Instance);
 
-       /** Clears the include stack in preperation for
-        * a Read() call.
+       /** Clears the include stack in preperation for a Read() call.
         */
        void ClearStack();
 
@@ -351,6 +383,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.
         */
@@ -382,6 +418,14 @@ class ServerConfig : public Extensible
        Module* GetIOHook(int port);
        bool AddIOHook(int port, Module* iomod);
        bool DelIOHook(int port);
+
+       static std::string GetFullProgDir(char** argv, int argc);
+       static bool DirValid(const char* dirandfile);
+       static char* CleanFilename(char* name);
+       static bool FileExists(const char* file);
+       
 };
 
+bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
+
 #endif