summaryrefslogtreecommitdiff
path: root/src/playerrelations.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-01 21:49:35 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-01 21:49:35 +0300
commitec552e6430ac86b1234c9a7798bf4e028a3c78c0 (patch)
tree10cd93cf86dca5ce2074b362dc7e4db1c0e2b03d /src/playerrelations.cpp
parent170aae70566003a30ab1f6f936364484f6a0a097 (diff)
downloadplus-ec552e6430ac86b1234c9a7798bf4e028a3c78c0.tar.gz
plus-ec552e6430ac86b1234c9a7798bf4e028a3c78c0.tar.bz2
plus-ec552e6430ac86b1234c9a7798bf4e028a3c78c0.tar.xz
plus-ec552e6430ac86b1234c9a7798bf4e028a3c78c0.zip
Set secure font in chat tab name if need.
Diffstat (limited to 'src/playerrelations.cpp')
-rw-r--r--src/playerrelations.cpp40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index 87318ff43..7ff410064 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -494,6 +494,20 @@ PlayerRelationsManager::getPlayerIgnoreStrategies()
return &mIgnoreStrategies;
}
+bool PlayerRelationsManager::isGoodName(std::string name)
+{
+ bool status(false);
+
+ const int size = name.size();
+
+ if (size < 3 || mRelations[name])
+ return true;
+
+ status = checkName(name);
+
+ return status;
+}
+
bool PlayerRelationsManager::isGoodName(Being *being)
{
bool status(false);
@@ -505,21 +519,29 @@ bool PlayerRelationsManager::isGoodName(Being *being)
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;
+
+ status = checkName(name);
being->setGoodStatus(status ? 1 : 0);
return status;
}
+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) == " ")
+ 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;