summaryrefslogtreecommitdiff
path: root/protocols/Telegram/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Telegram/src')
-rw-r--r--protocols/Telegram/src/avatars.cpp11
-rw-r--r--protocols/Telegram/src/stdafx.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp
index 5c309c17be..225dcee0e2 100644
--- a/protocols/Telegram/src/avatars.cpp
+++ b/protocols/Telegram/src/avatars.cpp
@@ -87,8 +87,17 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj)
for (auto &it : m_arFiles) {
if (it->m_uniqueId == pFile->remote_->unique_id_.c_str()) {
- MoveFileW(wszExistingFile, it->m_destPath);
if (it->m_type == it->AVATAR) {
+ if (it->m_destPath.Right(5).MakeLower() == L".webp") {
+ if (auto *pImage = FreeImage_LoadU(FIF_WEBP, wszExistingFile)) {
+ it->m_destPath.Truncate(it->m_destPath.GetLength() - 5);
+ it->m_destPath += L".png";
+ FreeImage_SaveU(FIF_PNG, pImage, it->m_destPath);
+ FreeImage_Unload(pImage);
+ }
+ }
+ else MoveFileW(wszExistingFile, it->m_destPath);
+
SMADD_CONT cont = {1, m_szModuleName, it->m_destPath};
CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, LPARAM(&cont));
}
diff --git a/protocols/Telegram/src/stdafx.h b/protocols/Telegram/src/stdafx.h
index 1ded1b61dd..47564f1ee3 100644
--- a/protocols/Telegram/src/stdafx.h
+++ b/protocols/Telegram/src/stdafx.h
@@ -25,6 +25,8 @@
#include <m_popup.h>
#include <m_smileyadd.h>
+#include "../../libs/freeimage/src/FreeImage.h"
+
#include "td/telegram/Client.h"
#include "td/telegram/td_api.h"
#include "td/telegram/td_api.hpp"