summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_vcard.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-02-03 16:08:38 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-02-03 16:08:38 +0300
commit1ef4b90ce07ccc4e372f0b8179c69438bff24ae2 (patch)
treeeb9cda4038333ff654e4da664325569d493c9648 /protocols/JabberG/src/jabber_vcard.cpp
parentceb375ad7f99c4169ffb3041037583996122fa57 (diff)
mime type standardization
Diffstat (limited to 'protocols/JabberG/src/jabber_vcard.cpp')
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index 2150161afd..16e57c3817 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -1132,15 +1132,9 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, wchar_t* szPhotoFileName)
DWORD nRead;
if (ReadFile(hFile, buffer, st.st_size, &nRead, NULL)) {
ptrA str(mir_base64_encode((PBYTE)(LPSTR)buffer, nRead));
- if (str != NULL) {
+ const wchar_t *szFileType = ProtoGetAvatarMimeType(ProtoGetBufferFormat(buffer));
+ if (str != NULL && szFileType != NULL) {
n = v << XCHILD(L"PHOTO");
- wchar_t *szFileType;
- switch (ProtoGetBufferFormat(buffer)) {
- case PA_FORMAT_PNG: szFileType = L"image/png"; break;
- case PA_FORMAT_GIF: szFileType = L"image/gif"; break;
- case PA_FORMAT_BMP: szFileType = L"image/bmp"; break;
- default: szFileType = L"image/jpeg"; break;
- }
n << XCHILD(L"TYPE", szFileType);
n << XCHILD(L"BINVAL", _A2T(str));