summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/FacebookRM/src/communication.cpp16
-rw-r--r--protocols/FacebookRM/src/process.cpp28
-rw-r--r--protocols/FacebookRM/src/version.h2
3 files changed, 27 insertions, 19 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 2630f567c9..65b89cd28b 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -317,7 +317,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
case REQUEST_LOAD_FRIENDSHIPS:
{
- return "/friends/?";
+ return "/friends/center/requests/?";
}
case REQUEST_SEARCH:
@@ -441,9 +441,16 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
action += "&clientid=" + this->chat_clientid_;
action += "&cb=" + utils::text::rand_string(4, "0123456789abcdefghijklmnopqrstuvwxyz", &this->random_);
+ /*
+ original cb = return (1048576 * Math.random() | 0).toString(36);
+ char buffer[10];
+ itoa(((int)(1048576 * (((double)rand()) / (RAND_MAX + 1))) | 0), buffer, 36);
+ action += "&cb=" + buffer;
+ */
+
int idleSeconds = parent->IdleSeconds();
action += "&idle=" + utils::conversion::to_string(&idleSeconds, UTILS_CONV_UNSIGNED_NUMBER);
- action += "&cap=0"; // TODO: what's this item?
+ action += "&cap=0"; // TODO: what's this item? Sometimes it's 0, sometimes 8
// action += "&wtc=0,0,0.000,0,0"; // TODO: what's this item? It's numbers grows with every new request...
action += "&msgs_recv=" + utils::conversion::to_string(&this->chat_msgs_recv_, UTILS_CONV_UNSIGNED_NUMBER);
@@ -451,11 +458,10 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
action += "&uid=" + self_.user_id;
action += "&viewer_uid=" + self_.user_id;
- if (!this->chat_sticky_num_.empty())
+ if (!this->chat_sticky_num_.empty() && !this->chat_sticky_pool_.empty()) {
action += "&sticky_token=" + this->chat_sticky_num_;
-
- if (!this->chat_sticky_pool_.empty())
action += "&sticky_pool=" + this->chat_sticky_pool_;
+ }
if (!isPing && !this->chat_traceid_.empty())
action += "&traceid=" + this->chat_traceid_;
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 97fd295899..c49d9cbb72 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -314,13 +314,13 @@ void FacebookProto::ProcessUnreadMessages(void*)
std::vector<std::string> threads;
- facebook_json_parser* p = new facebook_json_parser(this);
- p->parse_unread_threads(&resp.data, &threads, inboxOnly);
- delete p;
+ facebook_json_parser* p = new facebook_json_parser(this);
+ p->parse_unread_threads(&resp.data, &threads, inboxOnly);
+ delete p;
- ForkThread(&FacebookProto::ProcessUnreadMessage, new std::vector<std::string>(threads));
+ ForkThread(&FacebookProto::ProcessUnreadMessage, new std::vector<std::string>(threads));
- debugLogA("*** Unread threads list processed");
+ debugLogA("*** Unread threads list processed");
CODE_BLOCK_CATCH
@@ -353,6 +353,8 @@ void FacebookProto::ProcessUnreadMessage(void *pParam)
http::response resp;
+ // TODO: First load info about amount of unread messages, then load exactly this amount for each thread
+
while (!threads->empty()) {
std::string data = "client=mercury";
data += "&__user=" + facy.self_.user_id;
@@ -1117,7 +1119,7 @@ void FacebookProto::ProcessFriendRequests(void*)
}
// Parse it
- std::string reqs = utils::text::source_get_value(&resp.data, 3, "id=\"friend_requests_section\"", "</h4>", "<h4");
+ std::string reqs = utils::text::source_get_value(&resp.data, 3, "id=\"friends_center_main\"", "</h3>", "/friends/center/suggestions/");
std::string::size_type pos = 0;
std::string::size_type pos2 = 0;
@@ -1125,21 +1127,21 @@ void FacebookProto::ProcessFriendRequests(void*)
while (!last && !reqs.empty()) {
std::string req;
- if ((pos2 = reqs.find("<img src=", pos)) != std::string::npos) {
+ if ((pos2 = reqs.find("</table>", pos)) != std::string::npos) {
req = reqs.substr(pos, pos2 - pos);
- pos = pos2 + 9;
+ pos = pos2 + 8;
} else {
req = reqs.substr(pos);
last = true;
}
-
- std::string get = utils::text::source_get_value(&req, 3, "<form", "action=\"", "\">");
+
+ std::string get = utils::text::source_get_value(&req, 2, "notifications.php?", "\"");
std::string time = utils::text::source_get_value2(&get, "seenrequesttime=", "&\"");
- std::string reason = utils::text::remove_html(utils::text::source_get_value(&req, 3, "<span", ">", "</span>"));
+ std::string reason = utils::text::remove_html(utils::text::source_get_value(&req, 4, "</a>", "<div", ">", "</div>"));
facebook_user fbu;
- fbu.real_name = utils::text::remove_html(utils::text::source_get_value(&req, 3, "<strong", ">", "</strong>"));
- fbu.user_id = utils::text::source_get_value2(&get, "id=", "&\"");
+ fbu.real_name = utils::text::remove_html(utils::text::source_get_value(&req, 3, "<a", ">", "</a>"));
+ fbu.user_id = utils::text::source_get_value2(&get, "confirm=", "&\"");
if (!fbu.user_id.empty() && !fbu.real_name.empty()) {
MCONTACT hContact = AddToContactList(&fbu, CONTACT_APPROVE);
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index 6a7908fe51..5d9735ae66 100644
--- a/protocols/FacebookRM/src/version.h
+++ b/protocols/FacebookRM/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 2
#define __RELEASE_NUM 11
-#define __BUILD_NUM 3
+#define __BUILD_NUM 4
#include <stdver.h>