summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM/src/contacts.cpp
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/contacts.cpp
parent823e3839b108658811f689f959f51058effd82ac (diff)
code reordering, not to reassemble the whole project on each change in headers
Diffstat (limited to 'protocols/FacebookRM/src/contacts.cpp')
-rw-r--r--protocols/FacebookRM/src/contacts.cpp112
1 files changed, 112 insertions, 0 deletions
diff --git a/protocols/FacebookRM/src/contacts.cpp b/protocols/FacebookRM/src/contacts.cpp
index 6352300348..6ae8fb0604 100644
--- a/protocols/FacebookRM/src/contacts.cpp
+++ b/protocols/FacebookRM/src/contacts.cpp
@@ -721,3 +721,115 @@ void FacebookProto::StopTyping(MCONTACT hContact)
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
facy.typers.erase(hContact);
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+UserInfoRequest::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");
+}
+
+UserInfoAllRequest::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);
+}
+
+AddFriendRequest::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");
+}
+
+DeleteFriendRequest::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);
+}
+
+CancelFriendshipRequest::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());
+}
+
+AnswerFriendshipRequest::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());
+}