summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/requests/utils.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-03 13:41:49 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-03 13:41:49 +0300
commitf524101c14374c2efd1318f9d9085b1216b69620 (patch)
tree1a556fda936976e854ce14a42cb801e21829dd67 /protocols/FacebookRM/src/requests/utils.h
parentd5d5b3f352e0cc2601013950cd48d5aad5c73baa (diff)
Facebook:
- switch to the kernel parameter types; - strong parameters typization (also produces more compact code) - fixed timeline notifications - version bump
Diffstat (limited to 'protocols/FacebookRM/src/requests/utils.h')
-rw-r--r--protocols/FacebookRM/src/requests/utils.h139
1 files changed, 67 insertions, 72 deletions
diff --git a/protocols/FacebookRM/src/requests/utils.h b/protocols/FacebookRM/src/requests/utils.h
index 485cd09dd8..beef14842a 100644
--- a/protocols/FacebookRM/src/requests/utils.h
+++ b/protocols/FacebookRM/src/requests/utils.h
@@ -31,13 +31,13 @@ public:
HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/captcha/refresh_ajax.php")
{
Url
- << "__a=1"
- << "new_captcha_type=TFBCaptcha"
- << CHAR_VALUE("skipped_captcha_data", captchaPersistData)
- << CHAR_VALUE("__dyn", fc->__dyn())
- << CHAR_VALUE("__req", fc->__req())
- << CHAR_VALUE("__rev", fc->__rev())
- << CHAR_VALUE("__user", fc->self_.user_id.c_str());
+ << INT_PARAM("__a", 1)
+ << CHAR_PARAM("new_captcha_type", "TFBCaptcha")
+ << CHAR_PARAM("skipped_captcha_data", captchaPersistData)
+ << CHAR_PARAM("__dyn", fc->__dyn())
+ << CHAR_PARAM("__req", fc->__req())
+ << CHAR_PARAM("__rev", fc->__rev())
+ << CHAR_PARAM("__user", fc->self_.user_id.c_str());
}
};
@@ -49,41 +49,41 @@ public:
HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/composerx/attachment/link/scraper/")
{
Url
- << "__a=1"
- << "composerurihash=2"
- << CHAR_VALUE("scrape_url", ptrA(mir_urlEncode(status->url.c_str())));
+ << INT_PARAM("__a", 1)
+ << INT_PARAM("composerurihash", 2)
+ << CHAR_PARAM("scrape_url", ptrA(mir_urlEncode(status->url.c_str())));
Body
- << CHAR_VALUE("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_VALUE("targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
- << CHAR_VALUE("xhpc_targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
- << "istimeline=1"
- << "composercontext=composer"
- << "onecolumn=1"
- << "nctr[_mod]=pagelet_timeline_recent"
- << "__a=1"
- << CHAR_VALUE("ttstamp", fc->ttstamp_.c_str())
- << CHAR_VALUE("__user", status->isPage && !status->user_id.empty() ? status->user_id.c_str() : fc->self_.user_id.c_str())
- << "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";
+ << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
+ << CHAR_PARAM("targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
+ << CHAR_PARAM("xhpc_targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
+ << INT_PARAM("istimeline", 1)
+ << CHAR_PARAM("composercontext", "composer")
+ << INT_PARAM("onecolumn", 1)
+ << CHAR_PARAM("nctr[_mod]", "pagelet_timeline_recent")
+ << INT_PARAM("__a", 1)
+ << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
+ << CHAR_PARAM("__user", status->isPage && !status->user_id.empty() ? status->user_id.c_str() : fc->self_.user_id.c_str())
+ << CHAR_PARAM("loaded_components[0]", "maininput")
+ << CHAR_PARAM("loaded_components[1]", "backdateicon")
+ << CHAR_PARAM("loaded_components[2]", "withtaggericon")
+ << CHAR_PARAM("loaded_components[3]", "cameraicon")
+ << CHAR_PARAM("loaded_components[4]", "placetaggericon")
+ << CHAR_PARAM("loaded_components[5]", "mainprivacywidget")
+ << CHAR_PARAM("loaded_components[6]", "withtaggericon")
+ << CHAR_PARAM("loaded_components[7]", "backdateicon")
+ << CHAR_PARAM("loaded_components[8]", "placetaggericon")
+ << CHAR_PARAM("loaded_components[9]", "cameraicon")
+ << CHAR_PARAM("loaded_components[10]", "mainprivacywidget")
+ << CHAR_PARAM("loaded_components[11]", "maininput")
+ << CHAR_PARAM("loaded_components[12]", "explicitplaceinput")
+ << CHAR_PARAM("loaded_components[13]", "hiddenplaceinput")
+ << CHAR_PARAM("loaded_components[14]", "placenameinput")
+ << CHAR_PARAM("loaded_components[15]", "hiddensessionid")
+ << CHAR_PARAM("loaded_components[16]", "withtagger")
+ << CHAR_PARAM("loaded_components[17]", "backdatepicker")
+ << CHAR_PARAM("loaded_components[18]", "placetagger")
+ << CHAR_PARAM("loaded_components[19]", "citysharericon");
}
};
@@ -103,8 +103,8 @@ public:
SwitchIdentityRequest(const char *dtsg, const char *userId) :
HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/identity_switch.php")
{
- Url << "__a=1";
- Body << CHAR_VALUE("fb_dtsg", dtsg) << CHAR_VALUE("user_id", userId) << CHAR_VALUE("url", FACEBOOK_URL_HOMEPAGE);
+ Url << INT_PARAM("__a", 1);
+ Body << CHAR_PARAM("fb_dtsg", dtsg) << CHAR_PARAM("user_id", userId) << CHAR_PARAM("url", FACEBOOK_URL_HOMEPAGE);
}
};
@@ -116,36 +116,31 @@ public:
HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/updatestatus.php")
{
Url
- << "__a=1";
+ << INT_PARAM("__a", 1);
ptrA text(mir_urlEncode(status->text.c_str()));
Body
- << CHAR_VALUE("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_VALUE("__dyn", fc->__dyn())
- << CHAR_VALUE("__req", fc->__req())
- << CHAR_VALUE("ttstamp", fc->ttstamp_.c_str())
- << CHAR_VALUE("__user", status->isPage && !status->user_id.empty() ? status->user_id.c_str() : fc->self_.user_id.c_str())
- << CHAR_VALUE("xhpc_targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
- << CHAR_VALUE("xhpc_message", text)
- << CHAR_VALUE("xhpc_message_text", text)
- << "xhpc_context=profile"
- << "xhpc_ismeta=1"
- << "xhpc_timeline=1"
- << "xhpc_composerid=u_0_2y"
- << "is_explicit_place="
- << "composertags_place="
- << "composertags_city="
- << "composer_session_id="
- << "composer_predicted_city="
- << "disable_location_sharing=false"
- << "nctr[_mod]=pagelet_composer";
+ << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
+ << CHAR_PARAM("__dyn", fc->__dyn())
+ << CHAR_PARAM("__req", fc->__req())
+ << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
+ << CHAR_PARAM("__user", status->isPage && !status->user_id.empty() ? status->user_id.c_str() : fc->self_.user_id.c_str())
+ << CHAR_PARAM("xhpc_targetid", status->user_id.empty() ? fc->self_.user_id.c_str() : status->user_id.c_str())
+ << CHAR_PARAM("xhpc_message", text)
+ << CHAR_PARAM("xhpc_message_text", text)
+ << CHAR_PARAM("xhpc_context", "profile")
+ << INT_PARAM("xhpc_ismeta", 1)
+ << INT_PARAM("xhpc_timeline", 1)
+ << CHAR_PARAM("xhpc_composerid", "u_0_2y")
+ << BOOL_PARAM("disable_location_sharing", false)
+ << CHAR_PARAM("nctr[_mod]", "pagelet_composer");
if (!status->isPage)
- Body << CHAR_VALUE("audience[0][value]", fc->get_privacy_type().c_str());
+ Body << CHAR_PARAM("audience[0][value]", fc->get_privacy_type().c_str());
if (!status->place.empty())
- Body << CHAR_VALUE("composertags_place_name", ptrA(mir_urlEncode(status->place.c_str())));
+ Body << CHAR_PARAM("composertags_place_name", ptrA(mir_urlEncode(status->place.c_str())));
// Status with users
for (std::vector<facebook_user*>::size_type i = 0; i < status->users.size(); i++) {
@@ -153,8 +148,8 @@ public:
CMStringA withName(::FORMAT, "text_composertags_with[%i]", i);
Body
- << CHAR_VALUE(withId.c_str(), status->users[i]->user_id.c_str())
- << CHAR_VALUE(withName.c_str(), status->users[i]->real_name.c_str());
+ << CHAR_PARAM(withId.c_str(), status->users[i]->user_id.c_str())
+ << CHAR_PARAM(withName.c_str(), status->users[i]->real_name.c_str());
}
// Link attachment
@@ -173,14 +168,14 @@ public:
HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/pokes/dialog/")
{
Url
- << "__a=1";
+ << INT_PARAM("__a", 1);
Body
- << "do_confirm=0"
- << CHAR_VALUE("poke_target", userId)
- << CHAR_VALUE("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_VALUE("__user", fc->self_.user_id.c_str())
- << CHAR_VALUE("ttstamp", fc->ttstamp_.c_str());
+ << INT_PARAM("do_confirm", 0)
+ << CHAR_PARAM("poke_target", userId)
+ << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
+ << CHAR_PARAM("__user", fc->self_.user_id.c_str())
+ << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str());
}
};