]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Complain when duplicate tags are found using ConfValue
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 10 Mar 2010 01:39:46 +0000 (01:39 +0000)
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>
Wed, 10 Mar 2010 01:39:46 +0000 (01:39 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12616 e03df62e-2008-0410-955e-edbf42e46eb7

src/configreader.cpp

index 75f17b61ab2ad9ebf1e213d47dec9c725469e8b8..c8603f1556c86abfd6ac9620aa42783718d8a44c 100644 (file)
@@ -785,10 +785,15 @@ bool ServerConfig::StartsWithWindowsDriveLetter(const std::string &path)
 
 ConfigTag* ServerConfig::ConfValue(const std::string &tag)
 {
-       ConfigDataHash::iterator iter = config_data.find(tag);
-       if (iter == config_data.end())
+       ConfigTagList found = config_data.equal_range(tag);
+       if (found.first == found.second)
                return NULL;
-       return iter->second;
+       ConfigTag* rv = found.first->second;
+       found.first++;
+       if (found.first != found.second)
+               ServerInstance->Logs->Log("CONFIG",DEFAULT, "Multiple <" + tag + "> tags found; only first will be used "
+                       "(first at " + rv->getTagLocation() + "; second at " + found.first->second->getTagLocation() + ")");
+       return rv;
 }
 
 ConfigTagList ServerConfig::ConfTags(const std::string& tag)