void ServerConfig::Update005()
{
std::stringstream out(data005);
+ std::vector<std::string> data;
std::string token;
+ while (out >> token)
+ data.push_back(token);
+ sort(data.begin(), data.end());
+
std::string line5;
- int token_counter = 0;
isupport.clear();
- while (out >> token)
+ for(unsigned int i=0; i < data.size(); i++)
{
+ token = data[i];
line5 = line5 + token + " ";
- token_counter++;
- if (token_counter >= 13)
+ if (i % 13 == 12)
{
- char buf[MAXBUF];
- snprintf(buf, MAXBUF, "%s:are supported by this server", line5.c_str());
- isupport.push_back(buf);
+ line5.append(":are supported by this server");
+ isupport.push_back(line5);
line5.clear();
- token_counter = 0;
}
}
if (!line5.empty())
{
- char buf[MAXBUF];
- snprintf(buf, MAXBUF, "%s:are supported by this server", line5.c_str());
- isupport.push_back(buf);
+ line5.append(":are supported by this server");
+ isupport.push_back(line5);
}
}
me->name = name;
- tag->readString("password", me->pass);
- tag->readString("hash", me->hash);
me->registration_timeout = tag->getInt("timeout", me->registration_timeout);
me->pingtime = tag->getInt("pingfreq", me->pingtime);
std::string sendq;
me->fakelag = tag->getBool("fakelag", me->fakelag);
me->maxlocal = tag->getInt("localmax", me->maxlocal);
me->maxglobal = tag->getInt("globalmax", me->maxglobal);
- me->port = tag->getInt("port", me->port);
me->maxchans = tag->getInt("maxchans", me->maxchans);
me->limit = tag->getInt("limit", me->limit);
}
if (valid)
{
- ReadFile(MOTD, ConfValue("files")->getString("motd"));
- ReadFile(RULES, ConfValue("files")->getString("rules"));
DNSServer = ConfValue("dns")->getString("server");
FindDNS(DNSServer);
}
return config_data.equal_range(tag);
}
-/** Read the contents of a file located by `fname' into a file_cache pointed at by `F'.
- */
-bool ServerConfig::ReadFile(file_cache &F, const std::string& fname)
-{
- if (fname.empty())
- return false;
-
- char linebuf[MAXBUF];
-
- F.clear();
-
- FileWrapper file(fopen(fname.c_str(), "r"));
-
- if (!file)
- return false;
- while (!feof(file))
- {
- if (fgets(linebuf, sizeof(linebuf), file))
- linebuf[strlen(linebuf)-1] = 0;
- else
- *linebuf = 0;
-
- F.push_back(*linebuf ? linebuf : " ");
- }
-
- return true;
-}
-
bool ServerConfig::FileExists(const char* file)
{
struct stat sb;