summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/utils.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-03-04 12:05:53 +0000
committerRobert Pösel <robyer@seznam.cz>2015-03-04 12:05:53 +0000
commitb8f9685565a64b1d04d545bfa1ffead2a84547cc (patch)
treeb170497a4e606728e892118bc7c9d2033db5f9e4 /protocols/FacebookRM/src/utils.cpp
parent1d7cce364ec2c9793463072063c4f7bb087f5071 (diff)
Facebook: Use participant names in chatroom name / seen info in "Firstname S." format
git-svn-id: http://svn.miranda-ng.org/main/trunk@12312 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/utils.cpp')
-rw-r--r--protocols/FacebookRM/src/utils.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp
index f277103203..383aac5d4b 100644
--- a/protocols/FacebookRM/src/utils.cpp
+++ b/protocols/FacebookRM/src/utils.cpp
@@ -456,6 +456,24 @@ std::string utils::text::source_get_form_data(std::string* data)
return values;
}
+std::tstring utils::text::prepare_name(const std::tstring &name, bool withSurnameLetter)
+{
+ std::tstring::size_type pos = name.find(_T(" "));
+ if (pos == std::tstring::npos)
+ return name;
+
+ std::tstring result = name.substr(0, pos);
+
+ if (withSurnameLetter) {
+ pos = name.rfind(_T(" ")) + 1; // we're sure there is some space in name so we can do +1 safely
+
+ if (pos < name.length())
+ result += _T(" ") + name.substr(pos, 1) + std::tstring(_T("."));
+ }
+
+ return result;
+}
+
std::string utils::text::rand_string(int len, const char *chars, unsigned int *number)
{
std::stringstream out;