- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
/**/
TCHAR* szFileType = _T("");
int ftype = JGetByte( hContact, "AvatarType", PA_FORMAT_UNKNOWN );
if( ftype == PA_FORMAT_UNKNOWN ) {
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile( ptszDest, &ffd );
if ( hFind != INVALID_HANDLE_VALUE ) {
wchar_t* szExt = m_strrchrs( ffd.cFileName, ".\\" );
if( szExt ) {
if( !_tcsicmp( szExt, _T(".jpg") ) )
ftype = PA_FORMAT_JPEG;
else if( !_tcsicmp( szExt, _T(".png") ) )
ftype = PA_FORMAT_PNG;
else if( !_tcsicmp( szExt, _T(".gif") ) )
ftype = PA_FORMAT_GIF;
else if( !_tcsicmp( szExt, _T(".bmp") ) )
ftype = PA_FORMAT_BMP;
if( ftype != PA_FORMAT_UNKNOWN )
JSetByte( hContact, "AvatarType", ftype );
}
FindClose( hFind );
}
}
switch( ftype ) {
case PA_FORMAT_JPEG: szFileType = _T("jpg"); break;
case PA_FORMAT_PNG: szFileType = _T("png"); break;
case PA_FORMAT_GIF: szFileType = _T("gif"); break;
case PA_FORMAT_BMP: szFileType = _T("bmp"); break;
}