summaryrefslogtreecommitdiff
path: root/src/playerrelations.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-01 03:03:12 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-01 03:07:13 +0300
commit09ebcebf32be3842d6158c3145492fbf2959440e (patch)
tree44970b335330ca56ab38d06f083fa005f1c53ca5 /src/playerrelations.cpp
parentfdb8081a82ec85c9ff23a89a82f81240d8bcaec9 (diff)
downloadplus-09ebcebf32be3842d6158c3145492fbf2959440e.tar.gz
plus-09ebcebf32be3842d6158c3145492fbf2959440e.tar.bz2
plus-09ebcebf32be3842d6158c3145492fbf2959440e.tar.xz
plus-09ebcebf32be3842d6158c3145492fbf2959440e.zip
Add setup option for finding bad chars in nicks.
Highlight bad nicks on map with secure font.
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r--src/playerrelations.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index f41ea5e4d..87318ff43 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -494,5 +494,32 @@ PlayerRelationsManager::getPlayerIgnoreStrategies()
return &mIgnoreStrategies;
}
+bool PlayerRelationsManager::isGoodName(Being *being)
+{
+ bool status(false);
+
+ if (!being)
+ return false;
+ if (being->getGoodStatus() != -1)
+ return (being->getGoodStatus() == 1);
+
+ const std::string name = being->getName();
+ const int size = name.size();
+ std::string check = config.getStringValue("unsecureChars");
+
+ if (size < 3 || mRelations[name])
+ return true;
+ else if (name.substr(0, 1) == " " || name.substr(size - 1, 1) == " ")
+ status = false;
+ else if (check.empty())
+ status = true;
+ else if (name.find_first_of(check) != std::string::npos)
+ status = false;
+ else
+ status = true;
+
+ being->setGoodStatus(status ? 1 : 0);
+ return status;
+}
PlayerRelationsManager player_relations;