From aae341e9afbea80ab1f1003307571625e73f1446 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 1 Dec 2024 14:17:39 +0300 Subject: SmileyAdd: added SMADD_SELECTSMILEY::szProto field for #4615 --- plugins/ExternalAPI/m_smileyadd.h | 1 + plugins/SmileyAdd/src/services.cpp | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/ExternalAPI/m_smileyadd.h b/plugins/ExternalAPI/m_smileyadd.h index f9bc17ea6a..e93c36a936 100644 --- a/plugins/ExternalAPI/m_smileyadd.h +++ b/plugins/ExternalAPI/m_smileyadd.h @@ -213,6 +213,7 @@ void __forceinline SmileyAdd_LoadContactSmileys(int type, const char *pszModule, struct SMADD_SELECTSMILEY { + const char *pszProto; // protocol module or NULL for emoji const char *pszSmileys; // list of smileys or zero to display all pack int xPosition; int yPosition; diff --git a/plugins/SmileyAdd/src/services.cpp b/plugins/SmileyAdd/src/services.cpp index f7419c7b77..5391ce58b1 100644 --- a/plugins/SmileyAdd/src/services.cpp +++ b/plugins/SmileyAdd/src/services.cpp @@ -326,14 +326,18 @@ static INT_PTR LoadContactSmileys(WPARAM, LPARAM lParam) static INT_PTR SelectSmiley(WPARAM, LPARAM lParam) { auto *pParam = (SMADD_SELECTSMILEY *)lParam; - if (pParam == nullptr || !g_pEmoji) + if (pParam == nullptr) return 1; + auto *sml = (pParam->pszProto) ? FindSmileyPack(pParam->pszProto) : g_pEmoji; + if (sml == nullptr) + return 2; + SmileyPackType *pPack; if (pParam->pszSmileys) { ptrW pText(mir_utf8decodeW(pParam->pszSmileys)); pPack = new SmileyPackType(); - auto &pList = g_pEmoji->GetSmileyList(); + auto &pList = sml->GetSmileyList(); for (auto *p = wcstok(pText, L" "); p; p = wcstok(0, L" ")) { for (auto &it : pList) { @@ -344,7 +348,7 @@ static INT_PTR SelectSmiley(WPARAM, LPARAM lParam) } } } - else pPack = new SmileyPackType(*g_pEmoji); + else pPack = new SmileyPackType(*sml); SmileyToolWindowParam *stwp = new SmileyToolWindowParam; stwp->pSmileyPack = pPack; -- cgit v1.2.3