summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-09-07 15:01:49 +0000
committerRobert Pösel <robyer@seznam.cz>2014-09-07 15:01:49 +0000
commit2f5d76f08d12f55ef28f7b56592b7e641d2cad26 (patch)
tree4031e59cb2861e30962eb48cadff31a1afec9544
parentc03e34d73e955f6adcb2bcd40d5f524083d210c3 (diff)
Facebook: Fixed using hidden "Locale" option, now it is used in all requests
git-svn-id: http://svn.miranda-ng.org/main/trunk@10394 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/FacebookRM/docs/facebook - readme.txt4
-rw-r--r--protocols/FacebookRM/src/communication.cpp15
-rw-r--r--protocols/FacebookRM/src/db.h4
-rw-r--r--protocols/FacebookRM/src/proto.cpp1
-rw-r--r--protocols/FacebookRM/src/proto.h1
5 files changed, 13 insertions, 12 deletions
diff --git a/protocols/FacebookRM/docs/facebook - readme.txt b/protocols/FacebookRM/docs/facebook - readme.txt
index e252ed8a8c..e84746533c 100644
--- a/protocols/FacebookRM/docs/facebook - readme.txt
+++ b/protocols/FacebookRM/docs/facebook - readme.txt
@@ -26,12 +26,12 @@ Info:
--------------------------------
"TimeoutsLimit" (Byte) - Errors limit (default 3) after which fb disconnects
"PollRate" (Byte) - Waiting time between buddy list and newsfeed parsing.
-"Locale" (String) - Get facebook errors in specific language, "en_US", "cs_CZ", etc.
+"Locale" (String) - Get facebook errors in specific language, "en_US", "cs_CZ", etc. (requires restart to apply)
"UseLocalTimestampUnread" (Byte) - 1 = Use local timestamp for offline (unread) messages
"KeepUnread" (Byte) - 1 = Don't mark messages as read on server (works globally or per contact)
"NaseemsSpamMode" (Byte) - 1 = Don't add contacts when we send message to them from other instances, add them only when they reply
"NameAsNick" (Byte) - 0 = don't use real name as nickname, use nickname if possible (default is 1)
-"EnableChat" (Byte) - 0 = don't use multi user chat at all (default is 1)
+"EnableChat" (Byte) - 0 = don't use multi user chat at all (default is 1) (requires restart to apply)
--------------------------------
Version history
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 70d0bd0c59..0d87cd2576 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -43,6 +43,9 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ
url.append(choose_server(request_type, request_data, request_get_data));
url.append(choose_action(request_type, request_data, 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.headers = get_request_headers(nlhr.requestType, &nlhr.headersCount);
@@ -363,7 +366,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
return "/checkpoint/?next";
case REQUEST_LOGOUT:
- return "/logout.php";
+ return "/logout.php?";
case REQUEST_HOME:
return "/profile.php?v=info";
@@ -402,7 +405,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
case REQUEST_LOAD_FRIENDSHIPS:
{
- return "/friends/";
+ return "/friends/?";
}
case REQUEST_SEARCH:
@@ -456,7 +459,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
case REQUEST_PAGES:
{
- return "/bookmarks/pages";
+ return "/bookmarks/pages?";
}
case REQUEST_NOTIFICATIONS:
@@ -500,7 +503,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
return "/ajax/mercury/send_messages.php?__a=1";
case REQUEST_MESSAGE_SEND_INBOX:
- return "/ajax/messaging/send.php";
+ return "/ajax/messaging/send.php?";
case REQUEST_THREAD_INFO:
return "/ajax/mercury/thread_info.php?__a=1";
@@ -783,10 +786,6 @@ bool facebook_client::login(const char *username, const char *password)
data += "&email=" + utils::url::encode(username);
data += "&pass=" + utils::url::encode(password);
- ptrA locale(parent->getStringA(FACEBOOK_KEY_LOCALE));
- if (locale != NULL)
- data += "&locale=" + std::string(locale);
-
// Send validation
http::response resp = flap(REQUEST_LOGIN, &data);
diff --git a/protocols/FacebookRM/src/db.h b/protocols/FacebookRM/src/db.h
index 341cb06be2..1bc512c4ca 100644
--- a/protocols/FacebookRM/src/db.h
+++ b/protocols/FacebookRM/src/db.h
@@ -75,9 +75,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Hidden account DB keys (can't be changed through GUI)
#define FACEBOOK_KEY_POLL_RATE "PollRate" // [HIDDEN] - (byte)
#define FACEBOOK_KEY_TIMEOUTS_LIMIT "TimeoutsLimit" // [HIDDEN] - (byte)
-#define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - (string) en_US, cs_CZ, etc.
+#define FACEBOOK_KEY_LOCALE "Locale" // [HIDDEN] - (string) en_US, cs_CZ, etc. (requires restart to apply)
#define FACEBOOK_KEY_LOCAL_TIMESTAMP_UNREAD "UseLocalTimestampUnread" // [HIDDEN] - (byte) 1 = use local timestamp for offline messages
#define FACEBOOK_KEY_NASEEMS_SPAM_MODE "NaseemsSpamMode" // [HIDDEN] - (byte) 1 = don't load messages sent from other instances (e.g., browser) - known as "Naseem's spam mode"
#define FACEBOOK_KEY_NAME_AS_NICK "NameAsNick" // [HIDDEN] - (byte) 0 = don't use real name as nickname, use nickname if possible
#define FACEBOOK_KEY_OPEN_URL_BROWSER "OpenUrlBrowser" // [HIDDEN] - (unicode) = absolute path to browser to open url links with
-#define FACEBOOK_KEY_ENABLE_CHAT "EnableChat" // [HIDDEN] - (byte) 0 = don't use multi user chat at all (default is 1)
+#define FACEBOOK_KEY_ENABLE_CHAT "EnableChat" // [HIDDEN] - (byte) 0 = don't use multi user chat at all (default is 1) (requires restart to apply)
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 3b3f82f972..b76e389481 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -38,6 +38,7 @@ FacebookProto::FacebookProto(const char* proto_name,const TCHAR* username) :
m_invisible = false;
m_signingOut = false;
m_enableChat = getBool(FACEBOOK_KEY_ENABLE_CHAT, true);
+ m_locale = ptrA( getStringA(FACEBOOK_KEY_LOCALE));
CreateProtoService(PS_CREATEACCMGRUI, &FacebookProto::SvcCreateAccMgrUI);
CreateProtoService(PS_GETMYAWAYMSG, &FacebookProto::GetMyAwayMsg);
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h
index 4ad3a3642c..a18d8e4275 100644
--- a/protocols/FacebookRM/src/proto.h
+++ b/protocols/FacebookRM/src/proto.h
@@ -54,6 +54,7 @@ public:
bool m_invisible;
bool m_enableChat;
bool m_signingOut;
+ std::string m_locale;
// DB utils missing in proto_interface