]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Remove VF_SERVICEPROVIDER, prevent heap allocation of ConfigReader
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 18 Oct 2009 16:01:33 +0000 (16:01 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Sun, 18 Oct 2009 16:01:33 +0000 (16:01 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11904 e03df62e-2008-0410-955e-edbf42e46eb7

38 files changed:
include/bancache.h
include/base.h
include/command_parse.h
include/commands/cmd_whowas.h
include/configreader.h
include/modules.h
include/xline.h
src/logger.cpp
src/modules/extra/m_mysql.cpp
src/modules/extra/m_pgsql.cpp
src/modules/extra/m_regex_pcre.cpp
src/modules/extra/m_regex_posix.cpp
src/modules/extra/m_regex_tre.cpp
src/modules/extra/m_sqlite3.cpp
src/modules/m_censor.cpp
src/modules/m_conn_join.cpp
src/modules/m_connflood.cpp
src/modules/m_dccallow.cpp
src/modules/m_deaf.cpp
src/modules/m_denychans.cpp
src/modules/m_dnsbl.cpp
src/modules/m_httpd.cpp
src/modules/m_md5.cpp
src/modules/m_nationalchars.cpp
src/modules/m_operjoin.cpp
src/modules/m_operlevels.cpp
src/modules/m_opermodes.cpp
src/modules/m_opermotd.cpp
src/modules/m_randquote.cpp
src/modules/m_regex_glob.cpp
src/modules/m_restrictchans.cpp
src/modules/m_ripemd160.cpp
src/modules/m_securelist.cpp
src/modules/m_sha256.cpp
src/modules/m_spanningtree/utils.cpp
src/modules/m_sqlutils.cpp
src/modules/m_sslinfo.cpp
src/modules/m_vhost.cpp

index c9c469e4f8fa4a81bdac25dea41679b5ef7e210a..952a1453a5476ef327e4701709b5f13c0bb975c5 100644 (file)
@@ -21,7 +21,7 @@
  * entries expire every few hours, which is a reasonable expiry for any reasonable
  * sized network.
  */
-class CoreExport BanCacheHit : public classbase
+class CoreExport BanCacheHit
 {
  public:
        /** Type of cached ban
@@ -66,7 +66,7 @@ typedef nspace::hash_map<std::string, BanCacheHit*, nspace::hash<std::string> >
 
 /** A manager for ban cache, which allocates and deallocates and checks cached bans.
  */
-class CoreExport BanCacheManager : public classbase
+class CoreExport BanCacheManager
 {
  private:
        BanCacheHash* BanHash;
index 624e2174ff137c8b891ba6f66bc959ea0ccc3fca..856cd64c2370a5e5263eaa4a00c52b6e78d41b61 100644 (file)
@@ -47,6 +47,20 @@ class CoreExport classbase
        void operator=(const classbase&);
 };
 
+/** The base class for inspircd classes that provide a wrapping interface, and
+ * should only exist while being used. Prevents heap allocation.
+ */
+class CoreExport interfacebase
+{
+ public:
+       interfacebase() {}
+ private:
+       interfacebase(const interfacebase&);
+       void operator=(const interfacebase&);
+       void* operator new(size_t);
+       void operator delete(void*);
+};
+
 /** The base class for inspircd classes that support reference counting.
  * Any objects that do not have a well-defined lifetime should inherit from
  * this, and should be assigned to a reference<type> object to establish their
index 35f5a7b0ec0b8b774ebf7dba35ee70fd90cb723a..814cdb27aa9879e606b3039638c586bf2aed8bc7 100644 (file)
@@ -23,7 +23,7 @@ typedef std::map<std::string, void*> SharedObjectList;
  * call command handlers by name, and chop up comma seperated
  * parameters into multiple calls.
  */
-class CoreExport CommandParser : public classbase
+class CoreExport CommandParser
 {
  private:
        /** Parameter buffer
index 12c9eae9aa3e8b8e6fc36cf722f1d278f3bef689..71c635b392e250cc9802e804eec92898b419b00c 100644 (file)
@@ -94,7 +94,7 @@ class CommandWhowas : public Command
 
 /** Used to hold WHOWAS information
  */
-class WhoWasGroup : public classbase
+class WhoWasGroup
 {
  public:
        /** Real host
@@ -116,7 +116,7 @@ class WhoWasGroup : public classbase
         */
        time_t signon;
 
-       /** Initialize this WhoQasFroup with a user
+       /** Initialize this WhoWasFroup with a user
         */
        WhoWasGroup(User* user);
        /** Destructor
index 553f49d60e09d814623c4211f978f75f5fe35835..402f984e8a1695d88640b957f3f0efa414e419b4 100644 (file)
@@ -117,7 +117,7 @@ class ServerLimits
  * and storage of the configuration data needed to run the ircd, such as
  * the servername, connect classes, /ADMIN data, MOTDs and filenames etc.
  */
-class CoreExport ServerConfig : public classbase
+class CoreExport ServerConfig
 {
   private:
        void CrossCheckOperClassType();
index 96506f5982f48562917e07ffa1e2dbd42e74bbc7..ad9cf05b8cee7021987d084f4323c85f978bc992 100644 (file)
@@ -33,10 +33,9 @@ enum ModuleFlags {
        VF_NONE = 0,            // module is not special at all
        VF_STATIC = 1,          // module is static, cannot be /unloadmodule'd
        VF_VENDOR = 2,          // module is a vendor module (came in the original tarball, not 3rd party)
-       VF_SERVICEPROVIDER = 4, // module provides a service to other modules (can be a dependency)
-       VF_COMMON = 8,          // module needs to be common on all servers in a network to link
-       VF_OPTCOMMON = 16,      // module should be common on all servers for unsurprising behavior
-       VF_CORE = 32            // module is a core command, can be assumed loaded on all servers
+       VF_COMMON = 4,          // module needs to be common on all servers in a network to link
+       VF_OPTCOMMON = 8,       // module should be common on all servers for unsurprising behavior
+       VF_CORE = 16            // module is a core command, can be assumed loaded on all servers
 };
 
 /** Used with SendToMode()
@@ -74,26 +73,26 @@ struct ModResult {
        int res;
        ModResult() : res(0) {}
        explicit ModResult(int r) : res(r) {}
-       bool operator==(const ModResult& r) const
+       inline bool operator==(const ModResult& r) const
        {
                return res == r.res;
        }
-       bool operator!=(const ModResult& r) const
+       inline bool operator!=(const ModResult& r) const
        {
                return res != r.res;
        }
-       bool operator!() const
+       inline bool operator!() const
        {
                return !res;
        }
-       bool check(bool def) const
+       inline bool check(bool def) const
        {
                return (res == 1 || (res == 0 && def));
        }
        /**
         * Merges two results, preferring ALLOW to DENY
         */
-       ModResult operator+(const ModResult& r) const
+       inline ModResult operator+(const ModResult& r) const
        {
                if (res == r.res || r.res == 0)
                        return *this;
@@ -107,7 +106,7 @@ struct ModResult {
 /** If you change the module API in any way, increment this value.
  * This MUST be a pure integer, with no parenthesis
  */
-#define API_VERSION 134
+#define API_VERSION 135
 
 class ServerConfig;
 
@@ -314,7 +313,7 @@ class CoreExport Event : public classbase
        void Send();
 };
 
-/** Priority types which can be returned from Module::Prioritize()
+/** Priority types which can be used by Module::Prioritize()
  */
 enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFORE, PRIORITY_AFTER };
 
@@ -1297,7 +1296,7 @@ class CoreExport Module : public classbase
  * Constructing the class using one parameter allows you to specify a path to your own configuration
  * file, otherwise, inspircd.conf is read.
  */
-class CoreExport ConfigReader : public classbase
+class CoreExport ConfigReader : public interfacebase
 {
   protected:
        /** Error code
@@ -1461,7 +1460,7 @@ typedef IntModuleList::iterator EventHandlerIter;
 /** ModuleManager takes care of all things module-related
  * in the core.
  */
-class CoreExport ModuleManager : public classbase
+class CoreExport ModuleManager
 {
  private:
        /** Holds a string describing the last module error to occur
index 7ac4aa7f1944eb533933dd1d67ce1902ea7b911e..e349c28d787e038c6aa0ba2940d4327f5fa99ddf 100644 (file)
@@ -366,7 +366,7 @@ typedef std::pair<std::string, std::string> IdentHostPair;
  * does not have to know the specifics of the internals of an XLine class
  * and/or how to call its constructor.
  */
-class CoreExport XLineFactory : public classbase
+class CoreExport XLineFactory
 {
  protected:
 
@@ -436,7 +436,7 @@ typedef XLineLookup::iterator LookupIter;
  * or any other line created by a module. It also manages XLineFactory classes which
  * can generate a specialized XLine for use by another module.
  */
-class CoreExport XLineManager : public classbase
+class CoreExport XLineManager
 {
  protected:
        /** Used to hold XLines which have not yet been applied.
index c9b1cf9e492a5bf8bc4f21c874b96078d2baec54..be28bf836dab939f210105ecfde73be013034c71 100644 (file)
@@ -68,7 +68,7 @@ void LogManager::OpenFileLogs()
        {
                return;
        }
-       ConfigReader* Conf = new ConfigReader;
+       ConfigReader Conf;
        std::map<std::string, FileWriter*> logmap;
        std::map<std::string, FileWriter*>::iterator i;
        for (int index = 0;; ++index)
@@ -106,7 +106,7 @@ void LogManager::OpenFileLogs()
                        loglevel = NONE;
                }
                FileWriter* fw;
-               std::string target = Conf->ReadValue("log", "target", index);
+               std::string target = Conf.ReadValue("log", "target", index);
                if ((i = logmap.find(target)) == logmap.end())
                {
                        FILE* f = fopen(target.c_str(), "a");
index 90a2d95dce0e4cf56d36e97622a9efbef241edcd..47de25ee4d35a112588b9e523120b018310c78a5 100644 (file)
@@ -87,8 +87,6 @@ unsigned long count(const char * const str, char a)
 class ModuleSQL : public Module
 {
  public:
-
-        ConfigReader *Conf;
         int currid;
         bool rehashing;
         DispatcherThread* Dispatcher;
@@ -549,30 +547,31 @@ bool HasHost(const SQLhost &host)
        return false;
 }
 
-bool HostInConf(ConfigReader* conf, const SQLhost &h)
+bool HostInConf(const SQLhost &h)
 {
-       for(int i = 0; i < conf->Enumerate("database"); i++)
+       ConfigReader conf;
+       for(int i = 0; i < conf.Enumerate("database"); i++)
        {
                SQLhost host;
-               host.id         = conf->ReadValue("database", "id", i);
-               host.host       = conf->ReadValue("database", "hostname", i);
-               host.port       = conf->ReadInteger("database", "port", i, true);
-               host.name       = conf->ReadValue("database", "name", i);
-               host.user       = conf->ReadValue("database", "username", i);
-               host.pass       = conf->ReadValue("database", "password", i);
-               host.ssl        = conf->ReadFlag("database", "ssl", i);
+               host.id         = conf.ReadValue("database", "id", i);
+               host.host       = conf.ReadValue("database", "hostname", i);
+               host.port       = conf.ReadInteger("database", "port", i, true);
+               host.name       = conf.ReadValue("database", "name", i);
+               host.user       = conf.ReadValue("database", "username", i);
+               host.pass       = conf.ReadValue("database", "password", i);
+               host.ssl        = conf.ReadFlag("database", "ssl", i);
                if (h == host)
                        return true;
        }
        return false;
 }
 
-void ClearOldConnections(ConfigReader* conf)
+void ClearOldConnections()
 {
        ConnMap::iterator i,safei;
        for (i = Connections.begin(); i != Connections.end(); i++)
        {
-               if (!HostInConf(conf, i->second->GetConfHost()))
+               if (!HostInConf(i->second->GetConfHost()))
                {
                        delete i->second;
                        safei = i;
@@ -611,21 +610,22 @@ void ConnectDatabases(ModuleSQL* Parent)
        }
 }
 
-void LoadDatabases(ConfigReader* conf, ModuleSQL* Parent)
+void LoadDatabases(ModuleSQL* Parent)
 {
+       ConfigReader conf;
        Parent->ConnMutex.Lock();
-       ClearOldConnections(conf);
-       for (int j =0; j < conf->Enumerate("database"); j++)
+       ClearOldConnections();
+       for (int j =0; j < conf.Enumerate("database"); j++)
        {
                SQLhost host;
-               host.id         = conf->ReadValue("database", "id", j);
-               host.host       = conf->ReadValue("database", "hostname", j);
-               host.port       = conf->ReadInteger("database", "port", j, true);
-               host.name       = conf->ReadValue("database", "name", j);
-               host.user       = conf->ReadValue("database", "username", j);
-               host.pass       = conf->ReadValue("database", "password", j);
-               host.ssl        = conf->ReadFlag("database", "ssl", j);
-               std::string initquery = conf->ReadValue("database", "initialquery", j);
+               host.id         = conf.ReadValue("database", "id", j);
+               host.host       = conf.ReadValue("database", "hostname", j);
+               host.port       = conf.ReadInteger("database", "port", j, true);
+               host.name       = conf.ReadValue("database", "name", j);
+               host.user       = conf.ReadValue("database", "username", j);
+               host.pass       = conf.ReadValue("database", "password", j);
+               host.ssl        = conf.ReadFlag("database", "ssl", j);
+               std::string initquery = conf.ReadValue("database", "initialquery", j);
 
                if (HasHost(host))
                        continue;
@@ -683,7 +683,6 @@ ModuleSQL::ModuleSQL() : rehashing(false)
 {
        ServerInstance->Modules->UseInterface("SQLutils");
 
-       Conf = new ConfigReader;
        currid = 0;
 
        Dispatcher = new DispatcherThread(this);
@@ -706,7 +705,6 @@ ModuleSQL::~ModuleSQL()
 {
        delete Dispatcher;
        ClearAllConnections();
-       delete Conf;
        ServerInstance->Modules->UnpublishInterface("SQL", this);
        ServerInstance->Modules->UnpublishFeature("SQL");
        ServerInstance->Modules->DoneWithInterface("SQLutils");
@@ -756,12 +754,12 @@ void ModuleSQL::OnRehash(User* user)
 
 Version ModuleSQL::GetVersion()
 {
-       return Version("SQL Service Provider module for all other m_sql* modules", VF_VENDOR | VF_SERVICEPROVIDER);
+       return Version("SQL Service Provider module for all other m_sql* modules", VF_VENDOR);
 }
 
 void DispatcherThread::Run()
 {
-       LoadDatabases(Parent->Conf, Parent);
+       LoadDatabases(Parent);
 
        SQLConnection* conn = NULL;
 
@@ -771,7 +769,7 @@ void DispatcherThread::Run()
                if (Parent->rehashing)
                {
                        Parent->rehashing = false;
-                       LoadDatabases(Parent->Conf, Parent);
+                       LoadDatabases(Parent);
                }
 
                conn = NULL;
index 5d2fe106bfa593def6c1b6ba6eb28757fe113c37..b5beea0b0b8dabcc64ea7c9fcb25d9d0fc919988 100644 (file)
@@ -954,7 +954,7 @@ class ModulePgSQL : public Module
 
        virtual Version GetVersion()
        {
-               return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR|VF_SERVICEPROVIDER);
+               return Version("PostgreSQL Service Provider module for all other m_sql* modules, uses v2 of the SQL API", VF_VENDOR);
        }
 };
 
index 8f2284ce6a434be63f349b34f8838172875e7665..9e8aff159c81467959b935c67b6f5c73897b78be 100644 (file)
@@ -76,7 +76,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Regex Provider Module for PCRE", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Regex Provider Module for PCRE", VF_COMMON | VF_VENDOR);
        }
 
        virtual ~ModuleRegexPCRE()
index 1bcd32187daed23adcc8b787f3cb6dc7b8412f9c..ea016ae64917004462fa71d2478f71b3ce3d5e6d 100644 (file)
@@ -85,7 +85,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Regex Provider Module for POSIX Regular Expressions", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Regex Provider Module for POSIX Regular Expressions", VF_COMMON | VF_VENDOR);
        }
 
        virtual ~ModuleRegexPOSIX()
index ef0ed91a4746a0f05e3670072f9ba6581e68978a..01c6ebf4aa33ba624a6d7a060918769933debf55 100644 (file)
@@ -82,7 +82,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Regex Provider Module for TRE Regular Expressions", VF_COMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Regex Provider Module for TRE Regular Expressions", VF_COMMON | VF_VENDOR);
        }
 
        virtual ~ModuleRegexTRE()
index aba3c0930cc4ad4f9672b879d34d6c4c446d1add..234f89ea2e642c74f2ae0803bf1feb359e00aa9e 100644 (file)
@@ -723,7 +723,7 @@ class ModuleSQLite3 : public Module
 
        virtual Version GetVersion()
        {
-               return Version("sqlite3 provider", VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("sqlite3 provider", VF_VENDOR);
        }
 
 };
index 39824147529159303450ea450884d7a810e74786..faf2a4200334d9dcd51654e0e67950d7c7f83313 100644 (file)
@@ -114,17 +114,15 @@ class ModuleCensor : public Module
                 * reload our config file on rehash - we must destroy and re-allocate the classes
                 * to call the constructor again and re-read our data.
                 */
-               ConfigReader* MyConf = new ConfigReader;
+               ConfigReader MyConf;
                censors.clear();
 
-               for (int index = 0; index < MyConf->Enumerate("badword"); index++)
+               for (int index = 0; index < MyConf.Enumerate("badword"); index++)
                {
-                       irc::string pattern = (MyConf->ReadValue("badword","text",index)).c_str();
-                       irc::string replace = (MyConf->ReadValue("badword","replace",index)).c_str();
+                       irc::string pattern = (MyConf.ReadValue("badword","text",index)).c_str();
+                       irc::string replace = (MyConf.ReadValue("badword","replace",index)).c_str();
                        censors[pattern] = replace;
                }
-
-               delete MyConf;
        }
 
        virtual Version GetVersion()
index b1f12e1ebd0aa7e23a0fd8572ab1f3711e58ccfb..ef834e55ac7e36bab1feeac71c0f126bb255b191 100644 (file)
@@ -57,12 +57,11 @@ class ModuleConnJoin : public Module
 
                virtual void OnRehash(User* user)
                {
-                       ConfigReader* conf = new ConfigReader;
-                       JoinChan = conf->ReadValue("autojoin", "channel", 0);
+                       ConfigReader conf;
+                       JoinChan = conf.ReadValue("autojoin", "channel", 0);
                        Joinchans.clear();
                        if (!JoinChan.empty())
                                tokenize(JoinChan,Joinchans);
-                       delete conf;
                }
 
                virtual ~ModuleConnJoin()
index ae9fcf0e529308e0a4cad59f1d731eca17a5e821..b2aaab45abb1cd52c9bcb96b9fd7c8cb2a6dfdc9 100644 (file)
@@ -24,9 +24,6 @@ private:
        time_t first;
        std::string quitmsg;
 
-       ConfigReader* conf;
-
-
 public:
        ModuleConnFlood()       {
 
@@ -47,15 +44,15 @@ public:
        void InitConf()
        {
                /* read configuration variables */
-               conf = new ConfigReader;
+               ConfigReader conf;
                /* throttle configuration */
-               seconds = conf->ReadInteger("connflood", "seconds", 0, true);
-               maxconns = conf->ReadInteger("connflood", "maxconns", 0, true);
-               timeout = conf->ReadInteger("connflood", "timeout", 0, true);
-               quitmsg = conf->ReadValue("connflood", "quitmsg", 0);
+               seconds = conf.ReadInteger("connflood", "seconds", 0, true);
+               maxconns = conf.ReadInteger("connflood", "maxconns", 0, true);
+               timeout = conf.ReadInteger("connflood", "timeout", 0, true);
+               quitmsg = conf.ReadValue("connflood", "quitmsg", 0);
 
                /* seconds to wait when the server just booted */
-               boot_wait = conf->ReadInteger("connflood", "bootwait", 0, true);
+               boot_wait = conf.ReadInteger("connflood", "bootwait", 0, true);
 
                first = ServerInstance->Time();
        }
index d4be35cebb62d9f30685e98bdf2c6cd12ad7beb6..fb05283fc4faa36cb6361d98dd55f7cb3489c317 100644 (file)
@@ -15,8 +15,6 @@
 
 /* $ModDesc: Povides support for the /DCCALLOW command */
 
-static ConfigReader *Conf;
-
 class BannedFileList
 {
  public:
@@ -140,7 +138,8 @@ class CommandDccallow : public Command
                                        }
 
                                        std::string mask = std::string(target->nick)+"!"+std::string(target->ident)+"@"+std::string(target->dhost);
-                                       std::string default_length = Conf->ReadValue("dccallow", "length", 0);
+                                       ConfigReader Conf;
+                                       std::string default_length = Conf.ReadValue("dccallow", "length", 0);
 
                                        long length;
                                        if (parameters.size() < 2)
@@ -242,7 +241,6 @@ class ModuleDCCAllow : public Module
        ModuleDCCAllow()
                : cmd(this)
        {
-               Conf = new ConfigReader;
                ext = new SimpleExtItem<dccallowlist>("dccallow", this);
                ServerInstance->Extensions.Register(ext);
                ServerInstance->AddCommand(&cmd);
@@ -254,8 +252,6 @@ class ModuleDCCAllow : public Module
 
        virtual void OnRehash(User* user)
        {
-               delete Conf;
-               Conf = new ConfigReader;
                ReadFileConf();
        }
 
@@ -325,11 +321,12 @@ class ModuleDCCAllow : public Module
 
                                        irc::string type = tokens[1].c_str();
 
-                                       bool blockchat = Conf->ReadFlag("dccallow", "blockchat", 0);
+                                       ConfigReader Conf;
+                                       bool blockchat = Conf.ReadFlag("dccallow", "blockchat", 0);
 
                                        if (type == "SEND")
                                        {
-                                               std::string defaultaction = Conf->ReadValue("dccallow", "action", 0);
+                                               std::string defaultaction = Conf.ReadValue("dccallow", "action", 0);
                                                std::string filename = tokens[2];
 
                                                bool found = false;
@@ -449,12 +446,13 @@ class ModuleDCCAllow : public Module
 
        void ReadFileConf()
        {
+               ConfigReader Conf;
                bfl.clear();
-               for (int i = 0; i < Conf->Enumerate("banfile"); i++)
+               for (int i = 0; i < Conf.Enumerate("banfile"); i++)
                {
                        BannedFileList bf;
-                       std::string fileglob = Conf->ReadValue("banfile", "pattern", i);
-                       std::string action = Conf->ReadValue("banfile", "action", i);
+                       std::string fileglob = Conf.ReadValue("banfile", "pattern", i);
+                       std::string action = Conf.ReadValue("banfile", "action", i);
                        bf.filemask = fileglob;
                        bf.action = action;
                        bfl.push_back(bf);
@@ -464,9 +462,7 @@ class ModuleDCCAllow : public Module
 
        virtual ~ModuleDCCAllow()
        {
-               delete Conf;
                delete ext;
-               Conf = NULL;
        }
 
        virtual Version GetVersion()
index f52702bca8592bcc7f55c6ad9320ab4276356775..fb6720ca9e707b1183260a96a41d755392642030 100644 (file)
@@ -67,11 +67,9 @@ class ModuleDeaf : public Module
 
        virtual void OnRehash(User* user)
        {
-               ConfigReader* conf = new ConfigReader;
-               deaf_bypasschars = conf->ReadValue("deaf", "bypasschars", 0);
-               deaf_bypasschars_uline = conf->ReadValue("deaf", "bypasscharsuline", 0);
-
-               delete conf;
+               ConfigReader conf;
+               deaf_bypasschars = conf.ReadValue("deaf", "bypasschars", 0);
+               deaf_bypasschars_uline = conf.ReadValue("deaf", "bypasscharsuline", 0);
        }
 
        virtual ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
index 4493b62404e7c6747b02285b4884527ffac82b01..4988c8daa4c2c39ea13478921d1858c7394402d2 100644 (file)
 
 class ModuleDenyChannels : public Module
 {
- private:
-
-
-       ConfigReader *Conf;
-
  public:
        ModuleDenyChannels()    {
-
-               Conf = new ConfigReader;
                Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 2);
        }
 
        virtual void OnRehash(User* user)
        {
-               delete Conf;
-               Conf = new ConfigReader;
+               ConfigReader Conf;
                /* check for redirect validity and loops/chains */
-               for (int i =0; i < Conf->Enumerate("badchan"); i++)
+               for (int i =0; i < Conf.Enumerate("badchan"); i++)
                {
-                       std::string name = Conf->ReadValue("badchan","name",i);
-                       std::string redirect = Conf->ReadValue("badchan","redirect",i);
+                       std::string name = Conf.ReadValue("badchan","name",i);
+                       std::string redirect = Conf.ReadValue("badchan","redirect",i);
 
                        if (!redirect.empty())
                        {
@@ -50,14 +42,14 @@ class ModuleDenyChannels : public Module
                                        throw ModuleException("Invalid badchan redirect, not a channel");
                                }
 
-                               for (int j =0; j < Conf->Enumerate("badchan"); j++)
+                               for (int j =0; j < Conf.Enumerate("badchan"); j++)
                                {
-                                       if (InspIRCd::Match(redirect, Conf->ReadValue("badchan","name",j)))
+                                       if (InspIRCd::Match(redirect, Conf.ReadValue("badchan","name",j)))
                                        {
                                                bool goodchan = false;
-                                               for (int k =0; k < Conf->Enumerate("goodchan"); k++)
+                                               for (int k =0; k < Conf.Enumerate("goodchan"); k++)
                                                {
-                                                       if (InspIRCd::Match(redirect, Conf->ReadValue("goodchan","name",k)))
+                                                       if (InspIRCd::Match(redirect, Conf.ReadValue("goodchan","name",k)))
                                                                goodchan = true;
                                                }
 
@@ -76,7 +68,6 @@ class ModuleDenyChannels : public Module
 
        virtual ~ModuleDenyChannels()
        {
-               delete Conf;
        }
 
        virtual Version GetVersion()
@@ -87,22 +78,23 @@ class ModuleDenyChannels : public Module
 
        virtual ModResult OnUserPreJoin(User* user, Channel* chan, const char* cname, std::string &privs, const std::string &keygiven)
        {
-               for (int j =0; j < Conf->Enumerate("badchan"); j++)
+               ConfigReader Conf;
+               for (int j =0; j < Conf.Enumerate("badchan"); j++)
                {
-                       if (InspIRCd::Match(cname, Conf->ReadValue("badchan","name",j)))
+                       if (InspIRCd::Match(cname, Conf.ReadValue("badchan","name",j)))
                        {
-                               if (IS_OPER(user) && Conf->ReadFlag("badchan","allowopers",j))
+                               if (IS_OPER(user) && Conf.ReadFlag("badchan","allowopers",j))
                                {
                                        return MOD_RES_PASSTHRU;
                                }
                                else
                                {
-                                       std::string reason = Conf->ReadValue("badchan","reason",j);
-                                       std::string redirect = Conf->ReadValue("badchan","redirect",j);
+                                       std::string reason = Conf.ReadValue("badchan","reason",j);
+                                       std::string redirect = Conf.ReadValue("badchan","redirect",j);
 
-                                       for (int i = 0; i < Conf->Enumerate("goodchan"); i++)
+                                       for (int i = 0; i < Conf.Enumerate("goodchan"); i++)
                                        {
-                                               if (InspIRCd::Match(cname, Conf->ReadValue("goodchan", "name", i)))
+                                               if (InspIRCd::Match(cname, Conf.ReadValue("goodchan", "name", i)))
                                                {
                                                        return MOD_RES_PASSTHRU;
                                                }
index 5fedf08dd6a7cf8c2d670ddc69bb008a5879bd9c..d97ea940a8aecf05e5f55e8218ef434ec31a8c7b 100644 (file)
@@ -24,7 +24,7 @@
 /* $ModDesc: Provides handling of DNS blacklists */
 
 /* Class holding data for a single entry */
-class DNSBLConfEntry : public classbase
+class DNSBLConfEntry
 {
        public:
                enum EnumBanaction { I_UNKNOWN, I_KILL, I_ZLINE, I_KLINE, I_GLINE, I_MARK };
@@ -245,36 +245,36 @@ class ModuleDNSBL : public Module
         */
        virtual void ReadConf()
        {
-               ConfigReader *MyConf = new ConfigReader;
+               ConfigReader MyConf;
                ClearEntries();
 
-               for (int i=0; i< MyConf->Enumerate("dnsbl"); i++)
+               for (int i=0; i< MyConf.Enumerate("dnsbl"); i++)
                {
                        DNSBLConfEntry *e = new DNSBLConfEntry();
 
-                       e->name = MyConf->ReadValue("dnsbl", "name", i);
-                       e->ident = MyConf->ReadValue("dnsbl", "ident", i);
-                       e->host = MyConf->ReadValue("dnsbl", "host", i);
-                       e->reason = MyConf->ReadValue("dnsbl", "reason", i);
-                       e->domain = MyConf->ReadValue("dnsbl", "domain", i);
+                       e->name = MyConf.ReadValue("dnsbl", "name", i);
+                       e->ident = MyConf.ReadValue("dnsbl", "ident", i);
+                       e->host = MyConf.ReadValue("dnsbl", "host", i);
+                       e->reason = MyConf.ReadValue("dnsbl", "reason", i);
+                       e->domain = MyConf.ReadValue("dnsbl", "domain", i);
 
-                       if (MyConf->ReadValue("dnsbl", "type", i) == "bitmask")
+                       if (MyConf.ReadValue("dnsbl", "type", i) == "bitmask")
                        {
                                e->type = DNSBLConfEntry::A_BITMASK;
-                               e->bitmask = MyConf->ReadInteger("dnsbl", "bitmask", i, false);
+                               e->bitmask = MyConf.ReadInteger("dnsbl", "bitmask", i, false);
                        }
                        else
                        {
                                memset(e->records, 0, sizeof(e->records));
                                e->type = DNSBLConfEntry::A_RECORD;
-                               irc::portparser portrange(MyConf->ReadValue("dnsbl", "records", i), false);
+                               irc::portparser portrange(MyConf.ReadValue("dnsbl", "records", i), false);
                                long item = -1;
                                while ((item = portrange.GetToken()))
                                        e->records[item] = 1;
                        }
 
-                       e->banaction = str2banaction(MyConf->ReadValue("dnsbl", "action", i));
-                       e->duration = ServerInstance->Duration(MyConf->ReadValue("dnsbl", "duration", "60", i));
+                       e->banaction = str2banaction(MyConf.ReadValue("dnsbl", "action", i));
+                       e->duration = ServerInstance->Duration(MyConf.ReadValue("dnsbl", "duration", "60", i));
 
                        /* Use portparser for record replies */
 
@@ -315,8 +315,6 @@ class ModuleDNSBL : public Module
                        /* delete and drop it, error somewhere */
                        delete e;
                }
-
-               delete MyConf;
        }
 
        virtual void OnRehash(User* user)
index 84d48cc386bebe94ac1932ee81b56d188194030f..2991b524e40360b923d596becc43d4ee952f1231 100644 (file)
@@ -421,7 +421,7 @@ class ModuleHttpServer : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Provides HTTP serving facilities to modules", VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Provides HTTP serving facilities to modules", VF_VENDOR);
        }
 };
 
index 7669d63d752c7bf7c9c0f0814deea1a6571048a3..6ac9c3d87f78664a762f5a802b8aadb38c67cc9b 100644 (file)
@@ -39,7 +39,7 @@ typedef unsigned char byte;
 
 /** An MD5 context, used by m_opermd5
  */
-class MD5Context : public classbase
+class MD5Context
 {
  public:
        word32 buf[4];
@@ -296,7 +296,7 @@ class ModuleMD5 : public Module
 
        Version GetVersion()
        {
-               return Version("Allows for MD5 encrypted oper passwords",VF_VENDOR|VF_SERVICEPROVIDER);
+               return Version("Allows for MD5 encrypted oper passwords",VF_VENDOR);
        }
 };
 
index af6e962cf582caa27577ab97294e9e7039bf80a4..5e919dad672729e097211291cf33e36e15cd2182 100755 (executable)
@@ -243,15 +243,14 @@ class ModuleNationalChars : public Module
 
        virtual void OnRehash(User* user)
        {
-               ConfigReader* conf = new ConfigReader;
-               charset = conf->ReadValue("nationalchars", "file", 0);
-               casemapping = conf->ReadValue("nationalchars", "casemapping", charset, 0, false);
+               ConfigReader conf;
+               charset = conf.ReadValue("nationalchars", "file", 0);
+               casemapping = conf.ReadValue("nationalchars", "casemapping", charset, 0, false);
                charset.insert(0, "../locales/");
                unsigned char * tables[8] = { m_additional, m_additionalMB, m_additionalUp, m_lower, m_upper, m_additionalUtf8, m_additionalUtf8range, m_additionalUtf8interval };
                loadtables(charset, tables, 8, 5);
-               forcequit = conf->ReadFlag("nationalchars", "forcequit", 0);
+               forcequit = conf.ReadFlag("nationalchars", "forcequit", 0);
                CheckForceQuit("National character set changed");
-               delete conf;
        }
 
        void CheckForceQuit(const char * message)
index 772bef525c39aa9a0f86afd8ff5af7072f5620eb..42b30f6fb1f7740a80ebccdad17d1ff5fd6fe82c 100644 (file)
@@ -43,36 +43,35 @@ class ModuleOperjoin : public Module
                }
 
        public:
-               ModuleOperjoin()                {
+               ModuleOperjoin()
+               {
                        OnRehash(NULL);
-               Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
+                       Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
+                       ServerInstance->Modules->Attach(eventlist, this, 2);
                }
 
 
                virtual void OnRehash(User* user)
                {
-                       ConfigReader* conf = new ConfigReader;
+                       ConfigReader conf;
 
-                       operChan = conf->ReadValue("operjoin", "channel", 0);
-                       override = conf->ReadFlag("operjoin", "override", "0", 0);
+                       operChan = conf.ReadValue("operjoin", "channel", 0);
+                       override = conf.ReadFlag("operjoin", "override", "0", 0);
                        operChans.clear();
                        if (!operChan.empty())
                                tokenize(operChan,operChans);
 
                        std::map<std::string, std::vector<std::string> >().swap(operTypeChans);
 
-                       int olines = conf->Enumerate("type");
+                       int olines = conf.Enumerate("type");
                        for (int index = 0; index < olines; ++index)
                        {
-                               std::string chanList = conf->ReadValue("type", "autojoin", index);
+                               std::string chanList = conf.ReadValue("type", "autojoin", index);
                                if (!chanList.empty())
                                {
-                                       tokenize(chanList, operTypeChans[conf->ReadValue("type", "name", index)]);
+                                       tokenize(chanList, operTypeChans[conf.ReadValue("type", "name", index)]);
                                }
                        }
-
-                       delete conf;
                }
 
                virtual ~ModuleOperjoin()
index 6ed0c2a530cf0ec320f2a6ac4dd25f5aeb37b6e7..7a18991c1afc48cb7da54bb1a05120b3fb68622e 100644 (file)
 /* $ModDesc: Gives each oper type a 'level', cannot kill opers 'above' your level. */
 class ModuleOperLevels : public Module
 {
-       private:
-               ConfigReader* conf;
        public:
                ModuleOperLevels()
-                                       {
-                       conf = new ConfigReader;
+               {
                        Implementation eventlist[] = { I_OnRehash, I_OnKill };
                        ServerInstance->Modules->Attach(eventlist, this, 2);
                }
 
                virtual ~ModuleOperLevels()
                {
-                       delete conf;
                }
 
 
                virtual void OnRehash(User* user)
                {
-                       delete conf;
-                       conf = new ConfigReader;
                }
 
                virtual Version GetVersion()
@@ -45,29 +39,19 @@ class ModuleOperLevels : public Module
 
                virtual ModResult OnKill(User* source, User* dest, const std::string &reason)
                {
-                       long dest_level = 0,source_level = 0;
-
                        // oper killing an oper?
                        if (IS_OPER(dest) && IS_OPER(source))
                        {
-                               for (int j =0; j < conf->Enumerate("type"); j++)
-                               {
-                                       std::string typen = conf->ReadValue("type","name",j);
-                                       if (typen == dest->oper)
-                                       {
-                                               dest_level = conf->ReadInteger("type","level",j,true);
-                                               break;
-                                       }
-                               }
-                               for (int k =0; k < conf->Enumerate("type"); k++)
-                               {
-                                       std::string typen = conf->ReadValue("type","name",k);
-                                       if (typen == source->oper)
-                                       {
-                                               source_level = conf->ReadInteger("type","level",k,true);
-                                               break;
-                                       }
-                               }
+                               TagIndex::iterator dest_type = ServerInstance->Config->opertypes.find(dest->oper);
+                               TagIndex::iterator src_type = ServerInstance->Config->opertypes.find(source->oper);
+
+                               if (dest_type == ServerInstance->Config->opertypes.end())
+                                       return MOD_RES_PASSTHRU;
+                               if (src_type == ServerInstance->Config->opertypes.end())
+                                       return MOD_RES_PASSTHRU;
+
+                               long dest_level = dest_type->second->getInt("level");
+                               long source_level = src_type->second->getInt("level");
                                if (dest_level > source_level)
                                {
                                        if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str());
index d4b873918e9019e953a8337f28920908cd5119d2..9db0b5b4ad64feb5e6dce64973f7abb0d70fada9 100644 (file)
 
 class ModuleModesOnOper : public Module
 {
- private:
-
-
-       ConfigReader *Conf;
-
  public:
        ModuleModesOnOper()
-                       {
-
-               Conf = new ConfigReader;
+       {
                Implementation eventlist[] = { I_OnPostOper, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 2);
        }
@@ -34,13 +27,10 @@ class ModuleModesOnOper : public Module
 
        virtual void OnRehash(User* user)
        {
-               delete Conf;
-               Conf = new ConfigReader;
        }
 
        virtual ~ModuleModesOnOper()
        {
-               delete Conf;
        }
 
        virtual Version GetVersion()
@@ -50,36 +40,33 @@ class ModuleModesOnOper : public Module
 
        virtual void OnPostOper(User* user, const std::string &opertype, const std::string &opername)
        {
+               TagIndex::iterator typetag = ServerInstance->Config->opertypes.find(opertype);
+               if (typetag == ServerInstance->Config->opertypes.end())
+                       return;
                // whenever a user opers, go through the oper types, find their <type:modes>,
                // and if they have one apply their modes. The mode string can contain +modes
                // to add modes to the user or -modes to take modes from the user.
-               for (int j =0; j < Conf->Enumerate("type"); j++)
+               std::string ThisOpersModes = typetag->second->getString("modes");
+               if (!ThisOpersModes.empty())
                {
-                       std::string typen = Conf->ReadValue("type","name",j);
-                       if (typen == user->oper)
-                       {
-                               std::string ThisOpersModes = Conf->ReadValue("type","modes",j);
-                               if (!ThisOpersModes.empty())
-                               {
-                                       ApplyModes(user, ThisOpersModes);
-                               }
-                               break;
-                       }
+                       ApplyModes(user, ThisOpersModes);
                }
 
                if (!opername.empty()) // if user is local ..
                {
-                       for (int j = 0; j < Conf->Enumerate("oper"); j++)
+                       for (int i = 0;; i++)
                        {
-                               if (opername == Conf->ReadValue("oper", "name", j))
-                               {
-                                       std::string ThisOpersModes = Conf->ReadValue("oper", "modes", j);
-                                       if (!ThisOpersModes.empty())
-                                       {
-                                               ApplyModes(user, ThisOpersModes);
-                                       }
+                               ConfigTag* tag = ServerInstance->Config->ConfValue("oper", i);
+                               if (!tag)
                                        break;
+                               if (tag->getString("name") != opername)
+                                       continue;
+                               ThisOpersModes = tag->getString("modes");
+                               if (!ThisOpersModes.empty())
+                               {
+                                       ApplyModes(user, ThisOpersModes);
                                }
+                               break;
                        }
                }
        }
index a9f7b3b0742aa5e61bd996b3a8cd0da3936e9aa6..a4956f05f35f0cd1d556a0f52352bdee70d14294 100644 (file)
@@ -63,17 +63,12 @@ class ModuleOpermotd : public Module
 
        void LoadOperMOTD()
        {
-               ConfigReader* conf = new ConfigReader;
+               ConfigReader conf;
                std::string filename;
-               filename = conf->ReadValue("opermotd","file",0);
-               if (opermotd)
-               {
-                       delete opermotd;
-                       opermotd = NULL;
-               }
+               filename = conf.ReadValue("opermotd","file",0);
+               delete opermotd;
                opermotd = new FileReader(filename);
-               onoper = conf->ReadFlag("opermotd","onoper","yes",0);
-               delete conf;
+               onoper = conf.ReadFlag("opermotd","onoper","yes",0);
        }
 
        ModuleOpermotd()
index 3cdf4f30df4ae7389cf98be97081120a5a63a033..f6925e9740eab5614dec68fc9d168caa7c24062a 100644 (file)
@@ -55,19 +55,17 @@ class ModuleRandQuote : public Module
 {
  private:
        CommandRandquote cmd;
-       ConfigReader *conf;
  public:
        ModuleRandQuote()
                : cmd(this)
        {
-
-               conf = new ConfigReader;
+               ConfigReader conf;
                // Sort the Randomizer thingie..
                srand(ServerInstance->Time());
 
-               q_file = conf->ReadValue("randquote","file",0);
-               prefix = conf->ReadValue("randquote","prefix",0);
-               suffix = conf->ReadValue("randquote","suffix",0);
+               q_file = conf.ReadValue("randquote","file",0);
+               prefix = conf.ReadValue("randquote","prefix",0);
+               suffix = conf.ReadValue("randquote","suffix",0);
 
                if (q_file.empty())
                {
@@ -91,7 +89,6 @@ class ModuleRandQuote : public Module
 
        virtual ~ModuleRandQuote()
        {
-               delete conf;
                delete quotes;
        }
 
index a3923205f9321771683372beb739d9282dc79759..42cc0abd1d0d3e522f114f2871adfdbe4d0ce6a3 100644 (file)
@@ -42,7 +42,7 @@ public:
 
        virtual Version GetVersion()
        {
-               return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Regex module using plain wildcard matching.", VF_OPTCOMMON | VF_VENDOR);
        }
 
        virtual ~ModuleRegexGlob()
index 12c373ab85b3887d9a2b94376213d7d734f68536..8cc882d9050e736d0d387180a92e6962dc5fbf9c 100644 (file)
 
 class ModuleRestrictChans : public Module
 {
-
-
-       std::map<irc::string,int> allowchans;
+       std::set<irc::string> allowchans;
 
        void ReadConfig()
        {
-               ConfigReader* MyConf = new ConfigReader;
                allowchans.clear();
-               for (int i = 0; i < MyConf->Enumerate("allowchannel"); i++)
+               for (int i = 0;; i++)
                {
-                       std::string txt;
-                       txt = MyConf->ReadValue("allowchannel", "name", i);
-                       irc::string channel = txt.c_str();
-                       allowchans[channel] = 1;
+                       ConfigTag* tag = ServerInstance->Config->ConfValue("allowchannel", i);
+                       if (!tag)
+                               return;
+                       std::string txt = tag->getString("name");
+                       allowchans.insert(txt.c_str());
                }
-               delete MyConf;
        }
 
  public:
        ModuleRestrictChans()
-                       {
-
+       {
                ReadConfig();
                Implementation eventlist[] = { I_OnUserPreJoin, I_OnRehash };
                ServerInstance->Modules->Attach(eventlist, this, 2);
index b8647b3a91502aa9990f80a83d4fa4b4afce3b1b..03a7f9895cb719370266647b1c742badfdee24b1 100644 (file)
@@ -465,7 +465,7 @@ class ModuleRIPEMD160 : public Module
 
        virtual Version GetVersion()
        {
-               return Version("Allows for RIPEMD-160 encrypted oper passwords", VF_VENDOR|VF_SERVICEPROVIDER);
+               return Version("Allows for RIPEMD-160 encrypted oper passwords", VF_VENDOR);
        }
 
 };
index 91dc3a0cde6f6a2c6cfb9e3ce43a0fb2acff1400..c553aa7423f2c30fa7f1ec4f0945b24a79059970 100644 (file)
@@ -38,14 +38,13 @@ class ModuleSecureList : public Module
 
        void OnRehash(User* user)
        {
-               ConfigReader* MyConf = new ConfigReader;
+               ConfigReader MyConf;
                allowlist.clear();
 
-               for (int i = 0; i < MyConf->Enumerate("securehost"); i++)
-                       allowlist.push_back(MyConf->ReadValue("securehost", "exception", i));
+               for (int i = 0; i < MyConf.Enumerate("securehost"); i++)
+                       allowlist.push_back(MyConf.ReadValue("securehost", "exception", i));
 
-               WaitTime = MyConf->ReadInteger("securelist", "waittime", "60", 0, true);
-               delete MyConf;
+               WaitTime = MyConf.ReadInteger("securelist", "waittime", "60", 0, true);
        }
 
 
index 1f967207b27fb49e2ef26d8fe2e11c02d28c279c..7856b296bcc3adbcc972748a3488c543b8696687 100644 (file)
@@ -62,7 +62,7 @@ typedef unsigned int uint32_t;
 
 /** An sha 256 context, used by m_opersha256
  */
-class SHA256Context : public classbase
+class SHA256Context
 {
  public:
        unsigned int tot_len;
@@ -273,7 +273,7 @@ class ModuleSHA256 : public Module
 
        Version GetVersion()
        {
-               return Version("Allows for SHA-256 encrypted oper passwords", VF_VENDOR|VF_SERVICEPROVIDER);
+               return Version("Allows for SHA-256 encrypted oper passwords", VF_VENDOR);
        }
 };
 
index 024605a7918d0d009348ea051d90f966537c7679..c4d5755e6e60f4c6d2bd99bd66ea4c0912f47a7b 100644 (file)
@@ -381,16 +381,16 @@ void SpanningTreeUtilities::RefreshIPCache()
 
 void SpanningTreeUtilities::ReadConfiguration(bool rebind)
 {
-       ConfigReader* Conf = new ConfigReader;
+       ConfigReader Conf;
 
        if (rebind)
        {
-               for (int j = 0; j < Conf->Enumerate("bind"); j++)
+               for (int j = 0; j < Conf.Enumerate("bind"); j++)
                {
-                       std::string Type = Conf->ReadValue("bind","type",j);
-                       std::string IP = Conf->ReadValue("bind","address",j);
-                       std::string Port = Conf->ReadValue("bind","port",j);
-                       std::string ssl = Conf->ReadValue("bind","ssl",j);
+                       std::string Type = Conf.ReadValue("bind","type",j);
+                       std::string IP = Conf.ReadValue("bind","address",j);
+                       std::string Port = Conf.ReadValue("bind","port",j);
+                       std::string ssl = Conf.ReadValue("bind","ssl",j);
                        if (Type == "servers")
                        {
                                irc::portparser portrange(Port, false);
@@ -413,14 +413,14 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
                        }
                }
        }
-       FlatLinks = Conf->ReadFlag("security","flatlinks",0);
-       HideULines = Conf->ReadFlag("security","hideulines",0);
-       AnnounceTSChange = Conf->ReadFlag("options","announcets",0);
-       AllowOptCommon = Conf->ReadFlag("options", "allowmismatch", 0);
-       ChallengeResponse = !Conf->ReadFlag("security", "disablehmac", 0);
-       quiet_bursts = Conf->ReadFlag("performance", "quietbursts", 0);
-       PingWarnTime = Conf->ReadInteger("options", "pingwarning", 0, true);
-       PingFreq = Conf->ReadInteger("options", "serverpingfreq", 0, true);
+       FlatLinks = Conf.ReadFlag("security","flatlinks",0);
+       HideULines = Conf.ReadFlag("security","hideulines",0);
+       AnnounceTSChange = Conf.ReadFlag("options","announcets",0);
+       AllowOptCommon = Conf.ReadFlag("options", "allowmismatch", 0);
+       ChallengeResponse = !Conf.ReadFlag("security", "disablehmac", 0);
+       quiet_bursts = Conf.ReadFlag("performance", "quietbursts", 0);
+       PingWarnTime = Conf.ReadInteger("options", "pingwarning", 0, true);
+       PingFreq = Conf.ReadInteger("options", "serverpingfreq", 0, true);
 
        if (PingFreq == 0)
                PingFreq = 60;
@@ -431,22 +431,22 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
        AutoconnectBlocks.clear();
        LinkBlocks.clear();
        ValidIPs.clear();
-       for (int j = 0; j < Conf->Enumerate("link"); ++j)
+       for (int j = 0; j < Conf.Enumerate("link"); ++j)
        {
                reference<Link> L = new Link;
-               std::string Allow = Conf->ReadValue("link", "allowmask", j);
-               L->Name = (Conf->ReadValue("link", "name", j)).c_str();
+               std::string Allow = Conf.ReadValue("link", "allowmask", j);
+               L->Name = (Conf.ReadValue("link", "name", j)).c_str();
                L->AllowMask = Allow;
-               L->IPAddr = Conf->ReadValue("link", "ipaddr", j);
-               L->Port = Conf->ReadInteger("link", "port", j, true);
-               L->SendPass = Conf->ReadValue("link", "sendpass", j);
-               L->RecvPass = Conf->ReadValue("link", "recvpass", j);
-               L->Fingerprint = Conf->ReadValue("link", "fingerprint", j);
-               L->HiddenFromStats = Conf->ReadFlag("link", "statshidden", j);
-               L->Timeout = Conf->ReadInteger("link", "timeout", j, true);
-               L->Hook = Conf->ReadValue("link", "ssl", j);
-               L->Bind = Conf->ReadValue("link", "bind", j);
-               L->Hidden = Conf->ReadFlag("link", "hidden", j);
+               L->IPAddr = Conf.ReadValue("link", "ipaddr", j);
+               L->Port = Conf.ReadInteger("link", "port", j, true);
+               L->SendPass = Conf.ReadValue("link", "sendpass", j);
+               L->RecvPass = Conf.ReadValue("link", "recvpass", j);
+               L->Fingerprint = Conf.ReadValue("link", "fingerprint", j);
+               L->HiddenFromStats = Conf.ReadFlag("link", "statshidden", j);
+               L->Timeout = Conf.ReadInteger("link", "timeout", j, true);
+               L->Hook = Conf.ReadValue("link", "ssl", j);
+               L->Bind = Conf.ReadValue("link", "bind", j);
+               L->Hidden = Conf.ReadFlag("link", "hidden", j);
 
                if (L->Name.find('.') == std::string::npos)
                        throw CoreException("The link name '"+assign(L->Name)+"' is invalid and must contain at least one '.' character");
@@ -524,13 +524,13 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
                LinkBlocks.push_back(L);
        }
 
-       for (int j = 0; j < Conf->Enumerate("autoconnect"); ++j)
+       for (int j = 0; j < Conf.Enumerate("autoconnect"); ++j)
        {
                reference<Autoconnect> A = new Autoconnect;
-               A->Period = Conf->ReadInteger("autoconnect", "period", j, true);
+               A->Period = Conf.ReadInteger("autoconnect", "period", j, true);
                A->NextConnectTime = ServerInstance->Time() + A->Period;
                A->position = -1;
-               std::string servers = Conf->ReadValue("autoconnect", "server", j);
+               std::string servers = Conf.ReadValue("autoconnect", "server", j);
                irc::spacesepstream ss(servers);
                std::string server;
                while (ss.GetToken(server))
@@ -550,8 +550,6 @@ void SpanningTreeUtilities::ReadConfiguration(bool rebind)
 
                AutoconnectBlocks.push_back(A);
        }
-
-       delete Conf;
 }
 
 Link* SpanningTreeUtilities::FindLink(const std::string& name)
index 269f70ad0ba37ae11eb948226c18a55632aa8b39..28f32ec26cec4ef4aca644a46c05679b32f4695a 100644 (file)
@@ -218,7 +218,7 @@ public:
 
        Version GetVersion()
        {
-               return Version("Provides some utilities to SQL client modules, such as mapping queries to users and channels", VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("Provides some utilities to SQL client modules, such as mapping queries to users and channels", VF_VENDOR);
        }
 
 };
index 31a209d4e817c418f9fb512cdcabdb1334c8f25e..0ab749703bfec88eb9de3aa9d569fad102278488 100644 (file)
@@ -135,7 +135,7 @@ class ModuleSSLInfo : public Module
 
        Version GetVersion()
        {
-               return Version("SSL Certificate Utilities", VF_VENDOR | VF_SERVICEPROVIDER);
+               return Version("SSL Certificate Utilities", VF_VENDOR);
        }
 
        void OnWhois(User* source, User* dest)
index a8f7b98e6817556ffad45cb3fbda19f4c953b7aa..18c2a1eb059fbded40b417dccd88fe47c5576a14 100644 (file)
@@ -27,29 +27,28 @@ class CommandVhost : public Command
 
        CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
-               ConfigReader *Conf = new ConfigReader;
-
-               for (int index = 0; index < Conf->Enumerate("vhost"); index++)
+               for (int index = 0;; index++)
                {
-                       std::string mask = Conf->ReadValue("vhost","host",index);
-                       std::string username = Conf->ReadValue("vhost","user",index);
-                       std::string pass = Conf->ReadValue("vhost","pass",index);
-                       std::string hash = Conf->ReadValue("vhost","hash",index);
+                       ConfigTag* tag = ServerInstance->Config->ConfValue("vhost", index);
+                       if (!tag)
+                               break;
+                       std::string mask = tag->getString("host");
+                       std::string username = tag->getString("user");
+                       std::string pass = tag->getString("pass");
+                       std::string hash = tag->getString("hash");
 
-                       if ((!strcmp(parameters[0].c_str(),username.c_str())) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()))
+                       if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash))
                        {
                                if (!mask.empty())
                                {
-                                       user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
+                                       user->WriteServ("NOTICE "+user->nick+" :Setting your VHost: " + mask);
                                        user->ChangeDisplayedHost(mask.c_str());
-                                       delete Conf;
                                        return CMD_SUCCESS;
                                }
                        }
                }
 
                user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
-               delete Conf;
                return CMD_FAILURE;
        }
 };