From 49e1cc1238916a52a30acb6598b4b58e671e4032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 8 Sep 2013 16:16:26 +0000 Subject: Facebook: Duplicit contacts fixes - Try to fix creating duplicit contacts in first place - Don't notify duplicit contacts as "no longer on server-list" git-svn-id: http://svn.miranda-ng.org/main/trunk@6022 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/process.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'protocols') diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index bb8b95f3ea..218f95125a 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -212,17 +212,14 @@ void FacebookProto::ProcessFriendList(void* data) // Check avatar change CheckAvatarChange(hContact, fbu->image_url); - - delete fbu; - friends.erase(iter); + + // Mark this contact as deleted ("processed") and delete them later (as there may be some duplicit contacts to use) + fbu->deleted = true; } else { // Contact was removed from "server-list", notify it // Wasnt we already been notified about this contact? And was this real friend? - if (!getDword(hContact, FACEBOOK_KEY_DELETED, 0) - && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) == CONTACT_FRIEND) - { - + if (!getDword(hContact, FACEBOOK_KEY_DELETED, 0) && getByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, 0) == CONTACT_FRIEND) { setDword(hContact, FACEBOOK_KEY_DELETED, ::time(NULL)); setByte(hContact, FACEBOOK_KEY_CONTACT_TYPE, CONTACT_NONE); @@ -245,10 +242,14 @@ void FacebookProto::ProcessFriendList(void* data) // Check remaining contacts in map and add them to contact list for (std::map< std::string, facebook_user* >::iterator iter = friends.begin(); iter != friends.end(); ++iter) { facebook_user *fbu = iter->second; - - HANDLE hContact = AddToContactList(fbu, CONTACT_FRIEND, true); // This contact is surely new ...are you sure? + + if (!fbu->deleted) + HANDLE hContact = AddToContactList(fbu, CONTACT_FRIEND/*, true*/); // This contact is surely new ...am I sure? ...I'm not, so "true" is commented now + delete fbu; } + + friends.clear(); LOG("***** Friend list processed"); -- cgit v1.2.3