summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_iqid.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_iqid.cpp
parentceb375ad7f99c4169ffb3041037583996122fa57 (diff)
mime type standardization
Diffstat (limited to 'protocols/JabberG/src/jabber_iqid.cpp')
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index a91cd1d3d4..df2fd4cf42 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -1405,19 +1405,14 @@ void CJabberProto::OnIqResultGotAvatar(MCONTACT hContact, HXML n, const wchar_t
return;
int pictureType;
- if (mimeType != NULL) {
- if (!mir_wstrcmp(mimeType, L"image/jpeg")) pictureType = PA_FORMAT_JPEG;
- else if (!mir_wstrcmp(mimeType, L"image/png")) pictureType = PA_FORMAT_PNG;
- else if (!mir_wstrcmp(mimeType, L"image/gif")) pictureType = PA_FORMAT_GIF;
- else if (!mir_wstrcmp(mimeType, L"image/bmp")) pictureType = PA_FORMAT_BMP;
- else {
-LBL_ErrFormat:
- debugLogW(L"Invalid mime type specified for picture: %s", mimeType);
- return;
- }
+ if (mimeType != NULL)
+ pictureType = ProtoGetAvatarFormatByMimeType(mimeType);
+ else
+ pictureType = ProtoGetBufferFormat(body, 0);
+ if (pictureType == PA_FORMAT_UNKNOWN) {
+ debugLogW(L"Invalid mime type specified for picture: %s", mimeType);
+ return;
}
- else if ((pictureType = ProtoGetBufferFormat(body, 0)) == PA_FORMAT_UNKNOWN)
- goto LBL_ErrFormat;
PROTO_AVATAR_INFORMATION ai;
ai.format = pictureType;