summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-02 15:02:25 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-02 15:02:25 +0000
commit0ca1aa58d74ee743423602467cedda686e311bc1 (patch)
treeb5c7e1f6e48f19f2f499a6bd602ba6b7c2788259 /src
parentf910ad1ad2306e1831616dead705d974e3d1a132 (diff)
Sort items in the 005 line
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12351 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp23
-rw-r--r--src/helperfuncs.cpp11
2 files changed, 20 insertions, 14 deletions
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<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);
}
}
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index ffa30fb84..bba8dc8dc 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -396,13 +396,18 @@ std::string InspIRCd::TimeString(time_t curtime)
void InspIRCd::AddExtBanChar(char c)
{
std::string &tok = Config->data005;
- std::string::size_type ebpos;
+ std::string::size_type ebpos = tok.find(" EXTBAN=,");
- if ((ebpos = tok.find(" EXTBAN=,")) == std::string::npos)
+ if (ebpos == std::string::npos)
{
tok.append(" EXTBAN=,");
tok.push_back(c);
}
else
- tok.insert(ebpos + 9, 1, c);
+ {
+ ebpos += 9;
+ while (isalpha(tok[ebpos]) && tok[ebpos] < c)
+ ebpos++;
+ tok.insert(ebpos, 1, c);
+ }
}