From 68f97aff23dca4f9a93b5c67a31cf86754216b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 30 Jul 2014 15:23:39 +0000 Subject: Facebook: Fix getting friendship requests and improve loaded info (now shows contact id and common friends) git-svn-id: http://svn.miranda-ng.org/main/trunk@9994 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/process.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index 7d783a66c7..ce337121bf 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -845,17 +845,17 @@ void FacebookProto::ProcessFriendRequests(void*) } // Parse it - std::string reqs = utils::text::source_get_value(&resp.data, 2, "class=\"mRequestItem", "al aps\">"); + std::string reqs = utils::text::source_get_value(&resp.data, 3, "id=\"friend_requests_section\"", "", ""); std::string time = utils::text::source_get_value2(&get, "seenrequesttime=", "&\""); + std::string reason = utils::text::remove_html(utils::text::source_get_value(&req, 3, "", "")); facebook_user *fbu = new facebook_user(); - fbu->real_name = utils::text::source_get_value(&req, 2, "class=\"actor\">", "user_id = utils::text::source_get_value(&get, 2, "id=", "&"); + fbu->real_name = utils::text::remove_html(utils::text::source_get_value(&req, 3, "", "")); + fbu->user_id = utils::text::source_get_value2(&get, "id=", "&\""); if (!fbu->user_id.empty() && !fbu->real_name.empty()) { @@ -886,23 +887,23 @@ void FacebookProto::ProcessFriendRequests(void*) setString(hContact, "RequestTime", time.c_str()); //blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) - //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ) + //blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), reason(ASCIIZ) DBEVENTINFO dbei = {0}; dbei.cbSize = sizeof(DBEVENTINFO); dbei.szModule = m_szModuleName; dbei.timestamp = ::time(NULL); dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_AUTHREQUEST; - dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + fbu->real_name.length() + 5); + dbei.cbBlob = (DWORD)(sizeof(DWORD)*2 + fbu->real_name.length() + fbu->user_id.length() + reason.length() + 5); PBYTE pCurBlob = dbei.pBlob = (PBYTE) mir_alloc(dbei.cbBlob); *(PDWORD)pCurBlob = 0; pCurBlob += sizeof(DWORD); // UID *(PDWORD)pCurBlob = (DWORD)hContact; pCurBlob += sizeof(DWORD); // Contact Handle - strcpy((char*)pCurBlob, fbu->real_name.data()); pCurBlob += fbu->real_name.length()+1; // Nickname + strcpy((char*)pCurBlob, fbu->real_name.data()); pCurBlob += fbu->real_name.length() + 1; // Nickname *pCurBlob = '\0'; pCurBlob++; // First Name *pCurBlob = '\0'; pCurBlob++; // Last Name - *pCurBlob = '\0'; pCurBlob++; // E-mail - *pCurBlob = '\0'; // Reason + strcpy((char*)pCurBlob, fbu->user_id.data()); pCurBlob += fbu->user_id.length() + 1; // E-mail (we use it for string ID) + strcpy((char*)pCurBlob, reason.data()); pCurBlob += reason.length() + 1; // Reason (we use it for info about common friends) db_event_add(0, &dbei); -- cgit v1.2.3