From 719b9593a4644eac3284699192dd695205856f0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sat, 3 Nov 2012 13:43:00 +0000 Subject: Facebook: Fixed searching. git-svn-id: http://svn.miranda-ng.org/main/trunk@2161 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/process.cpp | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'protocols/FacebookRM') diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index f5d04fc343..19231a4451 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -744,40 +744,31 @@ void FacebookProto::SearchAckThread(void *targ) if (!ssid.empty()) get_data += "&ssid=" + ssid; - // Get notifications http::response resp = facy.flap( FACEBOOK_REQUEST_SEARCH, NULL, &get_data ); // Process result data - facy.validate_response(&resp); + facy.validate_response(&resp); if (resp.code == HTTP_CODE_OK) { - std::string items = utils::text::source_get_value(&resp.data, 3, "", ""); + std::string items = utils::text::source_get_value(&resp.data, 2, ""); std::string::size_type pos = 0; std::string::size_type pos2 = 0; bool last = false; - while (!last) { - std::string item; - if ((pos2 = items.find("
", pos)) != std::string::npos) { - item = items.substr(pos, pos2 - pos); - pos = pos2 + 14; - } else { - item = items.substr(pos); - last = true; - } - - count++; + while ((pos = items.find("", pos)) != std::string::npos) { + std::string item = items.substr(pos, items.find("", pos) - pos); + pos++; count++; std::string id = utils::text::source_get_value2(&item, "?id=", "&\""); if (id.empty()) id = utils::text::source_get_value2(&item, "?slog=", "&\""); - std::string name = utils::text::source_get_value(&item, 2, "", ""); + std::string name = utils::text::source_get_value(&item, 4, "", "", "", ""); + std::string common = utils::text::source_get_value(&item, 2, "", ""); if ((pos2 = name.find(" ")) != std::string::npos) { nick = name.substr(pos2 + 31, name.length() - pos2 - 32); // also remove brackets around nickname -- cgit v1.2.3