summaryrefslogtreecommitdiff
path: root/protocols/FacebookRM
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-02-17 16:17:08 +0000
committerRobert Pösel <robyer@seznam.cz>2015-02-17 16:17:08 +0000
commit1144c13b3ced478e35f5e56ba0564887eacf54f9 (patch)
tree216194453ad8bf2d88cf69253da42510c7f7dd0a /protocols/FacebookRM
parent0fabeec3192ad9d346b7dadfb35b38d2866f14c7 (diff)
Facebook: Completely remove option to use https and always use it; version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@12165 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/FacebookRM')
-rw-r--r--protocols/FacebookRM/res/facebook.rc29
-rw-r--r--protocols/FacebookRM/src/client.h5
-rw-r--r--protocols/FacebookRM/src/communication.cpp75
-rw-r--r--protocols/FacebookRM/src/connection.cpp3
-rw-r--r--protocols/FacebookRM/src/constants.h2
-rw-r--r--protocols/FacebookRM/src/db.h2
-rw-r--r--protocols/FacebookRM/src/dialogs.cpp17
-rw-r--r--protocols/FacebookRM/src/http.h14
-rw-r--r--protocols/FacebookRM/src/json.cpp10
-rw-r--r--protocols/FacebookRM/src/proto.cpp3
-rw-r--r--protocols/FacebookRM/src/resource.h6
-rw-r--r--protocols/FacebookRM/src/version.h2
12 files changed, 26 insertions, 142 deletions
diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc
index f7f589d583..fc382dd072 100644
--- a/protocols/FacebookRM/res/facebook.rc
+++ b/protocols/FacebookRM/res/facebook.rc
@@ -106,23 +106,19 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- GROUPBOX "User details",IDC_STATIC,7,7,291,60
- LTEXT "E-mail:",IDC_STATIC,17,19,61,8,0,WS_EX_RIGHT
- EDITTEXT IDC_UN,84,17,123,13,ES_AUTOHSCROLL
- LTEXT "Password:",IDC_STATIC,17,35,61,8,0,WS_EX_RIGHT
- EDITTEXT IDC_PW,84,33,123,13,ES_PASSWORD | ES_AUTOHSCROLL
+ GROUPBOX "User details",IDC_STATIC,7,7,291,62
+ LTEXT "E-mail:",IDC_STATIC,17,20,61,8,0,WS_EX_RIGHT
+ EDITTEXT IDC_UN,84,18,123,13,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,17,36,61,8,0,WS_EX_RIGHT
+ EDITTEXT IDC_PW,84,34,123,13,ES_PASSWORD | ES_AUTOHSCROLL
CONTROL "Create a new Facebook account",IDC_NEWACCOUNTLINK,
- "Hyperlink",WS_TABSTOP,84,52,189,10
- GROUPBOX "Network",IDC_STATIC,7,72,291,42
- CONTROL "Force secure (HTTPS) connection",IDC_SECURE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,85,281,10
- CONTROL "Use secure connection also for channel requests",IDC_SECURE_CHANNEL,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,31,99,262,10
- GROUPBOX "Contacts",IDC_STATIC,7,120,291,60
- LTEXT "Default group:",IDC_STATIC,17,133,61,8,0,WS_EX_RIGHT
- EDITTEXT IDC_GROUP,84,131,123,13,ES_AUTOHSCROLL
+ "Hyperlink",WS_TABSTOP,84,53,189,10
+ GROUPBOX "Contacts",IDC_STATIC,7,77,291,60
+ LTEXT "Default group:",IDC_STATIC,17,91,61,8,0,WS_EX_RIGHT
+ EDITTEXT IDC_GROUP,84,89,123,13,ES_AUTOHSCROLL
CONTROL "Automatically set 'Ignore status change' flag",IDC_SET_IGNORE_STATUS,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,149,271,10
- CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,162,271,10
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,107,271,10
+ CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,120,271,10
END
IDD_OPTIONS_EVENTS DIALOGEX 0, 0, 305, 208
@@ -307,8 +303,7 @@ END
//
// Generated from the TEXTINCLUDE 3 resource.
//
-
-
+
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
diff --git a/protocols/FacebookRM/src/client.h b/protocols/FacebookRM/src/client.h
index 55b06a24be..df7822ba32 100644
--- a/protocols/FacebookRM/src/client.h
+++ b/protocols/FacebookRM/src/client.h
@@ -39,7 +39,7 @@ public:
{
msgid_ = error_count_ = last_feeds_update_ = last_notification_time_ = random_ = 0;
- https_ = is_typing_ = false;
+ is_typing_ = false;
buddies_lock_ = send_message_lock_ = notifications_lock_ = cookies_lock_ = NULL;
hMsgCon = NULL;
@@ -82,7 +82,6 @@ public:
std::string chat_clientid_;
std::string chat_traceid_;
bool is_typing_;
- bool https_;
time_t last_feeds_update_;
time_t last_notification_time_;
int msgid_;
@@ -206,10 +205,8 @@ public:
http::response flap(RequestType request_type, std::string* request_data = NULL, std::string* request_get_data = NULL, int method = 0);
bool save_url(const std::string &url,const std::tstring &filename, HANDLE &nlc);
- DWORD choose_security_level(RequestType);
int choose_method(RequestType);
bool notify_errors(RequestType);
- std::string choose_proto(RequestType);
std::string choose_server(RequestType);
std::string choose_action(RequestType, std::string *get_data = NULL);
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index d0cee49e4b..38ed4c41ec 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -39,15 +39,13 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ
NETLIBHTTPREQUEST nlhr = { sizeof(NETLIBHTTPREQUEST) };
nlhr.requestType = !method ? choose_method(request_type) : method;
- std::string url = choose_proto(request_type);
- url.append(choose_server(request_type));
- url.append(choose_action(request_type, request_get_data));
+ std::string url = HTTP_PROTO_SECURE + choose_server(request_type) + choose_action(request_type, request_get_data);
if (!parent->m_locale.empty())
url += "&locale=" + parent->m_locale;
nlhr.szUrl = (char*)url.c_str();
- nlhr.flags = NLHRF_HTTP11 | choose_security_level(request_type);
+ nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL;
nlhr.headers = get_request_headers(nlhr.requestType, &nlhr.headersCount);
#ifdef _DEBUG
@@ -203,57 +201,6 @@ bool facebook_client::handle_error(const std::string &method, int action)
//////////////////////////////////////////////////////////////////////////////
-DWORD facebook_client::choose_security_level(RequestType request_type)
-{
- if (this->https_)
- if ((request_type != REQUEST_MESSAGES_RECEIVE && request_type != REQUEST_ACTIVE_PING) || parent->getByte(FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL))
- return NLHRF_SSL;
-
- switch (request_type) {
- case REQUEST_LOGIN:
- case REQUEST_SETUP_MACHINE:
- return NLHRF_SSL;
-
- // case REQUEST_LOGOUT:
- // case REQUEST_HOME:
- // case REQUEST_DTSG:
- // case REQUEST_BUDDY_LIST:
- // case REQUEST_USER_INFO:
- // case REQUEST_USER_INFO_ALL:
- // case REQUEST_USER_INFO_MOBILE:
- // case REQUEST_LOAD_FRIENDSHIPS:
- // case REQUEST_SEARCH:
- // case REQUEST_DELETE_FRIEND:
- // case REQUEST_ADD_FRIEND:
- // case REQUEST_APPROVE_FRIEND:
- // case REQUEST_CANCEL_FRIENDSHIP:
- // case REQUEST_FRIENDSHIP:
- // case REQUEST_FEEDS:
- // case REQUEST_PAGES:
- // case REQUEST_NOTIFICATIONS:
- // case REQUEST_RECONNECT:
- // case REQUEST_POST_STATUS:
- // case REQUEST_IDENTITY_SWITCH:
- // case REQUEST_CAPTCHA_REFRESH:
- // case REQUEST_LINK_SCRAPER:
- // case REQUEST_MESSAGE_SEND_CHAT:
- // case REQUEST_MESSAGE_SEND_INBOX:
- // case REQUEST_THREAD_INFO:
- // case REQUEST_THREAD_SYNC:
- // case REQUEST_MESSAGES_RECEIVE:
- // case REQUEST_ACTIVE_PING:
- // case REQUEST_VISIBILITY:
- // case REQUEST_POKE:
- // case REQUEST_ASYNC:
- // case REQUEST_MARK_READ:
- // case REQUEST_NOTIFICATIONS_READ:
- // case REQUEST_UNREAD_THREADS:
- // case REQUEST_TYPING_SEND:
- default:
- return (DWORD)0;
- }
-}
-
int facebook_client::choose_method(RequestType request_type)
{
switch (request_type)
@@ -301,14 +248,6 @@ int facebook_client::choose_method(RequestType request_type)
}
}
-std::string facebook_client::choose_proto(RequestType request_type)
-{
- if (choose_security_level(request_type) == NLHRF_SSL)
- return HTTP_PROTO_SECURE;
- else
- return HTTP_PROTO_REGULAR;
-}
-
std::string facebook_client::choose_server(RequestType request_type)
{
switch (request_type)
@@ -952,7 +891,7 @@ bool facebook_client::login(const char *username, const char *password)
{
if (resp.headers.find("Location") != resp.headers.end()) {
std::string redirectUrl = resp.headers["Location"];
- std::string expectedUrl = (this->https_ ? "https://"FACEBOOK_SERVER_REGULAR"/" : "http://"FACEBOOK_SERVER_REGULAR"/");
+ std::string expectedUrl = HTTP_PROTO_SECURE FACEBOOK_SERVER_REGULAR "/";
// Remove eventual parameters
std::string::size_type pos = redirectUrl.rfind("?");
@@ -1012,14 +951,6 @@ 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::url::encode(utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\""));
{
// Compute csrf_ from dtsg_
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp
index 8eaec5044a..38f5c1b3ce 100644
--- a/protocols/FacebookRM/src/connection.cpp
+++ b/protocols/FacebookRM/src/connection.cpp
@@ -186,9 +186,6 @@ bool FacebookProto::NegotiateConnection()
// Refresh last time of feeds update
facy.last_feeds_update_ = ::time(NULL);
- // Get info about secured connection
- facy.https_ = getByte(FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS) != 0;
-
// Generate random clientid for this connection
facy.chat_clientid_ = utils::text::rand_string(8, "0123456789abcdef", &facy.random_);
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h
index ac2db6aa35..f57d665e09 100644
--- a/protocols/FacebookRM/src/constants.h
+++ b/protocols/FacebookRM/src/constants.h
@@ -69,8 +69,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define FACEBOOK_DEFAULT_POLL_RATE 24 // in seconds
#define FACEBOOK_MAXIMAL_POLL_RATE 60
-#define DEFAULT_FORCE_HTTPS 0
-#define DEFAULT_FORCE_HTTPS_CHANNEL 0
#define DEFAULT_SET_MIRANDA_STATUS 0
#define DEFAULT_LOGGING_ENABLE 0
#define DEFAULT_SYSTRAY_NOTIFY 0
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index 544483d4da..d1c565e6a1 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -44,8 +44,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Account DB keys
#define FACEBOOK_KEY_DEF_GROUP "DefaultGroup"
-#define FACEBOOK_KEY_FORCE_HTTPS "ForceHTTPS"
-#define FACEBOOK_KEY_FORCE_HTTPS_CHANNEL "ForceHTTPSChannel"
#define FACEBOOK_KEY_SET_MIRANDA_STATUS "SetMirandaStatus"
#define FACEBOOK_KEY_SYSTRAY_NOTIFY "UseSystrayNotify"
#define FACEBOOK_KEY_DISABLE_STATUS_NOTIFY "DisableStatusNotify"
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp
index 77749ec265..bda685b08a 100644
--- a/protocols/FacebookRM/src/dialogs.cpp
+++ b/protocols/FacebookRM/src/dialogs.cpp
@@ -363,11 +363,6 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
SendDlgItemMessage(hwnd, IDC_PW, EM_SETREADONLY, TRUE, 0);
}
- LoadDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS, DEFAULT_FORCE_HTTPS);
- LoadDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL, DEFAULT_FORCE_HTTPS_CHANNEL);
-
- EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
-
SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0);
if (proto->m_tszDefaultGroup != NULL)
@@ -390,15 +385,6 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
if (HIWORD(wparam) == EN_CHANGE && (HWND)lparam == GetFocus())
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
- case IDC_SECURE:
- EnableWindow(GetDlgItem(hwnd, IDC_SECURE_CHANNEL), IsDlgButtonChecked(hwnd, IDC_SECURE));
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- case IDC_SECURE_CHANNEL:
- if (IsDlgButtonChecked(hwnd, IDC_SECURE_CHANNEL))
- MessageBox(hwnd, TranslateT("Note: Make sure you have disabled 'Validate SSL certificates' option in Network options to work properly."), proto->m_tszUserName, MB_OK);
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
default:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -430,9 +416,6 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
StoreDBCheckState(proto, hwnd, IDC_SET_IGNORE_STATUS, FACEBOOK_KEY_DISABLE_STATUS_NOTIFY);
StoreDBCheckState(proto, hwnd, IDC_BIGGER_AVATARS, FACEBOOK_KEY_BIG_AVATARS);
- StoreDBCheckState(proto, hwnd, IDC_SECURE, FACEBOOK_KEY_FORCE_HTTPS);
- StoreDBCheckState(proto, hwnd, IDC_SECURE_CHANNEL, FACEBOOK_KEY_FORCE_HTTPS_CHANNEL);
-
return TRUE;
}
break;
diff --git a/protocols/FacebookRM/src/http.h b/protocols/FacebookRM/src/http.h
index 0aac1c7df0..943ebb1a56 100644
--- a/protocols/FacebookRM/src/http.h
+++ b/protocols/FacebookRM/src/http.h
@@ -3,7 +3,7 @@
Facebook plugin for Miranda Instant Messenger
_____________________________________________
-Copyright © 2009-11 Michal Zelinka, 2011-15 Robert Pösel
+Copyright � 2009-11 Michal Zelinka, 2011-15 Robert P�sel
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
-#define HTTP_PROTO_REGULAR "http://"
#define HTTP_PROTO_SECURE "https://"
#define HTTP_CODE_CONTINUE 100
@@ -85,23 +84,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
namespace http
{
- enum method
- {
- get,
- post
- };
-
struct response
{
response() : code(0), error_number(0) {}
+
int code;
- std::map< std::string, std::string > headers;
+ std::map<std::string, std::string> headers;
std::string data;
// Facebook's error data
unsigned int error_number;
- std::string error_text;
std::string error_title;
+ std::string error_text;
bool isValid() {
return (code == HTTP_CODE_OK && error_number == 0);
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp
index 5597baebff..cd954ed1af 100644
--- a/protocols/FacebookRM/src/json.cpp
+++ b/protocols/FacebookRM/src/json.cpp
@@ -316,13 +316,9 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, JSONNODE
std::string link = json_as_pstring(url);
if (link.find("/ajax/mercury/attachments/photo/view/") != std::string::npos)
- // fix photo url
- link = utils::url::decode(utils::text::source_get_value(&link, 2, "?uri=", "&"));
- else if (link.find("/") == 0) {
- // make absolute url
- bool useHttps = proto->getByte(FACEBOOK_KEY_FORCE_HTTPS, 1) > 0;
- link = (useHttps ? HTTP_PROTO_SECURE : HTTP_PROTO_REGULAR) + std::string(FACEBOOK_SERVER_REGULAR) + link;
- }
+ link = utils::url::decode(utils::text::source_get_value(&link, 2, "?uri=", "&")); // fix photo url
+ else if (link.find("/") == 0)
+ link = HTTP_PROTO_SECURE FACEBOOK_SERVER_REGULAR + link; // make absolute url
if (!link.empty()) {
std::string filename;
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index f37a6f1fc0..b28a465de1 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -888,8 +888,7 @@ std::string FacebookProto::PrepareUrl(std::string url) {
}
// Make absolute url
- bool useHttps = getByte(FACEBOOK_KEY_FORCE_HTTPS, 1) > 0;
- url = (useHttps ? HTTP_PROTO_SECURE : HTTP_PROTO_REGULAR) + facy.get_server_type() + url;
+ url = HTTP_PROTO_SECURE + facy.get_server_type() + url;
}
return url;
diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h
index 48423b6a5b..bb897960a2 100644
--- a/protocols/FacebookRM/src/resource.h
+++ b/protocols/FacebookRM/src/resource.h
@@ -24,10 +24,7 @@
#define IDC_NEWACCOUNTLINK 1003
#define IDC_MINDMSG 1012
#define IDC_GROUP 1021
-#define IDC_SECURE 1024
#define IDC_SET_IGNORE_STATUS 1025
-#define IDC_SECURE_CHANNEL 1026
-#define IDC_LOGGING 1027
#define IDC_DISCONNECT_CHAT 1028
#define IDC_BIGGER_AVATARS 1030
#define IDC_MAP_STATUSES 1032
@@ -65,7 +62,6 @@
#define IDC_INSTRUCTION 1214
#define IDC_FRAME1 1215
#define IDC_FRAME2 1216
-#define IDC_SUBMIT 1217
// Next default values for new objects
//
@@ -74,6 +70,6 @@
#define _APS_NEXT_RESOURCE_VALUE 134
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1218
-#define _APS_NEXT_SYMED_VALUE 132
+#define _APS_NEXT_SYMED_VALUE 134
#endif
#endif
diff --git a/protocols/FacebookRM/src/version.h b/protocols/FacebookRM/src/version.h
index e7d50238ad..29f93c408a 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 10
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>