From 0ca1aa58d74ee743423602467cedda686e311bc1 Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 2 Feb 2010 15:02:25 +0000 Subject: Sort items in the 005 line git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12351 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/configreader.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index 109137787..183e78a12 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -51,28 +51,29 @@ ServerConfig::ServerConfig() void ServerConfig::Update005() { std::stringstream out(data005); + std::vector 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); } } -- cgit v1.2.3