diff options
author | George Hazan <ghazan@miranda.im> | 2017-02-03 16:08:38 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-02-03 16:08:38 +0300 |
commit | 1ef4b90ce07ccc4e372f0b8179c69438bff24ae2 (patch) | |
tree | eb9cda4038333ff654e4da664325569d493c9648 /protocols/JabberG/src/jabber_iqid.cpp | |
parent | ceb375ad7f99c4169ffb3041037583996122fa57 (diff) |
mime type standardization
Diffstat (limited to 'protocols/JabberG/src/jabber_iqid.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_iqid.cpp | 19 |
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;
|