summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/requests
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-01-04 20:45:00 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-01-04 20:45:00 +0300
commit5b32a855e518f67589fd49837795a605a19badce (patch)
tree58e6664efc8c826a35e72e4d1a54e8e957b75c42 /protocols/FacebookRM/src/requests
parent823e3839b108658811f689f959f51058effd82ac (diff)
code reordering, not to reassemble the whole project on each change in headers
Diffstat (limited to 'protocols/FacebookRM/src/requests')
-rw-r--r--protocols/FacebookRM/src/requests/channel.h84
-rw-r--r--protocols/FacebookRM/src/requests/contacts.h182
-rw-r--r--protocols/FacebookRM/src/requests/feeds.h68
-rw-r--r--protocols/FacebookRM/src/requests/history.h134
-rw-r--r--protocols/FacebookRM/src/requests/login.h113
-rw-r--r--protocols/FacebookRM/src/requests/messages.h163
-rw-r--r--protocols/FacebookRM/src/requests/notifications.h73
-rw-r--r--protocols/FacebookRM/src/requests/profile.h88
-rw-r--r--protocols/FacebookRM/src/requests/search.h46
-rw-r--r--protocols/FacebookRM/src/requests/status.h72
-rw-r--r--protocols/FacebookRM/src/requests/utils.h182
11 files changed, 0 insertions, 1205 deletions
diff --git a/protocols/FacebookRM/src/requests/channel.h b/protocols/FacebookRM/src/requests/channel.h
deleted file mode 100644
index a1c1b649de..0000000000
--- a/protocols/FacebookRM/src/requests/channel.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_CHANNEL_H_
-#define _FACEBOOK_REQUEST_CHANNEL_H_
-
-// receiving updates, sending activity ping
-class ChannelRequest : public HttpRequest
-{
-public:
- enum Type { PULL, PING };
-
- ChannelRequest(facebook_client *fc, Type type) :
- HttpRequest(REQUEST_POST, FORMAT,
- type == PULL ? FACEBOOK_SERVER_CHAT "/pull" : FACEBOOK_SERVER_CHAT "/active_ping",
- fc->chat_conn_num_.empty() ? "0" : fc->chat_conn_num_.c_str(),
- fc->chat_channel_host_.c_str())
- {
- if (type == PULL) {
- timeout = 65 * 1000;
- Persistent = CHANNEL;
- }
-
- bool isPing = (type == PING);
-
- Url << CHAR_PARAM("channel", fc->chat_channel_.empty() ? ("p_" + fc->self_.user_id).c_str() : fc->chat_channel_.c_str());
- if (!isPing)
- Url << CHAR_PARAM("seq", fc->chat_sequence_num_.empty() ? "0" : fc->chat_sequence_num_.c_str());
-
- Url
- << CHAR_PARAM("partition", fc->chat_channel_partition_.empty() ? "0" : fc->chat_channel_partition_.c_str())
- << CHAR_PARAM("clientid", fc->chat_clientid_.c_str())
- << CHAR_PARAM("cb", utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz", &fc->random_).c_str());
-
- int idleSeconds = fc->parent->IdleSeconds();
- Url << INT_PARAM("idle", idleSeconds); // Browser is sending "idle" always, even if it's "0"
-
- if (!isPing) {
- Url << CHAR_PARAM("qp", "y") << CHAR_PARAM("pws", "fresh") << INT_PARAM("isq", 487632);
- Url << INT_PARAM("msgs_recv", fc->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
- }
-
- Url << INT_PARAM("cap", 8) // TODO: what's this item? Sometimes it's 0, sometimes 8
- << CHAR_PARAM("uid", fc->self_.user_id.c_str())
- << CHAR_PARAM("viewer_uid", fc->self_.user_id.c_str());
-
- if (!fc->chat_sticky_num_.empty() && !fc->chat_sticky_pool_.empty()) {
- Url << CHAR_PARAM("sticky_token", fc->chat_sticky_num_.c_str());
- Url << CHAR_PARAM("sticky_pool", fc->chat_sticky_pool_.c_str());
- }
-
- if (!isPing && !fc->chat_traceid_.empty())
- Url << CHAR_PARAM("traceid", fc->chat_traceid_.c_str());
-
- if (fc->parent->isInvisible())
- Url << CHAR_PARAM("state", "offline");
- else if (isPing || idleSeconds < 60)
- Url << CHAR_PARAM("state", "active");
- }
-};
-
-#endif //_FACEBOOK_REQUEST_CHANNEL_H_
diff --git a/protocols/FacebookRM/src/requests/contacts.h b/protocols/FacebookRM/src/requests/contacts.h
deleted file mode 100644
index 4b1122c808..0000000000
--- a/protocols/FacebookRM/src/requests/contacts.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_CONTACTS_H_
-#define _FACEBOOK_REQUEST_CONTACTS_H_
-
-// getting frienship requests (using mobile website)
-class GetFriendshipsRequest : public HttpRequest
-{
-public:
- GetFriendshipsRequest(bool mobileBasicWorks) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/friends/center/requests/", mobileBasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE)
- {
- flags |= NLHRF_REDIRECT;
- }
-};
-
-
-// getting info about particular friend
-// revised 3.12.2017
-class UserInfoRequest : public HttpRequest
-{
-public:
- UserInfoRequest(facebook_client *fc, const LIST<char> &userIds) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/chat/user_info/")
- {
- Url << INT_PARAM("dpr", 1);
-
- for (int i = 0; i < userIds.getCount(); i++) {
- CMStringA id(::FORMAT, "ids[%i]", i);
- Body << CHAR_PARAM(id, ptrA(mir_urlEncode(userIds[i])));
- }
-
- Body
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << INT_PARAM("__a", 1)
- << INT_PARAM("__be", 1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT");
- }
-};
-
-// getting info about all friends
-// revised 17.8.2016
-class UserInfoAllRequest : public HttpRequest
-{
-public:
- UserInfoAllRequest(facebook_client *fc) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/chat/user_info_all/")
- {
- Url
- << INT_PARAM("dpr", 1)
- << CHAR_PARAM("viewer", fc->self_.user_id.c_str());
-
- Body
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__a", 1)
- << INT_PARAM("__be", -1);
- }
-};
-
-// requesting friendships
-class AddFriendRequest : public HttpRequest
-{
-public:
- AddFriendRequest(facebook_client *fc, const char *userId) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/add_friend/action.php")
- {
- Url << INT_PARAM("__a", 1);
-
- Body
- << CHAR_PARAM("to_friend", userId)
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("action", "add_friend")
- << CHAR_PARAM("how_found", "profile_button")
- << CHAR_PARAM("ref_param", "ts")
- << CHAR_PARAM("no_flyout_on_click", "false");
- }
-};
-
-// deleting friendships
-class DeleteFriendRequest : public HttpRequest
-{
-public:
- DeleteFriendRequest(facebook_client *fc, const char *userId) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/profile/removefriendconfirm.php")
- {
- Url
- << INT_PARAM("__a", 1)
- << BOOL_PARAM("norefresh", true)
- << CHAR_PARAM("unref", "button_dropdown")
- << CHAR_PARAM("uid", userId);
-
- Body
- << CHAR_PARAM("uid", 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())
- << CHAR_PARAM("norefresh", "true")
- << CHAR_PARAM("unref", "button_dropdown")
- << INT_PARAM("confirmed", 1)
- << INT_PARAM("__a", 1);
- }
-};
-
-// canceling (our) friendship request
-class CancelFriendshipRequest : public HttpRequest
-{
-public:
- CancelFriendshipRequest(facebook_client *fc, const char *userId) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/friends/requests/cancel.php")
- {
- Url << INT_PARAM("__a", 1);
-
- Body
- << INT_PARAM("confirmed", 1)
- << CHAR_PARAM("friend", userId)
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str());
- }
-};
-
-// approving or ignoring friendship requests
-class AnswerFriendshipRequest : public HttpRequest
-{
-public:
- enum Answer { CONFIRM, REJECT };
-
- AnswerFriendshipRequest(facebook_client *fc, const char *userId, Answer answer) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/requests/friends/ajax/")
- {
- Url << INT_PARAM("__a", 1);
-
- const char *action = "";
- switch (answer) {
- case CONFIRM:
- action = "confirm";
- break;
- case REJECT:
- action = "reject";
- break;
- }
-
- Body
- << CHAR_PARAM("action", action)
- << CHAR_PARAM("id", userId)
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str());
- }
-};
-
-#endif //_FACEBOOK_REQUEST_CONTACTS_H_
diff --git a/protocols/FacebookRM/src/requests/feeds.h b/protocols/FacebookRM/src/requests/feeds.h
deleted file mode 100644
index 7cc9fa0d3c..0000000000
--- a/protocols/FacebookRM/src/requests/feeds.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_FEEDS_H_
-#define _FACEBOOK_REQUEST_FEEDS_H_
-
-// getting newsfeed posts
-class NewsfeedRequest : public HttpRequest
-{
-public:
- NewsfeedRequest(facebook_client *fc) :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/ajax/home/generic.php")
- {
- BYTE feed_type = fc->parent->getByte(FACEBOOK_KEY_FEED_TYPE, 0);
- if (feed_type >= _countof(feed_types))
- feed_type = 0;
-
- Url
- << CHAR_PARAM("sk", feed_types[feed_type].id)
- << CHAR_PARAM("key", (feed_type < 2) ? "nf" : feed_types[feed_type].id)
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << INT_PARAM("__a", 1);
- }
-};
-
-// getting memories ("on this day") posts
-class MemoriesRequest : public HttpRequest
-{
-public:
- MemoriesRequest(facebook_client *fc) :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/onthisday/story/query/")
- {
- Url
- << INT_PARAM("__a", 1)
- << INT_PARAM("start_index", 0)
- << INT_PARAM("num_stories", 20)
- << INT_PARAM("last_section_header", 0)
- << CHAR_PARAM("last_section_key", "regular_story")
- << INT_PARAM("__be", -1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT64_PARAM("timestamp", ::time(nullptr))
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str());
- }
-};
-
-#endif //_FACEBOOK_REQUEST_FEEDS_H_
diff --git a/protocols/FacebookRM/src/requests/history.h b/protocols/FacebookRM/src/requests/history.h
deleted file mode 100644
index 08def19920..0000000000
--- a/protocols/FacebookRM/src/requests/history.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_HISTORY_H_
-#define _FACEBOOK_REQUEST_HISTORY_H_
-
-// getting thread info and messages
-// revised 3.12.2017
-class ThreadInfoRequest : public HttpRequest
-{
- JSONNode data;
-
-public:
- // Request only messages history
- ThreadInfoRequest(facebook_client *fc, bool isChat, const char *id, const char* timestamp = nullptr, int limit = -1) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/api/graphqlbatch/")
- {
- setCommonBody(fc);
-
- // FIXME: FB removed /ajax/mercury/thread_info requests and now all messaging stuff does through /api/graphqlbatch/ - all loading of threads, (unread) messages, list of contacts in groupchat, etc.
- // All these request must be rewritten to the new request. Preparation is below but unfinished.
-
- //const char *type = isChat ? "thread_fbids" : "user_ids";
- std::string id_ = id; // FIXME: Rewrite this without std::string...
- if (isChat) {
- // NOTE: Remove "id." prefix as here we need to give threadFbId and not threadId
- if (id_.substr(0, 3) == "id.")
- id_ = id_.substr(3);
- }
- ptrA idEncoded(mir_urlEncode(id_.c_str()));
-
- JSONNode root, o0, query_params;
- query_params
- << CHAR_PARAM("id", idEncoded)
- << INT_PARAM("message_limit", (limit == -1) ? 50 : limit)
- << INT_PARAM("load_messages", 0)
- << BOOL_PARAM("load_read_receipts", false);
-
- if (timestamp != nullptr)
- query_params << CHAR_PARAM("before", timestamp);
- else
- query_params << NULL_PARAM("before");
-
- o0 << CHAR_PARAM("doc_id", "1549485615075443") << JSON_PARAM("query_params", query_params);
- root << JSON_PARAM("o0", o0);
-
- Body << CHAR_PARAM("queries", utils::url::encode(root.write()).c_str());
- }
-
- // Request both thread info and messages for more threads
- ThreadInfoRequest(facebook_client *fc, const LIST<char> &ids, int offset, int limit) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/api/graphqlbatch/")
- {
- setCommonBody(fc);
-
- for (int i = 0; i < ids.getCount(); i++) {
- // NOTE: Remove "id." prefix as here we need to give threadFbId and not threadId
- std::string id_ = ids[i]; // FIXME: Rewrite this without std::string...
- if (id_.substr(0, 3) == "id.")
- id_ = id_.substr(3);
- ptrA idEncoded(mir_urlEncode(id_.c_str()));
-
- // Load messages
- CMStringA begin(::FORMAT, "messages[%s][%s]", "thread_fbids", idEncoded);
- Body
- << INT_PARAM(CMStringA(::FORMAT, "%s[offset]", begin.c_str()), offset)
- << INT_PARAM(CMStringA(::FORMAT, "%s[limit]", begin.c_str()), limit)
- << CHAR_PARAM(CMStringA(::FORMAT, "threads[%s][%i]", "thread_fbids", i), idEncoded);
- }
- }
-
-private:
- void setCommonBody(facebook_client *fc)
- {
- Body
- << CHAR_PARAM("batch_name", "MessengerGraphQLThreadFetcherRe")
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << INT_PARAM("__a", 1)
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << INT_PARAM("__be", 1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("jazoest", "265816910476541027556899745586581711208287100122699749108");
- }
-};
-
-// getting unread threads
-// revised 17.8.2016
-class UnreadThreadsRequest : public HttpRequest
-{
-public:
- UnreadThreadsRequest(facebook_client *fc) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/mercury/unread_threads.php")
- {
- Url << INT_PARAM("dpr", 1);
-
- Body
- << CHAR_PARAM("folders[0]", "inbox")
- << CHAR_PARAM("folders[1]", "other") // TODO: "other" is probably unused, and there is now "pending" instead
- << CHAR_PARAM("client", "mercury")
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__a", 1)
- << INT_PARAM("__be", -1);
- }
-};
-
-#endif //_FACEBOOK_REQUEST_HISTORY_H_
diff --git a/protocols/FacebookRM/src/requests/login.h b/protocols/FacebookRM/src/requests/login.h
deleted file mode 100644
index be6cb1f244..0000000000
--- a/protocols/FacebookRM/src/requests/login.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_LOGIN_H_
-#define _FACEBOOK_REQUEST_LOGIN_H_
-
-// connecting physically
-class LoginRequest : public HttpRequest
-{
-public:
- LoginRequest() :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_LOGIN "/login.php")
- {
- Url << INT_PARAM("login_attempt", 1);
- }
-
- LoginRequest(const char *username, const char *password, const char *urlData, const char *bodyData) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_LOGIN "/login.php")
- {
- Persistent = NONE;
-
- Url
- << INT_PARAM("login_attempt", 1)
- << urlData; // additional data parsed from form
-
- Body
- << INT_PARAM("persistent", 1)
- << CHAR_PARAM("email", ptrA(mir_urlEncode(username)))
- << CHAR_PARAM("pass", ptrA(mir_urlEncode(password)))
- << CHAR_PARAM("lgndim", "eyJ3IjoxOTIwLCJoIjoxMDgwLCJhdyI6MTgzNCwiYWgiOjEwODAsImMiOjMyfQ==") // means base64 encoded: {"w":1920,"h":1080,"aw":1834,"ah":1080,"c":32}
- << bodyData; // additional data parsed from form
- }
-};
-
-// request to receive login code via SMS
-class LoginSmsRequest : public HttpRequest
-{
-public:
- LoginSmsRequest(facebook_client *fc, const char *dtsg) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/login/approvals/send_sms")
- {
- Url << INT_PARAM("dpr", 1);
-
- Body
- << CHAR_PARAM("method_requested", "sms_requested")
- << INT_PARAM("__a", 1)
- << INT_PARAM("__user", 0)
- << INT_PARAM("__be", 0)
- << CHAR_PARAM("__pc", "EXP1:DEFAULT")
- << CHAR_PARAM("current_time", (utils::time::unix_timestamp() + ".000").c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("fb_dtsg", dtsg)
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__rev", fc->__rev());
- }
-};
-
-// setting machine name
-class SetupMachineRequest : public HttpRequest
-{
-public:
- SetupMachineRequest() :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/checkpoint/")
- {
- Url << "next";
- }
-
- SetupMachineRequest(const char *dtsg, const char *nh, const char *submit) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/checkpoint/")
- {
- Url << "next";
-
- Body
- << CHAR_PARAM(CMStringA(::FORMAT, "submit[%s]", submit), submit)
- << CHAR_PARAM("nh", nh)
- << CHAR_PARAM("fb_dtsg", dtsg);
- }
-};
-
-// disconnecting physically
-class LogoutRequest : public HttpRequest
-{
-public:
- LogoutRequest(const char *dtsg, const char *logoutHash) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/logout.php")
- {
- Body
- << CHAR_PARAM("fb_dtsg", dtsg)
- << CHAR_PARAM("h", logoutHash);
- }
-};
-
-#endif //_FACEBOOK_REQUEST_LOGIN_H_
diff --git a/protocols/FacebookRM/src/requests/messages.h b/protocols/FacebookRM/src/requests/messages.h
deleted file mode 100644
index a0d782612a..0000000000
--- a/protocols/FacebookRM/src/requests/messages.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_MESSAGES_H_
-#define _FACEBOOK_REQUEST_MESSAGES_H_
-
-// sending messages
-// revised 17.8.2016
-class SendMessageRequest : public HttpRequest
-{
-public:
- SendMessageRequest(facebook_client *fc, const char *userId, const char *threadId, const char *messageId, const char *messageText, bool isChat, const char *captcha, const char *captchaPersistData) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/messaging/send/")
- {
- // Don't notify errors for this request, because we're getting them inline in messaging window
- NotifyErrors = false;
-
- // Use own persistent connection for sending messages
- Persistent = MESSAGES;
-
- Url << INT_PARAM("dpr", 1);
-
- if (mir_strlen(captcha) > 0) {
- Body
- << CHAR_PARAM("captcha_persist_data", captchaPersistData)
- << CHAR_PARAM("captcha_response", captcha);
- }
-
- Body
- << CHAR_PARAM("client", "mercury") // or "web_messenger" (whole messages page)
- << CHAR_PARAM("action_type", "ma-type:user-generated-message");
-
- // Experimental sticker sending support
- std::string message_text = messageText; // FIXME: Rewrite this without std::string...
- if (message_text.substr(0, 10) == "[[sticker:" && message_text.substr(message_text.length() - 2) == "]]") {
- Body
- << "body="
- << CHAR_PARAM("sticker_id", ptrA(mir_urlEncode(message_text.substr(10, message_text.length() - 10 - 2).c_str())))
- << BOOL_PARAM("has_attachment", true);
- // TODO: For sending GIF images instead of "sticker_id=" there is "image_ids[0]=", otherwise it's same
- }
- else {
- Body
- << CHAR_PARAM("body", ptrA(mir_urlEncode(messageText)))
- << BOOL_PARAM("has_attachment", false);
- }
-
- Body
- << INT_PARAM("ephemeral_ttl_mode", 0)
- << CHAR_PARAM("message_id", messageId)
- << CHAR_PARAM("offline_threading_id", messageId); // Same as message ID
-
- if (isChat) {
- // NOTE: Remove "id." prefix as here we need to give threadFbId and not threadId
- std::string threadFbid = threadId; // FIXME: Rewrite this without std::string...
- if (threadFbid.substr(0, 3) == "id.")
- threadFbid = threadFbid.substr(3);
-
- Body << CHAR_PARAM("thread_fbid", threadFbid.c_str());
- }
- else {
- Body
- << CHAR_PARAM("other_user_fbid", userId)
- << CHAR_PARAM("specific_to_list[0]", CMStringA(::FORMAT, "fbid:%s", userId))
- << CHAR_PARAM("specific_to_list[1]", CMStringA(::FORMAT, "fbid:%s", fc->self_.user_id.c_str()));
- }
-
- Body
- // << "signature_id=" // TODO: How to generate signature ID? It is present only when sending via "mercury"
- << CHAR_PARAM("source", "source:chat:web") // or "source:titan:web" for web_messenger
- << CHAR_PARAM("timestamp", utils::time::mili_timestamp().c_str())
- << CHAR_PARAM("ui_push_phase", "V3")
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << INT_PARAM("__a", 1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__be", -1);
- }
-};
-
-// sending typing notification
-// revised 17.8.2016
-class SendTypingRequest : public HttpRequest
-{
-public:
- SendTypingRequest(facebook_client *fc, const char *userId, bool isChat, bool isTyping) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/messaging/typ.php")
- {
- Url << INT_PARAM("dpr", 1);
-
- ptrA idEncoded(mir_urlEncode(userId));
-
- Body
- << INT_PARAM("typ", isTyping ? 1 : 0)
- << CHAR_PARAM("to", isChat ? "" : idEncoded)
- << CHAR_PARAM("thread", idEncoded)
- << CHAR_PARAM("source", "mercury-chat")
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__a", 1)
- << INT_PARAM("__be", -1);
- }
-};
-
-// marking messages read
-class MarkMessageReadRequest : public HttpRequest
-{
-public:
- MarkMessageReadRequest(facebook_client *fc, const LIST<char> &ids) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/mercury/change_read_status.php")
- {
- Url << INT_PARAM("__a", 1);
-
- for (int i = 0; i < ids.getCount(); i++) {
- std::string id_ = ids[i];
- // NOTE: Remove "id." prefix as here we need to give threadFbId and not threadId
- if (id_.substr(0, 3) == "id.")
- id_ = id_.substr(3);
-
- CMStringA id(::FORMAT, "ids[%s]", ptrA(mir_urlEncode(id_.c_str())));
- Body << BOOL_PARAM(id, true);
- }
-
- Body
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << INT_PARAM("__a", 1);
- }
-};
-
-#endif //_FACEBOOK_REQUEST_MESSAGES_H_
diff --git a/protocols/FacebookRM/src/requests/notifications.h b/protocols/FacebookRM/src/requests/notifications.h
deleted file mode 100644
index 801af7f642..0000000000
--- a/protocols/FacebookRM/src/requests/notifications.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_NOTIFICATIONS_H_
-#define _FACEBOOK_REQUEST_NOTIFICATIONS_H_
-
-// getting notifications
-// revised 17.8.2016
-class GetNotificationsRequest : public HttpRequest
-{
-public:
- GetNotificationsRequest(facebook_client *fc, int count) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/notifications/client/get.php")
- {
- Url << INT_PARAM("dpr", 1);
-
- Body
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- // << "cursor=" // when loading more
- << INT_PARAM("length", count) // number of items to load
- // << "businessID=" // probably for pages?
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__be", -1)
- << INT_PARAM("__a", 1);
- }
-};
-
-// marking notifications read
-// request revised 11.2.2016 (we're not using the main website request, as it doesn't work, but still the old one with GET parameters)
-class MarkNotificationReadRequest : public HttpRequest
-{
-public:
- MarkNotificationReadRequest(facebook_client *fc, const char *id) :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/ajax/notifications/mark_read.php")
- {
- Url
- << INT_PARAM("__a", 1)
- << INT_PARAM("seen", 0)
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev())
- << CHAR_PARAM("alert_ids%5B0%5D", ptrA(mir_urlEncode(id)));
- }
-};
-
-#endif //_FACEBOOK_REQUEST_NOTIFICATIONS_H_
diff --git a/protocols/FacebookRM/src/requests/profile.h b/protocols/FacebookRM/src/requests/profile.h
deleted file mode 100644
index ecd0c43b4c..0000000000
--- a/protocols/FacebookRM/src/requests/profile.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_PROFILE_H_
-#define _FACEBOOK_REQUEST_PROFILE_H_
-
-// getting own name, avatar, ...
-class HomeRequest : public HttpRequest
-{
-public:
- HomeRequest() :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_MOBILE "/profile.php")
- {
- flags |= NLHRF_REDIRECT;
-
- Url << CHAR_PARAM("v", "info");
- }
-};
-
-// getting fb_dtsg
-class DtsgRequest : public HttpRequest
-{
-public:
- DtsgRequest() :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_MOBILE "/profile/basic/intro/bio/")
- {
- flags |= NLHRF_REDIRECT;
- }
-};
-
-// request mobile page containing profile picture
-class ProfilePictureRequest : public HttpRequest
-{
-public:
- ProfilePictureRequest(bool mobileBasicWorks, const char *userId) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/profile/picture/view/", mobileBasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE)
- {
- flags |= NLHRF_REDIRECT;
-
- Url << CHAR_PARAM("profile_id", userId);
- }
-};
-
-// request mobile page containing user profile
-class ProfileRequest : public HttpRequest
-{
-public:
- ProfileRequest(bool mobileBasicWorks, const char *data) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/%s", mobileBasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE, data)
- {
- Url << CHAR_PARAM("v", "info");
- }
-};
-
-// request mobile page containing user profile by his id, and in english language (for parsing data)
-class ProfileInfoRequest : public HttpRequest
-{
-public:
- ProfileInfoRequest(bool mobileBasicWorks, const char *userId) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/profile.php", mobileBasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE)
- {
- Url
- << CHAR_PARAM("id", userId)
- << CHAR_PARAM("v", "info")
- << CHAR_PARAM("locale", "en_US");
- }
-};
-
-#endif //_FACEBOOK_REQUEST_PROFILE_H_
diff --git a/protocols/FacebookRM/src/requests/search.h b/protocols/FacebookRM/src/requests/search.h
deleted file mode 100644
index f7d77d600d..0000000000
--- a/protocols/FacebookRM/src/requests/search.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_SEARCH_H_
-#define _FACEBOOK_REQUEST_SEARCH_H_
-
-// searching
-class SearchRequest : public HttpRequest
-{
-public:
- SearchRequest(bool mobileBasicWorks, const char *query, int s, int pn, const char *ssid) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/search/", mobileBasicWorks ? FACEBOOK_SERVER_MBASIC : FACEBOOK_SERVER_MOBILE)
- {
- flags |= NLHRF_REDIRECT;
-
- Url
- << CHAR_PARAM("q", query)
- << INT_PARAM("s", s)
- << INT_PARAM("pn", pn);
-
- if (mir_strlen(ssid) > 0) {
- Url << CHAR_PARAM("ssid", ssid);
- }
- }
-};
-
-#endif //_FACEBOOK_REQUEST_SEARCH_H_
diff --git a/protocols/FacebookRM/src/requests/status.h b/protocols/FacebookRM/src/requests/status.h
deleted file mode 100644
index 4589604c18..0000000000
--- a/protocols/FacebookRM/src/requests/status.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_STATUS_H_
-#define _FACEBOOK_REQUEST_STATUS_H_
-
-// getting info about channel and connecting to it
-// revised 17.8.2016
-class ReconnectRequest : public HttpRequest
-{
-public:
- ReconnectRequest(facebook_client *fc) :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/ajax/presence/reconnect.php")
- {
- Url
- << INT_PARAM("__a", 1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__be", -1)
- << CHAR_PARAM("reason", fc->chat_reconnect_reason_.empty() ? "6" : fc->chat_reconnect_reason_.c_str())
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev());
- }
-};
-
-// setting chat visibility
-// revised 17.8.2016
-class SetVisibilityRequest : public HttpRequest
-{
-public:
- SetVisibilityRequest(facebook_client *fc, bool online) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/chat/privacy/visibility.php")
- {
- Url << INT_PARAM("dpr", 1);
-
- Body
- << INT_PARAM("visibility", online ? 1 : 0)
- << INT_PARAM("window_id", 0)
- << INT_PARAM("__a", 1)
- << CHAR_PARAM("__pc", "PHASED:DEFAULT")
- << INT_PARAM("__be", -1)
- << CHAR_PARAM("fb_dtsg", fc->dtsg_.c_str())
- << CHAR_PARAM("ttstamp", fc->ttstamp_.c_str())
- << CHAR_PARAM("__user", fc->self_.user_id.c_str())
- << CHAR_PARAM("__dyn", fc->__dyn())
- << CHAR_PARAM("__req", fc->__req())
- << CHAR_PARAM("__rev", fc->__rev());
- }
-};
-
-#endif //_FACEBOOK_REQUEST_STATUS_H_
diff --git a/protocols/FacebookRM/src/requests/utils.h b/protocols/FacebookRM/src/requests/utils.h
deleted file mode 100644
index beef14842a..0000000000
--- a/protocols/FacebookRM/src/requests/utils.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
-
-Facebook plugin for Miranda Instant Messenger
-_____________________________________________
-
-Copyright © 2011-17 Robert Pösel, 2017-18 Miranda NG team
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-*/
-
-#ifndef _FACEBOOK_REQUEST_UTILS_H_
-#define _FACEBOOK_REQUEST_UTILS_H_
-
-// refreshing captcha dialog (changing captcha type)
-class RefreshCaptchaRequest : public HttpRequest
-{
-public:
- RefreshCaptchaRequest(facebook_client *fc, const char *captchaPersistData) :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/captcha/refresh_ajax.php")
- {
- Url
- << 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());
- }
-};
-
-// getting data for given url (for sending/posting reasons)
-class LinkScraperRequest : public HttpRequest
-{
-public:
- LinkScraperRequest(facebook_client *fc, status_data *status) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/composerx/attachment/link/scraper/")
- {
- Url
- << INT_PARAM("__a", 1)
- << INT_PARAM("composerurihash", 2)
- << CHAR_PARAM("scrape_url", ptrA(mir_urlEncode(status->url.c_str())));
-
- Body
- << 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");
- }
-};
-
-// getting owned/admined pages list
-class GetPagesRequest : public HttpRequest
-{
-public:
- GetPagesRequest() :
- HttpRequest(REQUEST_GET, FACEBOOK_SERVER_REGULAR "/bookmarks/pages")
- {}
-};
-
-// changing identity to post status for pages
-class SwitchIdentityRequest : public HttpRequest
-{
-public:
- SwitchIdentityRequest(const char *dtsg, const char *userId) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/identity_switch.php")
- {
- Url << INT_PARAM("__a", 1);
- Body << CHAR_PARAM("fb_dtsg", dtsg) << CHAR_PARAM("user_id", userId) << CHAR_PARAM("url", FACEBOOK_URL_HOMEPAGE);
- }
-};
-
-// posting status to our or friends's wall
-class SharePostRequest : public HttpRequest
-{
-public:
- SharePostRequest(facebook_client *fc, status_data *status, const char *linkData) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/ajax/updatestatus.php")
- {
- Url
- << INT_PARAM("__a", 1);
-
- ptrA text(mir_urlEncode(status->text.c_str()));
-
- Body
- << 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_PARAM("audience[0][value]", fc->get_privacy_type().c_str());
-
- if (!status->place.empty())
- 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++) {
- CMStringA withId(::FORMAT, "composertags_with[%i]", i);
- CMStringA withName(::FORMAT, "text_composertags_with[%i]", i);
-
- Body
- << 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
- if (mir_strlen(linkData) > 0) {
- Body << linkData;
- // << "no_picture=0" // for disabling link preview image
- }
- }
-};
-
-// sending pokes
-class SendPokeRequest : public HttpRequest
-{
-public:
- SendPokeRequest(facebook_client *fc, const char *userId) :
- HttpRequest(REQUEST_POST, FACEBOOK_SERVER_REGULAR "/pokes/dialog/")
- {
- Url
- << INT_PARAM("__a", 1);
-
- Body
- << 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());
- }
-};
-
-#endif //_FACEBOOK_REQUEST_UTILS_H_