]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - include/configreader.h
Dunno why this method was static, doesnt need to be...
[user/henk/code/inspircd.git] / include / configreader.h
index 3c8a58e64e57c3968fa88edb179598c291cf4230..70b1bc800f6caa3c0effa869f4a388c1304d85fc 100644 (file)
 #ifndef INSPIRCD_CONFIGREADER
 #define INSPIRCD_CONFIGREADER
 
+/* handy defines */
+
+/** Determines if a channel op is exempt from given mode m,
+ * in config of server instance s. 
+ */
+#define CHANOPS_EXEMPT(s, m) (s->Config->ExemptChanOps[(unsigned char)m])
+
 #include <sstream>
 #include <string>
 #include <vector>
@@ -139,6 +146,7 @@ struct InitialConfig
 {
        char* tag;
        char* value;
+       char* default_value;
        ValueContainerBase* val;
        ConfigDataType datatype;
        Validator validation_function;
@@ -150,8 +158,9 @@ struct InitialConfig
 struct MultiConfig
 {
        const char*     tag;
-       char*           items[12];
-       int             datatype[12];
+       char*           items[13];
+       char*           items_default[13];
+       int             datatype[13];
        MultiNotify     init_function;
        MultiValidator  validation_function;
        MultiNotify     finish_function;
@@ -171,7 +180,7 @@ typedef std::map<irc::string,char*> operclass_t;
  * and storage of the configuration data needed to run the ircd, such as
  * the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
  */
-class ServerConfig : public Extensible
+class CoreExport ServerConfig : public Extensible
 {
   private:
        /** Creator/owner
@@ -274,6 +283,14 @@ class ServerConfig : public Extensible
         */
        char PrefixQuit[MAXBUF];
 
+       /** The quit suffix in use, or an empty string
+        */
+       char SuffixQuit[MAXBUF];
+
+       /** The fixed quit message in use, or an empty string
+        */
+       char FixedQuit[MAXBUF];
+
        /** The last string found within a <die> tag, or
         * an empty string.
         */
@@ -339,6 +356,17 @@ class ServerConfig : public Extensible
         */
        bool AllowHalfop;
 
+       /** If this is set to true, then mode lists (e.g
+        * MODE #chan b) are hidden from unprivileged
+        * users.
+        */
+       bool HideModeLists[256];
+
+       /** If this is set to true, then channel operators
+        * are exempt from this channel mode. Used for +Sc etc.
+        */
+       bool ExemptChanOps[256];
+
        /** The number of seconds the DNS subsystem
         * will wait before timing out any request.
         */
@@ -393,6 +421,10 @@ class ServerConfig : public Extensible
         */
        bool HideBans;
 
+       /** Announce invites to the channel with a server notice
+        */
+       bool AnnounceInvites;
+
        /** If this is enabled then operators will
         * see invisible (+i) channels in /whois.
         */
@@ -402,10 +434,9 @@ class ServerConfig : public Extensible
         */
        char HideWhoisServer[MAXBUF];
 
-       /** A list of IP addresses the server is listening
-        * on.
+       /** Set to a non empty string to obfuscate nicknames prepended to a KILL.
         */
-       char addrs[MAXBUF][255];
+       char HideKillsServer[MAXBUF];
 
        /** The MOTD file, cached in a file_cache type.
         */
@@ -429,13 +460,9 @@ class ServerConfig : public Extensible
         */
        std::vector<std::string> module_names;
 
-       /** A list of ports which the server is listening on
-        */
-       int ports[255];
-
-       /** A list of the file descriptors for the listening client ports
+       /** A list of the classes for listening client ports
         */
-       ListenSocket* openSockfd[255];
+       std::vector<ListenSocket*> ports;
 
        /** Boolean sets of which modules implement which functions
         */
@@ -473,7 +500,7 @@ class ServerConfig : public Extensible
 
        /** List of u-lined servers
         */
-       std::vector<irc::string> ulines;
+       std::map<irc::string, bool> ulines;
 
        /** Max banlist sizes for channels (the std::string is a glob)
         */
@@ -501,6 +528,11 @@ class ServerConfig : public Extensible
         */
        bool UndernetMsgPrefix;
 
+       /** If set to true, the full nick!user@host will be shown in the TOPIC command
+        * for who set the topic last. If false, only the nick is shown.
+        */
+       bool FullHostInTopic;
+
        /** All oper type definitions from the config file
         */
        opertype_t opertypes;
@@ -517,6 +549,14 @@ class ServerConfig : public Extensible
         */
        int argc;
 
+       /** Max channels per user
+        */
+       unsigned int MaxChans;
+
+       /** Oper max channels per user
+        */
+       unsigned int OperMaxChans;
+
        /** Construct a new ServerConfig
         */
        ServerConfig(InspIRCd* Instance);
@@ -570,23 +610,30 @@ class ServerConfig : public Extensible
        /** Writes 'length' chars into 'result' as a string
         */
        bool ConfValue(ConfigDataHash &target, const char* tag, const char* var, int index, char* result, int length, bool allow_linefeeds = false);
+       bool ConfValue(ConfigDataHash &target, 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(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, std::string &result, bool allow_linefeeds = false);
+       bool ConfValue(ConfigDataHash &target, 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(ConfigDataHash &target, const char* tag, const char* var, int index, int &result);
+       bool ConfValueInteger(ConfigDataHash &target, 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(ConfigDataHash &target, const std::string &tag, const std::string &var, int index, int &result);
+       bool ConfValueInteger(ConfigDataHash &target, 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(ConfigDataHash &target, const char* tag, const char* var, int index);
+       bool ConfValueBool(ConfigDataHash &target, 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(ConfigDataHash &target, const std::string &tag, const std::string &var, int index);
+       bool ConfValueBool(ConfigDataHash &target, 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
         */
@@ -609,14 +656,14 @@ class ServerConfig : public Extensible
        bool AddIOHook(Module* iomod, InspSocket* is);
        bool DelIOHook(InspSocket* is);
 
-       static std::string GetFullProgDir(char** argv, int argc);
+       std::string GetFullProgDir();
        static bool DirValid(const char* dirandfile);
        static char* CleanFilename(char* name);
        static bool FileExists(const char* file);
        
 };
 
-bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
+CoreExport bool InitializeDisabledCommands(const char* data, InspIRCd* ServerInstance);
 
 bool InitTypes(ServerConfig* conf, const char* tag);
 bool InitClasses(ServerConfig* conf, const char* tag);