summaryrefslogtreecommitdiff
path: root/plugins/Toaster/src/services.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-08-29 19:42:01 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-08-29 19:42:01 +0000
commitefd0c6a4ad866396e45dc5ab6e4da6d18fceccd3 (patch)
tree226390b8e33e9e55d2766da3e46d5a822aa4a41d /plugins/Toaster/src/services.cpp
parent084110de8be5ea84ec86d643c9ca4c2ea5aa65dc (diff)
Toaster: converting avatars to png
git-svn-id: http://svn.miranda-ng.org/main/trunk@15102 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Toaster/src/services.cpp')
-rw-r--r--plugins/Toaster/src/services.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp
index 20a9303373..dab8258726 100644
--- a/plugins/Toaster/src/services.cpp
+++ b/plugins/Toaster/src/services.cpp
@@ -46,7 +46,17 @@ static void ShowToastNotification(TCHAR* text, TCHAR* title, MCONTACT hContact)
PROTO_AVATAR_INFORMATION pai = { 0 };
pai.hContact = hContact;
CallProtoService(szProto, PS_GETAVATARINFO, (WPARAM)0, (LPARAM)&pai);
- imagePath = mir_tstrdup(pai.filename);
+ if (pai.format != PA_FORMAT_PNG)
+ {
+ wchar_t dir[MAX_PATH];
+ FoldersGetCustomPathT(g_hTempAvatarsFolder, dir, _countof(dir), VARSW(L"%miranda_userdata%\\Temp"));
+ ToasterAvatar *ta = new ToasterAvatar(&pai);
+ CMStringW wszPath(FORMAT, L"%s\\%lld.%d.png", dir, hContact, db_get_dw(hContact, "ContactPhoto", "ImagePath"));
+ ta->Save(wszPath);
+ imagePath = wszPath.Detach();
+ delete ta;
+ }
+ imagePath = pai.filename[0] ? mir_tstrdup(pai.filename) : nullptr;
}
}