From cfd7dee86b0cc9eb8ac8c87e9b2b4b356d462056 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 11 Apr 2018 16:50:58 +0300 Subject: AVS: if an avatar is already loaded, don't put it into a queue, just load & return --- plugins/AVS/src/cache.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'plugins/AVS') diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index 11d8620b02..bb04abaf2d 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -90,10 +90,23 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) cc->hContact = hContact; arCache.insert(cc); - PushAvatarRequest(cc); + switch (CreateAvatarInCache(hContact, cc, nullptr)) { + case -2: // no avatar data in settings, retrieve + PushAvatarRequest(cc); + SetEvent(hLoaderEvent); // wake him up + break; + + case 1: // loaded, everything is ok + if (cc->hbmPic != nullptr) + cc->loaded = true; + break; + + default: + cc->loaded = false; + break; + } - SetEvent(hLoaderEvent); // wake him up - return nullptr; + return cc; } // output a notification message. -- cgit v1.2.3