diff options
author | Robert Pösel <robyer@seznam.cz> | 2013-09-29 15:46:38 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2013-09-29 15:46:38 +0000 |
commit | 2799ac954aa83e0f3a1c57dacadd3a41fa9ba6bb (patch) | |
tree | 6bb78edf0a699d86b1d9782a756f808c28ec7ad3 /protocols/FacebookRM/src/communication.cpp | |
parent | e010af0624dd701a4e8c52c1a5bcea92f5482f0f (diff) |
Facebook: fixed check for required HTTPS connection
git-svn-id: http://svn.miranda-ng.org/main/trunk@6272 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM/src/communication.cpp')
-rw-r--r-- | protocols/FacebookRM/src/communication.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
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());
|