diff options
author | Robert Pösel <robyer@seznam.cz> | 2015-09-01 21:17:12 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2015-09-01 21:17:12 +0000 |
commit | fd575b8d81b020cebcb03e5aedfe7c045be5a701 (patch) | |
tree | 0edd1c29fc25c91240b6a9bd27f32ad01901b8e4 /protocols/FacebookRM/src | |
parent | 62869feea2d58ccc8d585803305994b3fd529792 (diff) |
Facebook: Fix showing correct error message (e.g. when sending messages)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15140 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 13b60b3c20..5009d93bca 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -146,8 +146,14 @@ http::response facebook_client::flap(RequestType request_type, std::string *post pos = resp.data.find("\"errorDescription\":\"", pos); if (pos != std::string::npos) { pos += 20; - error = resp.data.substr(pos, resp.data.find("\"", pos) - pos); - error = utils::text::trim(utils::text::html_entities_decode(utils::text::slashu_to_utf8(error))); + + std::string::size_type pos2 = resp.data.find("\",\"", pos); + if (pos2 == std::string::npos) { + pos2 = resp.data.find("\"", pos); + } + + error = resp.data.substr(pos, pos2 - pos); + error = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(utils::text::slashu_to_utf8(error)))); error = ptrA(mir_utf8decodeA(error.c_str())); } @@ -156,7 +162,7 @@ http::response facebook_client::flap(RequestType request_type, std::string *post if (pos != std::string::npos) { pos += 16; title = resp.data.substr(pos, resp.data.find("\"", pos) - pos); - title = utils::text::trim(utils::text::html_entities_decode(utils::text::slashu_to_utf8(title))); + title = utils::text::trim(utils::text::html_entities_decode(utils::text::remove_html(utils::text::slashu_to_utf8(title)))); title = ptrA(mir_utf8decodeA(title.c_str())); } @@ -1337,6 +1343,8 @@ int facebook_client::send_message(int seqid, MCONTACT hContact, const std::strin } return SEND_MESSAGE_CANCEL; // Cancel because we failed to load captcha image so we can't continue only with error + //case 1404123: // Blocked sending messages (with URLs) because Facebook think our computer is infected with malware + default: // Other error parent->debugLogA("!!! Send message error #%d: %s", resp.error_number, resp.error_text.c_str()); return SEND_MESSAGE_ERROR; |