diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-18 16:01:33 +0000 |
commit | a59d08fffd3dc8a9850ce34c9928fb6382b9b37f (patch) | |
tree | 1d5debd7915dddc122feec50443f42d535cba311 /src/modules/m_restrictchans.cpp | |
parent | da6e45397e4ee86d6caf86d2fd5fd8f77af48a1e (diff) |
Remove VF_SERVICEPROVIDER, prevent heap allocation of ConfigReader
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11904 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_restrictchans.cpp')
-rw-r--r-- | src/modules/m_restrictchans.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 12c373ab8..8cc882d90 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -17,28 +17,24 @@ 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); |