From 2799ac954aa83e0f3a1c57dacadd3a41fa9ba6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 29 Sep 2013 15:46:38 +0000 Subject: Facebook: fixed check for required HTTPS connection git-svn-id: http://svn.miranda-ng.org/main/trunk@6272 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/communication.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 6b4dbb509f..f7c56feb70 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -731,13 +731,6 @@ bool facebook_client::login(const char *username, const char *password) return handle_error("login", FORCE_QUIT); } - // Check whether HTTPS connection is required and we don't have it enabled - if (!this->https_ && resp.headers["Location"].find("https://") != std::string::npos) { - client_notify(TranslateT("Your account requires HTTPS connection. Activating.")); - parent->setByte(FACEBOOK_KEY_FORCE_HTTPS, 1); - this->https_ = true; - } - // Check whether some Facebook things are required if (resp.headers["Location"].find("help.php") != std::string::npos) { @@ -823,6 +816,7 @@ bool facebook_client::login(const char *username, const char *password) return handle_error("login", FORCE_QUIT); case HTTP_CODE_FOUND: // Found and redirected to Home, Logged in, everything is OK + { if (cookies.find("c_user") != cookies.end()) { this->self_.user_id = cookies.find("c_user")->second; parent->setString(FACEBOOK_KEY_ID, this->self_.user_id.c_str()); @@ -834,6 +828,7 @@ bool facebook_client::login(const char *username, const char *password) return handle_error("login", FORCE_QUIT); } } + } } bool facebook_client::logout() @@ -873,6 +868,14 @@ bool facebook_client::home() // get fb_dtsg http::response resp = flap(REQUEST_DTSG); + // Check whether HTTPS connection is required and we don't have it enabled + if (!this->https_ && resp.headers["Location"].find("https://") != std::string::npos) { + client_notify(TranslateT("Your account requires HTTPS connection. Activating.")); + parent->setByte(FACEBOOK_KEY_FORCE_HTTPS, 1); + this->https_ = true; + return home(); + } + this->dtsg_ = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""); parent->Log(" Got self dtsg: %s", this->dtsg_.c_str()); -- cgit v1.2.3