From d057fcad5175ef542723981f59c6184a67942864 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 1 Aug 2019 12:43:17 +0300 Subject: fixes #2022 (shitty internal AVS flags finally removed from global include file) --- include/m_avatars.h | 9 --------- plugins/AVS/src/cache.cpp | 15 ++++++++------- plugins/AVS/src/main.cpp | 2 +- plugins/AVS/src/services.cpp | 2 +- plugins/AVS/src/stdafx.h | 4 +--- plugins/AVS/src/utils.cpp | 2 +- plugins/AVS/src/version.h | 2 +- 7 files changed, 13 insertions(+), 23 deletions(-) diff --git a/include/m_avatars.h b/include/m_avatars.h index bf99e0ff6e..620db3f6cc 100644 --- a/include/m_avatars.h +++ b/include/m_avatars.h @@ -230,15 +230,6 @@ struct CONTACTAVATARCHANGEDNOTIFICATION #define MS_AV_REPORTMYAVATARCHANGED "SV_Avatars/ReportMyAvatarChanged" -/* -* flags for internal use ONLY -*/ - -#define AVH_MUSTNOTIFY 0x04 // node->dwFlags (loader thread must notify avatar history about change/delete event) -#define AVS_DELETENODEFOREVER 0x08 - - - // Protocol services ////////////////////////////////////////////////////////////////////// /* diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index d698f42b93..6c965f8cc4 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -81,7 +81,7 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) cc = arCache.find((CacheNode*)&hContact); if (cc) { cc->t_lastAccess = time(0); - return (cc->loaded || findAny) ? cc : nullptr; + return (cc->bLoaded || findAny) ? cc : nullptr; } // not found @@ -101,11 +101,11 @@ CacheNode* FindAvatarInCache(MCONTACT hContact, bool add, bool findAny) case 1: // loaded, everything is ok if (cc->hbmPic != nullptr) - cc->loaded = true; + cc->bLoaded = true; break; default: - cc->loaded = false; + cc->bLoaded = false; break; } @@ -133,9 +133,10 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) 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) { + if (node->bNotify) { // Fire the event for avatar history - node->dwFlags &= ~AVH_MUSTNOTIFY; + node->bNotify = false; + if (node->szFilename[0] != '\0') { CONTACTAVATARCHANGEDNOTIFICATION cacn = {}; cacn.hContact = hContact; @@ -262,7 +263,7 @@ void PicLoader(LPVOID) { mir_cslock l(cachecs); memcpy(node, &ace_temp, sizeof(AVATARCACHEENTRY)); - node->loaded = TRUE; + node->bLoaded = true; } if (oldPic) DeleteObject(oldPic); @@ -273,7 +274,7 @@ void PicLoader(LPVOID) { mir_cslock l(cachecs); memcpy(node, &ace_temp, sizeof(AVATARCACHEENTRY)); - node->loaded = FALSE; + node->bLoaded = false; } if (oldPic) DeleteObject(oldPic); diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index 0c2bdb0772..adc9ac3b51 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -110,7 +110,7 @@ static int MetaChanged(WPARAM hMeta, LPARAM hSubContact) // Get the node CacheNode *node = FindAvatarInCache(hSubContact, true); - if (node == nullptr || !node->loaded) { + if (node == nullptr || !node->bLoaded) { ace = (AVATARCACHEENTRY*)GetProtoDefaultAvatar(hSubContact); QueueAdd(hSubContact); } diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 6498536305..8da0886b08 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -35,7 +35,7 @@ INT_PTR GetAvatarBitmap(WPARAM hContact, LPARAM) // Get the node CacheNode *node = FindAvatarInCache(hContact, true); - if (node == nullptr || !node->loaded) + if (node == nullptr || !node->bLoaded) return (INT_PTR)GetProtoDefaultAvatar(hContact); return (INT_PTR)node; } diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index b2479bd540..c1084192f4 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -81,7 +81,7 @@ struct CacheNode : public AVATARCACHEENTRY, public MZeroedObject CacheNode(); ~CacheNode(); - BOOL loaded; + bool bLoaded, bNotify; int pa_format; void wipeInfo(); @@ -141,8 +141,6 @@ void MakePathRelative(MCONTACT hContact); void MakePathRelative(MCONTACT hContact, wchar_t *dest); void MyPathToAbsolute(const wchar_t *ptszPath, wchar_t *ptszDest); -HBITMAP LoadPNG(struct AVATARCACHEENTRY *ace, char *szFilename); - void UnloadCache(void); int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *szProto); void DeleteAvatarFromCache(MCONTACT hContact, bool bForever); diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 844d59b956..cea5beb71e 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -412,7 +412,7 @@ int ChangeAvatar(MCONTACT hContact, bool fLoad, bool fNotifyHist, int pa_format) return 0; if (fNotifyHist) - node->dwFlags |= AVH_MUSTNOTIFY; + node->bNotify = true; node->pa_format = pa_format; if (fLoad) { diff --git a/plugins/AVS/src/version.h b/plugins/AVS/src/version.h index 8215ab2f5d..038b133322 100644 --- a/plugins/AVS/src/version.h +++ b/plugins/AVS/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 98 #define __RELEASE_NUM 1 -#define __BUILD_NUM 1 +#define __BUILD_NUM 2 #include -- cgit v1.2.3