diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-11 10:41:37 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-11 10:41:37 +0000 |
commit | 94dcc72f13094157f344f284aec4edf0c0f5faa1 (patch) | |
tree | 74c078daadd4abe5aea9e9e0a73b4dd7c4a7fde1 /protocols/JabberG/src/jabber_util.cpp | |
parent | 42ff2169dbddd25d06404623dba2fff222d17c73 (diff) |
ProtoGetAvatarFormat, ProtoGetAvatarFileFormat, ProtoGetBufferFormat, ProtoGetAvatarExtension - standard helpers for protocol avatars' processing instead of the zoo that existed previously
git-svn-id: http://svn.miranda-ng.org/main/trunk@5645 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_util.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 34f429c83b..2a319cd7ea 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -969,18 +969,6 @@ TCHAR* __stdcall JabberStripJid(const TCHAR *jid, TCHAR *dest, size_t destLen) /////////////////////////////////////////////////////////////////////////////////////////
// JabberGetPictureType - tries to autodetect the picture type from the buffer
-int __stdcall JabberGetPictureType(const char* buf)
-{
- if (buf != NULL) {
- if (memcmp(buf, "GIF8", 4) == 0) return PA_FORMAT_GIF;
- if (memcmp(buf, "\x89PNG", 4) == 0) return PA_FORMAT_PNG;
- if (memcmp(buf, "BM", 2) == 0) return PA_FORMAT_BMP;
- if (memcmp(buf, "\xFF\xD8", 2) == 0) return PA_FORMAT_JPEG;
- }
-
- return PA_FORMAT_UNKNOWN;
-}
-
LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf)
{
if (LPCTSTR ptszType = xmlGetText( xmlGetChild(node , "TYPE")))
@@ -990,7 +978,7 @@ LPCTSTR __stdcall JabberGetPictureType(HXML node, const char *picBuf) !_tcscmp(ptszType, _T("image/bmp")))
return ptszType;
- switch(JabberGetPictureType(picBuf)) {
+ switch( ProtoGetBufferFormat(picBuf)) {
case PA_FORMAT_GIF: return _T("image/gif");
case PA_FORMAT_BMP: return _T("image/bmp");
case PA_FORMAT_PNG: return _T("image/png");
@@ -1641,7 +1629,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) if (res) {
hHttpCon = res->nlc;
if (res->resultCode == 200 && res->dataLength) {
- int pictureType = JabberGetPictureType(res->pData);
+ int pictureType = ProtoGetBufferFormat(res->pData);
if (pictureType != PA_FORMAT_UNKNOWN) {
PROTO_AVATAR_INFORMATIONT AI;
AI.cbSize = sizeof(AI);
|