diff options
-rw-r--r-- | protocols/FacebookRM/src/channel.cpp | 25 | ||||
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 13 | ||||
-rw-r--r-- | protocols/FacebookRM/src/contacts.cpp | 16 | ||||
-rw-r--r-- | protocols/FacebookRM/src/feeds.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/history.cpp | 2 | ||||
-rw-r--r-- | protocols/FacebookRM/src/http_request.cpp | 31 | ||||
-rw-r--r-- | protocols/FacebookRM/src/http_request.h | 104 | ||||
-rw-r--r-- | protocols/FacebookRM/src/login.cpp | 16 | ||||
-rw-r--r-- | protocols/FacebookRM/src/messages.cpp | 10 | ||||
-rw-r--r-- | protocols/FacebookRM/src/notifications.cpp | 5 | ||||
-rw-r--r-- | protocols/FacebookRM/src/profile.cpp | 8 | ||||
-rw-r--r-- | protocols/FacebookRM/src/search.cpp | 5 | ||||
-rw-r--r-- | protocols/FacebookRM/src/status.cpp | 5 | ||||
-rw-r--r-- | protocols/FacebookRM/src/utils.cpp | 12 | ||||
-rw-r--r-- | protocols/FacebookRM/src/version.h | 4 |
15 files changed, 70 insertions, 192 deletions
diff --git a/protocols/FacebookRM/src/channel.cpp b/protocols/FacebookRM/src/channel.cpp index 68936c44c0..c274623711 100644 --- a/protocols/FacebookRM/src/channel.cpp +++ b/protocols/FacebookRM/src/channel.cpp @@ -39,42 +39,41 @@ HttpRequest* facebook_client::channelRequest(facebook_client::Type type) bool isPing = (type == PING); - p->Url << CHAR_PARAM("channel", chat_channel_.empty() ? ("p_" + self_.user_id).c_str() : chat_channel_.c_str()); + p << CHAR_PARAM("channel", chat_channel_.empty() ? ("p_" + self_.user_id).c_str() : chat_channel_.c_str()); if (!isPing) - p->Url << CHAR_PARAM("seq", chat_sequence_num_.empty() ? "0" : chat_sequence_num_.c_str()); + p << CHAR_PARAM("seq", chat_sequence_num_.empty() ? "0" : chat_sequence_num_.c_str()); - p->Url - << CHAR_PARAM("partition", chat_channel_partition_.empty() ? "0" : chat_channel_partition_.c_str()) + p << CHAR_PARAM("partition", chat_channel_partition_.empty() ? "0" : chat_channel_partition_.c_str()) << CHAR_PARAM("clientid", chat_clientid_.c_str()) << CHAR_PARAM("cb", utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz", &random_).c_str()); int idleSeconds = parent->IdleSeconds(); - p->Url << INT_PARAM("idle", idleSeconds); // Browser is sending "idle" always, even if it's "0" + p << INT_PARAM("idle", idleSeconds); // Browser is sending "idle" always, even if it's "0" if (!isPing) { - p->Url << CHAR_PARAM("qp", "y") << CHAR_PARAM("pws", "fresh") << INT_PARAM("isq", 487632); - p->Url << INT_PARAM("msgs_recv", chat_msgs_recv_); + p << CHAR_PARAM("qp", "y") << CHAR_PARAM("pws", "fresh") << INT_PARAM("isq", 487632); + p << INT_PARAM("msgs_recv", chat_msgs_recv_); // TODO: sometimes there is &tur=1711 and &qpmade=<some actual timestamp> and &isq=487632 // Url << "request_batch=1"; // it somehow batches up more responses to one - then response has special "t=batched" type and "batches" array with the data // Url << "msgr_region=LLA"; // it was here only for first pull, same as request_batch } - p->Url << INT_PARAM("cap", 8) // TODO: what's this item? Sometimes it's 0, sometimes 8 + p << INT_PARAM("cap", 8) // TODO: what's this item? Sometimes it's 0, sometimes 8 << CHAR_PARAM("uid", self_.user_id.c_str()) << CHAR_PARAM("viewer_uid", self_.user_id.c_str()); if (!chat_sticky_num_.empty() && !chat_sticky_pool_.empty()) { - p->Url << CHAR_PARAM("sticky_token", chat_sticky_num_.c_str()); - p->Url << CHAR_PARAM("sticky_pool", chat_sticky_pool_.c_str()); + p << CHAR_PARAM("sticky_token", chat_sticky_num_.c_str()); + p << CHAR_PARAM("sticky_pool", chat_sticky_pool_.c_str()); } if (!isPing && !chat_traceid_.empty()) - p->Url << CHAR_PARAM("traceid", chat_traceid_.c_str()); + p << CHAR_PARAM("traceid", chat_traceid_.c_str()); if (parent->isInvisible()) - p->Url << CHAR_PARAM("state", "offline"); + p << CHAR_PARAM("state", "offline"); else if (isPing || idleSeconds < 60) - p->Url << CHAR_PARAM("state", "active"); + p << CHAR_PARAM("state", "active"); return p; } diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 7f5a0737e4..28e558c30e 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -43,16 +43,15 @@ http::response facebook_client::sendRequest(HttpRequest *request) // Check and append user defined locale if request doesn't have it forced already if (!parent->m_locale.empty() && strstr(request->szUrl, "&locale=") == nullptr) - request->Url << CHAR_PARAM("locale", parent->m_locale.c_str()); + request << CHAR_PARAM("locale", parent->m_locale.c_str()); - request->Headers - << CHAR_PARAM("Accept-Language", "en,en-US;q=0.9") - << CHAR_PARAM("Accept", "*/*") - << CHAR_PARAM("User-Agent", g_strUserAgent.c_str()) - << CHAR_PARAM("Cookie", ptrA(load_cookies())); // FIXME: Rework load_cookies to not do strdup + request->AddHeader("Accept-Language", "en,en-US;q=0.9"); + request->AddHeader("Accept", "*/*"); + request->AddHeader("User-Agent", g_strUserAgent.c_str()); + request->AddHeader("Cookie", ptrA(load_cookies())); // FIXME: Rework load_cookies to not do strdup if (request->requestType == REQUEST_POST) - request->Headers << CHAR_PARAM("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); + request->AddHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); mir_cslockfull s(fcb_conn_lock_); s.unlock(); diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp index d6eff8c2e2..7e5505e0d7 100644 --- a/protocols/FacebookRM/src/contacts.cpp +++ b/protocols/FacebookRM/src/contacts.cpp @@ -597,7 +597,7 @@ HttpRequest* facebook_client::addFriendRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/add_friend/action.php"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << CHAR_PARAM("to_friend", userId) @@ -615,9 +615,8 @@ HttpRequest* facebook_client::deleteFriendRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/profile/removefriendconfirm.php"); - p->Url - << INT_PARAM("__a", 1) - << BOOL_PARAM("norefresh", true) + p << INT_PARAM("__a", 1) + << CHAR_PARAM("norefresh", "true") << CHAR_PARAM("unref", "button_dropdown") << CHAR_PARAM("uid", userId); @@ -647,7 +646,7 @@ HttpRequest* facebook_client::cancelFriendshipRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/friends/requests/cancel.php"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << INT_PARAM("confirmed", 1) @@ -662,7 +661,7 @@ HttpRequest* facebook_client::answerFriendshipRequest(const char *userId, bool b { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/requests/friends/ajax/"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << CHAR_PARAM("action", (bConfirm) ? "confirm" : "reject") @@ -680,7 +679,7 @@ HttpRequest* facebook_client::userInfoRequest(const LIST<char> &userIds) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/chat/user_info/"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); for (int i = 0; i < userIds.getCount(); i++) { CMStringA id(::FORMAT, "ids[%i]", i); @@ -705,8 +704,7 @@ HttpRequest* facebook_client::userInfoAllRequest() { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/chat/user_info_all/"); - p->Url - << INT_PARAM("dpr", 1) + p << INT_PARAM("dpr", 1) << CHAR_PARAM("viewer", self_.user_id.c_str()); p->Body diff --git a/protocols/FacebookRM/src/feeds.cpp b/protocols/FacebookRM/src/feeds.cpp index e101944654..680af7a7ac 100644 --- a/protocols/FacebookRM/src/feeds.cpp +++ b/protocols/FacebookRM/src/feeds.cpp @@ -31,8 +31,7 @@ HttpRequest* facebook_client::newsfeedRequest() if (feed_type >= _countof(feed_types)) feed_type = 0; - p->Url - << CHAR_PARAM("sk", feed_types[feed_type].id) + p << CHAR_PARAM("sk", feed_types[feed_type].id) << CHAR_PARAM("key", (feed_type < 2) ? "nf" : feed_types[feed_type].id) << CHAR_PARAM("__user", self_.user_id.c_str()) << INT_PARAM("__a", 1); @@ -44,8 +43,7 @@ HttpRequest* facebook_client::memoriesRequest() { HttpRequest * p = new HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/onthisday/story/query/"); - p->Url - << INT_PARAM("__a", 1) + p << INT_PARAM("__a", 1) << INT_PARAM("start_index", 0) << INT_PARAM("num_stories", 20) << INT_PARAM("last_section_header", 0) diff --git a/protocols/FacebookRM/src/history.cpp b/protocols/FacebookRM/src/history.cpp index abffd56647..c869d07fb7 100644 --- a/protocols/FacebookRM/src/history.cpp +++ b/protocols/FacebookRM/src/history.cpp @@ -108,7 +108,7 @@ HttpRequest* facebook_client::unreadThreadsRequest() { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/mercury/unread_threads.php"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << CHAR_PARAM("folders[0]", "inbox") diff --git a/protocols/FacebookRM/src/http_request.cpp b/protocols/FacebookRM/src/http_request.cpp index 8daa81a5b5..3e9f8ff53c 100644 --- a/protocols/FacebookRM/src/http_request.cpp +++ b/protocols/FacebookRM/src/http_request.cpp @@ -52,34 +52,3 @@ HttpRequest::HttpRequestBody& HttpRequest::HttpRequestBody::operator<<(const CHA content.AppendFormat("%s=%s", param.szName, utils::url::encode(param.szValue).c_str()); return *this; } - -HttpRequest::HttpRequestUrl& HttpRequest::HttpRequestUrl::operator<<(const char *param) -{ - if (param) - request.AddUrlParameter("%s", param); - return *this; -} - -HttpRequest::HttpRequestUrl& HttpRequest::HttpRequestUrl::operator<<(const BOOL_PARAM ¶m) -{ - request.AddUrlParameter("%s=%s", param.szName, param.bValue ? "true" : "false"); - return *this; -} - -HttpRequest::HttpRequestUrl& HttpRequest::HttpRequestUrl::operator<<(const INT_PARAM ¶m) -{ - request.AddUrlParameter("%s=%i", param.szName, param.iValue); - return *this; -} - -HttpRequest::HttpRequestUrl& HttpRequest::HttpRequestUrl::operator<<(const INT64_PARAM ¶m) -{ - request.AddUrlParameter("%s=%lld", param.szName, param.iValue); - return *this; -} - -HttpRequest::HttpRequestUrl& HttpRequest::HttpRequestUrl::operator<<(const CHAR_PARAM ¶m) -{ - request.AddUrlParameter("%s=%s", param.szName, param.szValue); - return *this; -} diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h index f4ed8d76ae..8a6c1f146a 100644 --- a/protocols/FacebookRM/src/http_request.h +++ b/protocols/FacebookRM/src/http_request.h @@ -18,72 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _HTTP_REQUEST_H_ #define _HTTP_REQUEST_H_ -class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject, private MNonCopyable +class HttpRequest : public MHttpRequest { va_list formatArgs; - CMStringA url; protected: - class HttpRequestUrl : private MNonCopyable - { - friend HttpRequest; - - private: - HttpRequest & request; - - HttpRequestUrl(HttpRequest &request, const char *url) : request(request) - { - request.url = url; - request.szUrl = request.url.GetBuffer(); - } - - HttpRequestUrl(HttpRequest &request, const char *urlFormat, va_list args) : request(request) - { - request.url.AppendFormatV(urlFormat, args); - request.szUrl = request.url.GetBuffer(); - } - - public: - HttpRequestUrl& operator<<(const char *param); - HttpRequestUrl& operator<<(const BOOL_PARAM ¶m); - HttpRequestUrl& operator<<(const INT_PARAM ¶m); - HttpRequestUrl& operator<<(const INT64_PARAM ¶m); - HttpRequestUrl& operator<<(const CHAR_PARAM ¶m); - - char* ToString() - { - return request.url.GetBuffer(); - } - }; - - class HttpRequestHeaders : private MNonCopyable - { - HttpRequest &request; - - void Add(LPCSTR szName) - { - Add(szName, ""); - } - - void Add(LPCSTR szName, LPCSTR szValue) - { - request.headers = (NETLIBHTTPHEADER*)mir_realloc( - request.headers, sizeof(NETLIBHTTPHEADER)* (request.headersCount + 1)); - request.headers[request.headersCount].szName = mir_strdup(szName); - request.headers[request.headersCount].szValue = mir_strdup(szValue); - request.headersCount++; - } - - public: - HttpRequestHeaders(HttpRequest &request) : request(request) {} - - HttpRequestHeaders& operator<<(const CHAR_PARAM ¶m) - { - Add(param.szName, param.szValue); - return *this; - } - }; - class HttpRequestBody { private: @@ -106,23 +45,11 @@ protected: char* ToString() { - return content.GetBuffer(); + return content.Detach(); } }; - void AddUrlParameter(const char *fmt, ...) - { - va_list args; - va_start(args, fmt); - url += (url.Find('?') == -1) ? '?' : '&'; - url.AppendFormatV(fmt, args); - va_end(args); - szUrl = url.GetBuffer(); - } - public: - HttpRequestUrl Url; - HttpRequestHeaders Headers; HttpRequestBody Body; enum PersistentType { NONE, DEFAULT, CHANNEL, MESSAGES }; @@ -131,12 +58,10 @@ public: PersistentType Persistent; HttpRequest(int type, LPCSTR url) - : Url(*this, url), Headers(*this) { - cbSize = sizeof(NETLIBHTTPREQUEST); + m_szUrl = url; flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; requestType = type; - pData = nullptr; timeout = 600 * 1000; NotifyErrors = true; @@ -144,33 +69,26 @@ public: } HttpRequest(int type, CMStringDataFormat, LPCSTR urlFormat, ...) - : Url(*this, urlFormat, (va_start(formatArgs, urlFormat), formatArgs)), Headers(*this) { - cbSize = sizeof(NETLIBHTTPREQUEST); + m_szUrl.AppendFormatV(urlFormat, (va_start(formatArgs, urlFormat), formatArgs)); flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT; requestType = type; va_end(formatArgs); - pData = nullptr; timeout = 20 * 1000; NotifyErrors = true; Persistent = DEFAULT; } - virtual ~HttpRequest() - { - for (int i = 0; i < headersCount; i++) { - mir_free(headers[i].szName); - mir_free(headers[i].szValue); - } - mir_free(headers); - } - virtual NETLIBHTTPREQUEST* Send(HNETLIBUSER nlu) { - if (url.Find("://") == -1) - url.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://")); - szUrl = url.GetBuffer(); + if (m_szUrl.Find("://") == -1) + m_szUrl.Insert(0, ((flags & NLHRF_SSL) ? "https://" : "http://")); + if (!m_szParam.IsEmpty()) { + m_szUrl.AppendChar('?'); + m_szUrl += m_szParam; + } + szUrl = m_szUrl.GetBuffer(); if (!pData) { pData = Body.ToString(); diff --git a/protocols/FacebookRM/src/login.cpp b/protocols/FacebookRM/src/login.cpp index 6f2e07719f..05d66e8f1d 100644 --- a/protocols/FacebookRM/src/login.cpp +++ b/protocols/FacebookRM/src/login.cpp @@ -29,7 +29,7 @@ HttpRequest* facebook_client::loginRequest() { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_LOGIN "/login.php"); p->flags |= NLHRF_NODUMP; - p->Url << INT_PARAM("login_attempt", 1); + p << INT_PARAM("login_attempt", 1); return p; } @@ -39,9 +39,11 @@ HttpRequest* facebook_client::loginRequest(const char *username, const char *pas p->flags |= NLHRF_NODUMP; p->Persistent = p->NONE; - p->Url - << INT_PARAM("login_attempt", 1) - << urlData; // additional data parsed from form + p << INT_PARAM("login_attempt", 1); + if (mir_strlen(urlData)) { + p->m_szParam.AppendChar('&'); + p->m_szParam.Append(urlData); // additional data parsed from form + } p->Body << INT_PARAM("persistent", 1) @@ -60,7 +62,7 @@ HttpRequest* facebook_client::loginSmsRequest(const char *dtsg) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/login/approvals/send_sms"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << CHAR_PARAM("method_requested", "sms_requested") @@ -84,7 +86,7 @@ HttpRequest* facebook_client::loginSmsRequest(const char *dtsg) HttpRequest* facebook_client::setupMachineRequest() { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/checkpoint/"); - p->Url << "next"; + p->m_szParam.Append("next"); return p; } @@ -92,7 +94,7 @@ HttpRequest* facebook_client::setupMachineRequest(const char *dtsg, const char * { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/checkpoint/"); - p->Url << "next"; + p->m_szParam.Append("next"); p->Body << CHAR_PARAM(CMStringA(::FORMAT, "submit[%s]", submit), submit) diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index 7d5afc6fdc..f546fce192 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -235,7 +235,7 @@ HttpRequest* facebook_client::sendMessageRequest( // Use own persistent connection for sending messages p->Persistent = p->MESSAGES; - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); if (mir_strlen(captcha) > 0) p->Body << CHAR_PARAM("captcha_persist_data", captchaPersistData) << CHAR_PARAM("captcha_response", captcha); @@ -294,7 +294,7 @@ HttpRequest* facebook_client::sendTypingRequest(const char *userId, bool isChat, { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/messaging/typ.php"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << INT_PARAM("typ", isTyping ? 1 : 0) @@ -318,7 +318,7 @@ HttpRequest* facebook_client::markMessageReadRequest(const LIST<char> &ids) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/mercury/change_read_status.php"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); for (auto &it : ids) { std::string id_ = it; @@ -348,7 +348,7 @@ HttpRequest* facebook_client::destroyThreadRequest(facebook_chatroom *fbc) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/mercury/delete_thread.php"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << CHAR_PARAM("ids[0]", fbc->thread_id.substr(3).c_str()) @@ -368,7 +368,7 @@ HttpRequest* facebook_client::exitThreadRequest(facebook_chatroom *fbc) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/messaging/send/"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); std::string msgid = utils::text::rand_string(15); diff --git a/protocols/FacebookRM/src/notifications.cpp b/protocols/FacebookRM/src/notifications.cpp index 516b80be20..382837648a 100644 --- a/protocols/FacebookRM/src/notifications.cpp +++ b/protocols/FacebookRM/src/notifications.cpp @@ -29,7 +29,7 @@ HttpRequest* facebook_client::getNotificationsRequest(int count) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/notifications/client/get.php"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << CHAR_PARAM("__user", self_.user_id.c_str()) @@ -53,8 +53,7 @@ HttpRequest* facebook_client::markNotificationReadRequest(const char *id) { HttpRequest *p = new HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/ajax/notifications/mark_read.php"); - p->Url - << INT_PARAM("__a", 1) + p << INT_PARAM("__a", 1) << INT_PARAM("seen", 0) << CHAR_PARAM("fb_dtsg", dtsg_.c_str()) << CHAR_PARAM("__user", self_.user_id.c_str()) diff --git a/protocols/FacebookRM/src/profile.cpp b/protocols/FacebookRM/src/profile.cpp index 2f2ff39712..f6eeb58ccb 100644 --- a/protocols/FacebookRM/src/profile.cpp +++ b/protocols/FacebookRM/src/profile.cpp @@ -29,7 +29,7 @@ HttpRequest* facebook_client::homeRequest() { HttpRequest *p = new HttpRequest(REQUEST_GET, FACEBOOK_SERVER_MOBILE "/profile.php"); p->flags |= NLHRF_REDIRECT; - p->Url << CHAR_PARAM("v", "info"); + p << CHAR_PARAM("v", "info"); return p; } @@ -50,7 +50,7 @@ HttpRequest* facebook_client::profilePictureRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_GET, FORMAT, "%s/profile/picture/view/", mbasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE); p->flags |= NLHRF_REDIRECT; - p->Url << CHAR_PARAM("profile_id", userId); + p << CHAR_PARAM("profile_id", userId); return p; } @@ -60,7 +60,7 @@ HttpRequest* facebook_client::profilePictureRequest(const char *userId) HttpRequest* facebook_client::profileRequest(const char *data) { HttpRequest *p = new HttpRequest(REQUEST_GET, FORMAT, "%s/%s", mbasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE, data); - p->Url << CHAR_PARAM("v", "info"); + p << CHAR_PARAM("v", "info"); return p; } @@ -70,6 +70,6 @@ HttpRequest* facebook_client::profileRequest(const char *data) HttpRequest* facebook_client::profileInfoRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_GET, FORMAT, "%s/profile.php", mbasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE); - p->Url << CHAR_PARAM("id", userId) << CHAR_PARAM("v", "info") << CHAR_PARAM("locale", "en_US"); + p << CHAR_PARAM("id", userId) << CHAR_PARAM("v", "info") << CHAR_PARAM("locale", "en_US"); return p; } diff --git a/protocols/FacebookRM/src/search.cpp b/protocols/FacebookRM/src/search.cpp index 38293868f1..88add3fa56 100644 --- a/protocols/FacebookRM/src/search.cpp +++ b/protocols/FacebookRM/src/search.cpp @@ -28,13 +28,12 @@ HttpRequest* facebook_client::searchRequest(const char *query, int s, int pn, co HttpRequest* p = new HttpRequest(REQUEST_GET, FORMAT, "%s/search/", mbasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE); p->flags |= NLHRF_REDIRECT; - p->Url - << CHAR_PARAM("q", query) + p << CHAR_PARAM("q", query) << INT_PARAM("s", s) << INT_PARAM("pn", pn); if (mir_strlen(ssid) > 0) - p->Url << CHAR_PARAM("ssid", ssid); + p << CHAR_PARAM("ssid", ssid); return p; } diff --git a/protocols/FacebookRM/src/status.cpp b/protocols/FacebookRM/src/status.cpp index 0c1d5e5421..f60f0ff80e 100644 --- a/protocols/FacebookRM/src/status.cpp +++ b/protocols/FacebookRM/src/status.cpp @@ -29,8 +29,7 @@ HttpRequest* facebook_client::reconnectRequest() { HttpRequest *p = new HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/ajax/presence/reconnect.php"); - p->Url - << INT_PARAM("__a", 1) + p << INT_PARAM("__a", 1) << CHAR_PARAM("__pc", "PHASED:DEFAULT") << INT_PARAM("__be", -1) << CHAR_PARAM("reason", chat_reconnect_reason_.empty() ? "6" : chat_reconnect_reason_.c_str()) @@ -50,7 +49,7 @@ HttpRequest* facebook_client::setVisibilityRequest(bool online) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/chat/privacy/visibility.php"); - p->Url << INT_PARAM("dpr", 1); + p << INT_PARAM("dpr", 1); p->Body << INT_PARAM("visibility", online ? 1 : 0) diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index 75f26165de..6f7552f365 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -37,8 +37,7 @@ HttpRequest* facebook_client::refreshCaptchaRequest(const char *captchaPersistDa { HttpRequest *p = new HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/captcha/refresh_ajax.php"); - p->Url - << INT_PARAM("__a", 1) + p << INT_PARAM("__a", 1) << CHAR_PARAM("new_captcha_type", "TFBCaptcha") << CHAR_PARAM("skipped_captcha_data", captchaPersistData) << CHAR_PARAM("__dyn", __dyn()) @@ -56,8 +55,7 @@ HttpRequest* facebook_client::linkScraperRequest(status_data *status) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/composerx/attachment/link/scraper/"); - p->Url - << INT_PARAM("__a", 1) + p << INT_PARAM("__a", 1) << INT_PARAM("composerurihash", 2) << CHAR_PARAM("scrape_url", status->url.c_str()); @@ -103,7 +101,7 @@ HttpRequest* facebook_client::switchIdentityRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/identity_switch.php"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << CHAR_PARAM("fb_dtsg", dtsg_.c_str()) << CHAR_PARAM("user_id", userId) << CHAR_PARAM("url", FACEBOOK_URL_HOMEPAGE); @@ -117,7 +115,7 @@ HttpRequest* facebook_client::sharePostRequest(status_data *status, const char * { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/updatestatus.php"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << CHAR_PARAM("fb_dtsg", dtsg_.c_str()) @@ -165,7 +163,7 @@ HttpRequest* facebook_client::sendPokeRequest(const char *userId) { HttpRequest *p = new HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/pokes/dialog/"); - p->Url << INT_PARAM("__a", 1); + p << INT_PARAM("__a", 1); p->Body << INT_PARAM("do_confirm", 0) diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h index 13a8b0d0bd..9da62fe169 100644 --- a/protocols/FacebookRM/src/version.h +++ b/protocols/FacebookRM/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 4 -#define __RELEASE_NUM 1 -#define __BUILD_NUM 4 +#define __RELEASE_NUM 2 +#define __BUILD_NUM 1 #include <stdver.h> |