summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-08-24 11:11:26 +0000
committerRobert Pösel <robyer@seznam.cz>2014-08-24 11:11:26 +0000
commitaa28fe4f758a20680b63d0bda40207548ab93fdb (patch)
tree0ad492a5490a7ac071793378fcd8c281ab4765ca /protocols/FacebookRM
parentb60cabf8c6e9b8f50dbc2f51defdd7fdf9c0b9b3 (diff)
Facebook: Dealing with login confirmation whether our computer is cleaned and without malware; Version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@10318 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/src/communication.cpp38
-rw-r--r--protocols/FacebookRM/src/version.h2
2 files changed, 30 insertions, 10 deletions
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 5ead6bedb2..307232cd8b 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -822,16 +822,26 @@ bool facebook_client::login(const char *username, const char *password)
inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
inner_data += "&name_action_selected=save_device"; // Save device - or "dont_save"
resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
- }
- // Save actual machine name
- // inner_data = "machine_name=Miranda%20NG&submit[Don't%20Save]=Don't%20Save"; // Don't save
- inner_data = "machine_name=Miranda%20NG&submit[Save%20Device]=Save%20Device"; // Save
- inner_data += "&lsd=" + utils::text::source_get_value(&resp.data, 3, "name=\"lsd\"", "value=\"", "\"");
- inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
- inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ } else if (resp.data.find("name=\"submit[OK]\"") != std::string::npos) {
+
+ inner_data = "submit[OK]=OK";
+ inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
+ inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+ resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+
+ if (resp.data.find("security-essentials") != std::string::npos) {
+ // Computer was probably infected by malware and needs cleaning (actually this may happen because Miranda doesn't support FB's captcha)
+ inner_data = "submit[Continue]=Continue";
+ inner_data += "&nh=" + utils::text::source_get_value(&resp.data, 3, "name=\"nh\"", "value=\"", "\"");
+ inner_data += "&fb_dtsg=" + utils::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
+
+ // Mark that used cleaned his computer already, because he must confirm it anyway to be able to continue
+ inner_data += "&confirm=1";
- resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+ resp = flap(REQUEST_SETUP_MACHINE, &inner_data);
+ }
+ }
}
}
@@ -867,9 +877,19 @@ bool facebook_client::login(const char *username, const char *password)
default:
return handle_error("login", FORCE_QUIT);
- case HTTP_CODE_FOUND: // Found and redirected to Home, Logged in, everything is OK
+ case HTTP_CODE_FOUND: // Found and redirected somewhere
{
+ if (resp.headers.find("Location") != resp.headers.end()) {
+ std::string url = (this->https_ ? "https://"FACEBOOK_SERVER_REGULAR"/" : "http://"FACEBOOK_SERVER_REGULAR"/");
+
+ if (resp.headers["Location"] != url) {
+ // Unexpected redirect, but we try to ignore it - maybe we were logged in anyway
+ parent->debugLogA(" ! ! Login error: Unexpected redirect: %s", resp.headers["Location"].c_str());
+ }
+ }
+
if (cookies.find("c_user") != cookies.end()) {
+ // Probably logged in, everything seems OK
this->self_.user_id = cookies.find("c_user")->second;
parent->setString(FACEBOOK_KEY_ID, this->self_.user_id.c_str());
parent->debugLogA(" Got self user id: %s", this->self_.user_id.c_str());
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index f4cb3da2a8..9ea1484017 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 8
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>