diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-04-23 09:43:44 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-04-23 09:43:44 +0000 |
commit | 80562f021ec5144326fb940422bfbd974bb74732 (patch) | |
tree | 350a55451884c1f3ebab276ffedebf0c8e1a1592 /protocols/FacebookRM/src/communication.cpp | |
parent | 775eca92d90a473e087d4598a8539b7842c631b0 (diff) |
Facebook: Fixed loading own name and saving names improvements + hidden setting "NameAsNick" to not save real name as nickname (but it's pretty useless/ugly now)
git-svn-id: http://svn.miranda-ng.org/main/trunk@9054 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 4f538f62a5..5b44a7e9f1 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -916,12 +916,23 @@ bool facebook_client::home() {
case HTTP_CODE_OK:
{
- // Get real_name
+ // Get real name
this->self_.real_name = utils::text::source_get_value(&resp.data, 2, "<strong class=\"profileName\">", "</strong>");
- if (!this->self_.real_name.empty()) {
- parent->SaveName(NULL, &this->self_);
- parent->debugLogA(" Got self real name: %s", this->self_.real_name.c_str());
- } else {
+
+ // Get and strip optional nickname
+ std::string::size_type pos = this->self_.real_name.find("<span class=\"alternate_name\">");
+ if (pos != std::string::npos) {
+ this->self_.nick = utils::text::source_get_value(&this->self_.real_name, 2, "<span class=\"alternate_name\">(", ")</span>");
+ parent->debugLogA(" Got self nick name: %s", this->self_.nick.c_str());
+
+ this->self_.real_name = this->self_.real_name.substr(0, pos - 1);
+ }
+ parent->debugLogA(" Got self real name: %s", this->self_.real_name.c_str());
+
+ // Save name and nickname
+ parent->SaveName(NULL, &this->self_);
+
+ if (this->self_.real_name.empty()) {
client_notify(TranslateT("Something happened to Facebook. Maybe there was some major update so you should wait for an update."));
return handle_error("home", FORCE_QUIT);
}
|