diff options
author | George Hazan <george.hazan@gmail.com> | 2023-10-26 16:00:06 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-10-26 16:00:06 +0300 |
commit | be005fdd7a3a801ec698dc211cd2e0dd80030fb6 (patch) | |
tree | 2dd21c735e55845e2c86d0b1a51d5de3206281dc /protocols | |
parent | ba5a0a06e1ed5b0dc3e330dbb939f13a6651b750 (diff) |
SmileyAdd_LoadContactSmileys - helper function for adding custom smileys
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Facebook/src/proto.cpp | 6 | ||||
-rw-r--r-- | protocols/Facebook/src/server.cpp | 5 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/proto.cpp | 4 | ||||
-rw-r--r-- | protocols/ICQ-WIM/src/server.cpp | 5 | ||||
-rw-r--r-- | protocols/Telegram/src/avatars.cpp | 3 | ||||
-rw-r--r-- | protocols/Telegram/src/proto.cpp | 9 | ||||
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 7 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 3 |
8 files changed, 15 insertions, 27 deletions
diff --git a/protocols/Facebook/src/proto.cpp b/protocols/Facebook/src/proto.cpp index 6f3209fe02..30f0d7163f 100644 --- a/protocols/Facebook/src/proto.cpp +++ b/protocols/Facebook/src/proto.cpp @@ -137,12 +137,10 @@ void FacebookProto::OnModulesLoaded() VARSW wszCache(L"%miranda_avatarcache%");
CMStringW wszPath(FORMAT, L"%s\\%S\\Stickers\\*.png", wszCache.get(), m_szModuleName);
- SMADD_CONT cont = { SMADD_FOLDER, m_szModuleName, wszPath };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FOLDER, m_szModuleName, wszPath);
wszPath.Format(L"%s\\%S\\Stickers\\*.webp", wszCache.get(), m_szModuleName);
- cont.path = wszPath;
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FOLDER, m_szModuleName, wszPath);
// contacts cache
for (auto &cc : AccContacts()) {
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp index 482db30bd7..fcf1aacb2e 100644 --- a/protocols/Facebook/src/server.cpp +++ b/protocols/Facebook/src/server.cpp @@ -732,7 +732,7 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root) // parse stickers
CMStringA stickerId = root["stickerId"].as_mstring();
if (!stickerId.IsEmpty()) {
- if (ServiceExists(MS_SMILEYADD_LOADCONTACTSMILEYS)) {
+ if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
CMStringW wszPath(FORMAT, L"%s\\%S\\Stickers", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
CreateDirectoryTreeW(wszPath);
@@ -783,8 +783,7 @@ void FacebookProto::OnPublishPrivateMessage(const JSONNode &root) szBody += "\r\n";
szBody += "STK{" + stickerId + "}";
- SMADD_CONT cont = { SMADD_FILE, m_szModuleName, wszFileName };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FILE, m_szModuleName, wszFileName);
}
else szBody += TranslateU("Sticker received");
}
diff --git a/protocols/ICQ-WIM/src/proto.cpp b/protocols/ICQ-WIM/src/proto.cpp index 0633783f9d..93664a6ed3 100644 --- a/protocols/ICQ-WIM/src/proto.cpp +++ b/protocols/ICQ-WIM/src/proto.cpp @@ -138,9 +138,7 @@ void CIcqProto::OnModulesLoaded() HookProtoEvent(ME_USERINFO_INITIALISE, &CIcqProto::OnUserInfoInit);
// load custom smilies
- CMStringW wszPath(GetAvatarPath() + L"\\Stickers\\*.png");
- SMADD_CONT cont = { SMADD_FOLDER, m_szModuleName, wszPath };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FOLDER, m_szModuleName, GetAvatarPath() + L"\\Stickers\\*.png");
}
void CIcqProto::OnShutdown()
diff --git a/protocols/ICQ-WIM/src/server.cpp b/protocols/ICQ-WIM/src/server.cpp index 853e9ccde7..1af5cbd52c 100644 --- a/protocols/ICQ-WIM/src/server.cpp +++ b/protocols/ICQ-WIM/src/server.cpp @@ -201,7 +201,7 @@ bool CIcqProto::CheckFile(MCONTACT hContact, CMStringW &wszText, IcqFileInfo *&p // is it a sticker?
if (pFileInfo->bIsSticker) {
- if (ServiceExists(MS_SMILEYADD_LOADCONTACTSMILEYS)) {
+ if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
auto *pNew = new AsyncHttpRequest(CONN_NONE, REQUEST_GET, pFileInfo->szUrl, &CIcqProto::OnGetSticker);
pNew->flags |= NLHRF_NODUMP | NLHRF_SSL | NLHRF_HTTP11 | NLHRF_REDIRECT;
pNew->pUserInfo = wszUrl.GetBuffer();
@@ -1010,8 +1010,7 @@ void CIcqProto::OnGetSticker(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest *pReq) fwrite(pReply->pData, 1, pReply->dataLength, out);
fclose(out);
- SMADD_CONT cont = { SMADD_FILE, m_szModuleName, wszFileName };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FILE, m_szModuleName, wszFileName);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index 11646a681d..89d3ef98e0 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -193,8 +193,7 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj) }
else MoveFileW(wszExistingFile, wszFullName);
- SMADD_CONT cont = { SMADD_FILE, m_szModuleName, wszFullName };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FILE, m_szModuleName, wszFullName);
mir_cslock lck(m_csFiles);
m_arFiles.remove(F);
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp index 61ecf9c132..e6de52e581 100644 --- a/protocols/Telegram/src/proto.cpp +++ b/protocols/Telegram/src/proto.cpp @@ -150,12 +150,9 @@ void CTelegramProto::OnModulesLoaded() } setByte(DBKEY_COMPAT, 3); - m_bSmileyAdd = ServiceExists(MS_SMILEYADD_LOADCONTACTSMILEYS); - if (m_bSmileyAdd) { - CMStringW wszStickersPath(GetAvatarPath() + L"\\Stickers\\*.*"); - SMADD_CONT cont = { SMADD_FOLDER, m_szModuleName, wszStickersPath }; - CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont)); - } + m_bSmileyAdd = ServiceExists(MS_SMILEYADD_REPLACESMILEYS); + if (m_bSmileyAdd) + SmileyAdd_LoadContactSmileys(SMADD_FOLDER, m_szModuleName, GetAvatarPath() + L"\\Stickers\\*.*"); } void CTelegramProto::OnShutdown() diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 73ae348edc..46aa6312ff 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -1439,7 +1439,7 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport else if (m_vkOptions.bUseStikersAsStaticSmileys)
res.AppendFormat(L"[sticker:%d]", iStickerId);
else {
- if (ServiceExists(MS_SMILEYADD_LOADCONTACTSMILEYS)) {
+ if (ServiceExists(MS_SMILEYADD_REPLACESMILEYS)) {
CMStringW wszPath(FORMAT, L"%s\\%S\\Stickers", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
CreateDirectoryTreeW(wszPath);
@@ -1465,10 +1465,9 @@ CMStringW CVkProto::GetAttachmentDescr(const JSONNode &jnAttachments, BBCSupport else bSuccess = true;
if (bSuccess) {
- res.AppendFormat(L"[sticker-%d]", iStickerId);
+ res.AppendFormat(L"[sticker-%d]", iStickerId);
- SMADD_CONT cont = { SMADD_FILE, m_szModuleName, wszFileName };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FILE, m_szModuleName, wszFileName);
}
else res += SetBBCString(TranslateT("Sticker"), iBBC, vkbbcUrl, wszUrl);
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 4c6b79951a..a90c60e564 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -128,8 +128,7 @@ void CVkProto::InitSmileys() return;
CMStringW wszPath(FORMAT, L"%s\\%S\\Stickers\\*.png", VARSW(L"%miranda_avatarcache%").get(), m_szModuleName);
- SMADD_CONT cont = { SMADD_FOLDER, m_szModuleName, wszPath };
- CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
+ SmileyAdd_LoadContactSmileys(SMADD_FOLDER, m_szModuleName, wszPath);
}
// Menu support
|