diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-08-07 02:02:09 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-08-07 02:02:09 +0000 |
commit | 28837ed04f46a04b09b035ff97e28e53af171530 (patch) | |
tree | 501cde8c194d99d826d3c8b190e4be0527aeb33e | |
parent | bfa54f92fa14defbb276e57ad7508bd68318f592 (diff) |
Facebook: Fix posting statuses with URLs
git-svn-id: http://svn.miranda-ng.org/main/trunk@10105 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 20 | ||||
-rw-r--r-- | protocols/FacebookRM/src/constants.h | 1 |
2 files changed, 5 insertions, 16 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 7145355a7e..6153fbc77b 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -230,7 +230,6 @@ DWORD facebook_client::choose_security_level(RequestType request_type) // case REQUEST_RECONNECT: // case REQUEST_POST_STATUS: // case REQUEST_IDENTITY_SWITCH: -// case REQUEST_STATUS_COMPOSER: // case REQUEST_LINK_SCRAPER: // case REQUEST_MESSAGE_SEND_CHAT: // case REQUEST_MESSAGE_SEND_INBOX: @@ -257,7 +256,6 @@ int facebook_client::choose_method(RequestType request_type) case REQUEST_BUDDY_LIST: case REQUEST_POST_STATUS: case REQUEST_IDENTITY_SWITCH: - case REQUEST_STATUS_COMPOSER: case REQUEST_LINK_SCRAPER: case REQUEST_MESSAGE_SEND_CHAT: case REQUEST_MESSAGE_SEND_INBOX: @@ -333,7 +331,6 @@ std::string facebook_client::choose_server(RequestType request_type, std::string // case REQUEST_RECONNECT: // case REQUEST_POST_STATUS: // case REQUEST_IDENTITY_SWITCH: -// case REQUEST_STATUS_COMPOSER: // case REQUEST_LINK_SCRAPER: // case REQUEST_MESSAGE_SEND_CHAT: // case REQUEST_MESSAGE_SEND_INBOX: @@ -490,9 +487,6 @@ std::string facebook_client::choose_action(RequestType request_type, std::string case REQUEST_IDENTITY_SWITCH: return "/identity_switch.php?__a=1"; - case REQUEST_STATUS_COMPOSER: - return "/ajax/profile/composer.php?__a=1"; - case REQUEST_LINK_SCRAPER: { std::string action = "/ajax/composerx/attachment/link/scraper/?__a=1&composerurihash=2&scrape_url="; @@ -1284,25 +1278,21 @@ bool facebook_client::post_status(status_data *status) } std::string data; - RequestType request = REQUEST_POST_STATUS; - if (!status->url.empty()) { data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0"); - data += "&composerid=u_jsonp_2_b"; data += "&targetid=" + (status->user_id.empty() ? this->self_.user_id : status->user_id); + data += "&xhpc_targetid=" + (status->user_id.empty() ? this->self_.user_id : status->user_id); data += "&istimeline=1&composercontext=composer&onecolumn=1&nctr[_mod]=pagelet_timeline_recent&__a=1&ttstamp=0"; data += "&__user=" + (status->isPage && !status->user_id.empty() ? status->user_id : this->self_.user_id); data += "&loaded_components[0]=maininput&loaded_components[1]=backdateicon&loaded_components[2]=withtaggericon&loaded_components[3]=cameraicon&loaded_components[4]=placetaggericon&loaded_components[5]=mainprivacywidget&loaded_components[6]=withtaggericon&loaded_components[7]=backdateicon&loaded_components[8]=placetaggericon&loaded_components[9]=cameraicon&loaded_components[10]=mainprivacywidget&loaded_components[11]=maininput&loaded_components[12]=explicitplaceinput&loaded_components[13]=hiddenplaceinput&loaded_components[14]=placenameinput&loaded_components[15]=hiddensessionid&loaded_components[16]=withtagger&loaded_components[17]=backdatepicker&loaded_components[18]=placetagger&loaded_components[19]=citysharericon"; http::response resp = flap(REQUEST_LINK_SCRAPER, &data, &status->url); - resp.data = utils::text::slashu_to_utf8(resp.data); + std::string temp = utils::text::html_entities_decode(utils::text::slashu_to_utf8(resp.data)); data = "&xhpc_context=profile&xhpc_ismeta=1&xhpc_timeline=1&xhpc_composerid=u_jsonp_2_0&is_explicit_place=&composertags_place=&composer_session_id=&composertags_city=&disable_location_sharing=false&composer_predicted_city=&nctr[_mod]=pagelet_composer&__a=1&__dyn=&__req=1f&ttstamp=0"; - std::string form = utils::text::source_get_value(&resp.data, 2, "<form", "</form>"); + std::string form = utils::text::source_get_value(&temp, 2, "<form", "</form>"); utils::text::replace_all(&form, "\\\"", "\""); data += "&" + utils::text::source_get_form_data(&form) + "&"; //data += "&no_picture=0"; - - request = REQUEST_STATUS_COMPOSER; } std::string text = utils::url::encode(status->text); @@ -1318,7 +1308,7 @@ bool facebook_client::post_status(status_data *status) data += "&composertags_place_name="; data += utils::url::encode(status->place); } - for(std::vector<facebook_user*>::size_type i = 0; i < status->users.size(); i++) { + for (std::vector<facebook_user*>::size_type i = 0; i < status->users.size(); i++) { data += "&composertags_with[" + utils::conversion::to_string(&i, UTILS_CONV_UNSIGNED_NUMBER); data += "]=" + status->users[i]->user_id; data += "&text_composertags_with[" + utils::conversion::to_string(&i, UTILS_CONV_UNSIGNED_NUMBER); @@ -1329,7 +1319,7 @@ bool facebook_client::post_status(status_data *status) data += "&xhpc_context=profile&xhpc_ismeta=1&xhpc_timeline=1&xhpc_composerid=u_0_2y&is_explicit_place=&composertags_place=&composertags_city="; - http::response resp = flap(request, &data); + http::response resp = flap(REQUEST_POST_STATUS, &data); if (status->isPage) { std::string data = "fb_dtsg=" + (!this->dtsg_.empty() ? this->dtsg_ : "0"); diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index 1f8d7df5bc..0277bdd5a4 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -112,7 +112,6 @@ enum RequestType { REQUEST_PAGES, // getting pages list
REQUEST_POST_STATUS, // posting status to our or friends's wall
- REQUEST_STATUS_COMPOSER, // posting status to our or friends's wall with url links
REQUEST_LINK_SCRAPER, // getting data for some url link
REQUEST_SEARCH, // searching
REQUEST_POKE, // sending pokes
|