summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-04 23:49:29 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-05 02:05:57 +0300
commit77d5f27e2a8162a05ad37cba16cb054c3ad0d210 (patch)
tree4ee9a1fab43d9842dd8d1f44808767565148b024
parent7b72cf9d4c1f737f1ff5a1018785b92bc5feae31 (diff)
downloadmanaverse-77d5f27e2a8162a05ad37cba16cb054c3ad0d210.tar.gz
manaverse-77d5f27e2a8162a05ad37cba16cb054c3ad0d210.tar.bz2
manaverse-77d5f27e2a8162a05ad37cba16cb054c3ad0d210.tar.xz
manaverse-77d5f27e2a8162a05ad37cba16cb054c3ad0d210.zip
Add additional checks for unsecure chars:
for double space, for last dot in nick.
-rw-r--r--src/playerrelations.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 1bf63aa81..81338de74 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -574,14 +574,24 @@ bool PlayerRelationsManager::checkName(const std::string &name) const
const int size = name.size();
std::string check = config.getStringValue("unsecureChars");
- if (name.substr(0, 1) == " " || name.substr(size - 1, 1) == " ")
+ std::string lastChar = name.substr(size - 1, 1);
+ if (name.substr(0, 1) == " " || lastChar == " " || lastChar == "."
+ || name.find(" ") != std::string::npos)
+ {
return false;
+ }
else if (check.empty())
+ {
return true;
+ }
else if (name.find_first_of(check) != std::string::npos)
+ {
return false;
+ }
else
+ {
return true;
+ }
}
PlayerRelationsManager player_relations;