]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_restrictchans.cpp
Delete modewatchers when unloading modules that use them to keep the server from...
[user/henk/code/inspircd.git] / src / modules / m_restrictchans.cpp
index 12c373ab85b3887d9a2b94376213d7d734f68536..557515fe041a307607715895758f4c572a28b0ed 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++)
+               ConfigTagList tags = ServerInstance->Config->ConfTags("allowchannel");
+               for(ConfigIter i = tags.first; i != tags.second; ++i)
                {
-                       std::string txt;
-                       txt = MyConf->ReadValue("allowchannel", "name", i);
-                       irc::string channel = txt.c_str();
-                       allowchans[channel] = 1;
+                       ConfigTag* tag = i->second;
+                       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);