summaryrefslogtreecommitdiff
path: root/plugins/AVS/src/cache.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-07-23 15:43:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-07-23 15:43:18 +0000
commit480aab2b3ffb0b439e160a8c716ef0d982af1acf (patch)
tree19a065c7ac15df14a6a32435d4e24d36283ae3ac /plugins/AVS/src/cache.cpp
parent7d88f20d344ebd7c8db2778feda873b251019d9a (diff)
removing direct access to metas: AVS
git-svn-id: http://svn.miranda-ng.org/main/trunk@9924 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AVS/src/cache.cpp')
-rw-r--r--plugins/AVS/src/cache.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp
index 999d9cba53..e12d979091 100644
--- a/plugins/AVS/src/cache.cpp
+++ b/plugins/AVS/src/cache.cpp
@@ -30,10 +30,10 @@ static CRITICAL_SECTION cachecs, alloccs;
* does not link the new block with the old block(s) - caller needs to do this
*/
-static CacheNode *AllocCacheBlock()
+static CacheNode* AllocCacheBlock()
{
CacheNode *allocedBlock = (CacheNode*)malloc(CACHE_BLOCKSIZE * sizeof(struct CacheNode));
- ZeroMemory((void *)allocedBlock, sizeof(struct CacheNode) * CACHE_BLOCKSIZE);
+ ZeroMemory((void *)allocedBlock, sizeof(CacheNode) * CACHE_BLOCKSIZE);
for (int i = 0; i < CACHE_BLOCKSIZE - 1; i++)
allocedBlock[i].pNextNode = &allocedBlock[i + 1]; // pre-link the alloced block
@@ -45,7 +45,7 @@ static CacheNode *AllocCacheBlock()
if (g_curBlock == g_maxBlock) {
g_maxBlock += 10;
- g_cacheBlocks = (CacheNode **)realloc(g_cacheBlocks, g_maxBlock * sizeof(CacheNode*));
+ g_cacheBlocks = (CacheNode**)realloc(g_cacheBlocks, g_maxBlock * sizeof(CacheNode*));
}
g_cacheBlocks[g_curBlock++] = allocedBlock;
@@ -88,7 +88,7 @@ static CacheNode* AddToList(CacheNode *node)
return pCurrent;
}
-CacheNode *FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny)
+CacheNode* FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny)
{
if (g_shutDown)
return NULL;
@@ -126,7 +126,6 @@ CacheNode *FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny)
}
foundNode->ace.hContact = hContact;
- foundNode->dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0);
foundNode->loaded = FALSE;
foundNode->mustLoad = 1; // pic loader will watch this and load images
SetEvent(hLoaderEvent); // wake him up
@@ -142,21 +141,19 @@ CacheNode *FindAvatarInCache(MCONTACT hContact, BOOL add, BOOL findAny)
* popup plugin.
*/
-void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY *)-1)
+void NotifyMetaAware(MCONTACT hContact, CacheNode *node = NULL, AVATARCACHEENTRY *ace = (AVATARCACHEENTRY*)-1)
{
if (g_shutDown)
return;
- if (ace == (AVATARCACHEENTRY *)-1)
+ if (ace == (AVATARCACHEENTRY*)-1)
ace = &node->ace;
NotifyEventHooks(hEventChanged, hContact, (LPARAM)ace);
- if ((node->dwFlags & MC_ISSUBCONTACT) && db_get_b(NULL, META_PROTO, "Enabled", 0)) {
- MCONTACT hMasterContact = db_mc_getMeta(hContact);
- if (hMasterContact && db_mc_getMostOnline(hMasterContact) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0))
- NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace);
- }
+ MCONTACT hMasterContact = db_mc_getMeta(hContact);
+ if (hMasterContact && db_mc_getMostOnline(hMasterContact) == hContact && !db_get_b(hMasterContact, "ContactPhoto", "Locked", 0))
+ NotifyEventHooks(hEventChanged, (WPARAM)hMasterContact, (LPARAM)ace);
if (node->dwFlags & AVH_MUSTNOTIFY) {
// Fire the event for avatar history
@@ -206,8 +203,7 @@ void DeleteAvatarFromCache(MCONTACT hContact, BOOL forever)
hContact = GetContactThatHaveTheAvatar(hContact);
CacheNode *node = FindAvatarInCache(hContact, FALSE);
if (node == NULL) {
- struct CacheNode temp_node = { 0 };
- temp_node.dwFlags |= (db_mc_isSub(hContact) ? MC_ISSUBCONTACT : 0);
+ CacheNode temp_node = { 0 };
NotifyMetaAware(hContact, &temp_node, (AVATARCACHEENTRY *)GetProtoDefaultAvatar(hContact));
return;
}