From 7cbf9e427b934de647350f1eb1552a3f7ea2992b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Robert=20P=C3=B6sel?= <robyer@seznam.cz>
Date: Wed, 17 Jul 2013 13:55:22 +0000
Subject: Facebook: Fixed searching by ID people which doesn't have username

git-svn-id: http://svn.miranda-ng.org/main/trunk@5399 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/FacebookRM/src/communication.cpp | 2 +-
 protocols/FacebookRM/src/process.cpp       | 6 +++---
 protocols/FacebookRM/src/proto.cpp         | 3 +++
 3 files changed, 7 insertions(+), 4 deletions(-)

(limited to 'protocols')

diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp
index 5ef0009d30..0ebb32ba3b 100644
--- a/protocols/FacebookRM/src/communication.cpp
+++ b/protocols/FacebookRM/src/communication.cpp
@@ -383,7 +383,7 @@ std::string facebook_client::choose_action(RequestType request_type, std::string
 
 	case REQUEST_USER_INFO:
 	{		
-		std::string action = "/%s?v=info";
+		std::string action = "/%sv=info";
 		if (get_data != NULL) {
 			utils::text::replace_all(&action, "%s", *get_data);
 		}
diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp
index 68159e5672..b2b4cabb8f 100644
--- a/protocols/FacebookRM/src/process.cpp
+++ b/protocols/FacebookRM/src/process.cpp
@@ -808,14 +808,14 @@ void FacebookProto::SearchIdAckThread(void *targ)
 	facy.handle_entry("searchIdAckThread");
 
 	char *arg = mir_utf8encodeT((TCHAR*)targ);
-	std::string search = utils::url::encode(arg);
+	std::string search = utils::url::encode(arg) + "?";
 
 	if (!isOffline())
 	{
-		http::response resp = facy.flap(REQUEST_USER_INFO, NULL, &search);		
+		http::response resp = facy.flap(REQUEST_USER_INFO, NULL, &search);
 
 		if (resp.code == HTTP_CODE_FOUND && resp.headers.find("Location") != resp.headers.end()) {
-			search = utils::text::source_get_value2(&resp.headers["Location"], FACEBOOK_SERVER_MOBILE"/", "?", true);
+			search = utils::text::source_get_value(&resp.headers["Location"], 2, FACEBOOK_SERVER_MOBILE"/", "_rdr", true);
 			resp = facy.flap(REQUEST_USER_INFO, NULL, &search);
 		}
 
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp
index 793d99b8fd..55655dbb10 100644
--- a/protocols/FacebookRM/src/proto.cpp
+++ b/protocols/FacebookRM/src/proto.cpp
@@ -242,6 +242,9 @@ HANDLE FacebookProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
 	ptrA name = mir_t2a_cp(psr->firstName, CP_UTF8);
 	ptrA surname = mir_t2a_cp(psr->lastName, CP_UTF8);
 
+	if (id == NULL)
+		return NULL;
+
 	facebook_user fbu;
 	fbu.user_id = id;
 	if (name != NULL)
-- 
cgit v1.2.3