summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-11 16:50:58 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-11 16:50:58 +0300
commitcfd7dee86b0cc9eb8ac8c87e9b2b4b356d462056 (patch)
treec0e73d506d24e2f93b0ce9ac9ee6e2604407490b
parent0751cfa1beb514037c56566e0201514ea08ce31b (diff)
AVS: if an avatar is already loaded, don't put it into a queue, just load & return
-rw-r--r--plugins/AVS/src/cache.cpp19
1 files changed, 16 insertions, 3 deletions
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.