summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_utils.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-10-28 19:35:19 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-10-28 19:35:19 +0000
commit25fb34c76a42858dc732250b769bb08324d3a996 (patch)
tree8709277b454f1c115f0101036d0653629d5afe48 /protocols/Skype/src/skype_utils.cpp
parentfbfdab9ebf0df810b548e502d93fa3be260acf61 (diff)
- fixed some issues in own info loading
- fixed avatar services git-svn-id: http://svn.miranda-ng.org/main/trunk@2105 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_utils.cpp')
-rw-r--r--protocols/Skype/src/skype_utils.cpp46
1 files changed, 33 insertions, 13 deletions
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index a7b397b826..f4fbc8486e 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -231,22 +231,40 @@ void CSkypeProto::FakeAsync(void *param)
::mir_free(param);
}
-wchar_t* CSkypeProto::GetOwnAvatarFilePath()
+int CSkypeProto::DetectAvatarFormatBuffer(const char *pBuffer)
{
- /*DBVARIANT dbvFile = {DBVT_DELETED};
+ if (!strncmp(pBuffer, "%PNG", 4))
+ return PA_FORMAT_PNG;
- if (!getSettingStringT(NULL, "AvatarFile", &dbvFile))
- {
- TCHAR tmp[MAX_PATH * 2];
- CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)dbvFile.ptszVal, (LPARAM)tmp);
- ICQFreeVariant(&dbvFile);
+ if (!strncmp(pBuffer, "GIF8", 4))
+ return PA_FORMAT_GIF;
+
+ if (!_strnicmp(pBuffer, "<?xml", 5))
+ return PA_FORMAT_XML;
+
+ if ((((DWORD*)pBuffer)[0] == 0xE0FFD8FFul) || (((DWORD*)pBuffer)[0] == 0xE1FFD8FFul))
+ return PA_FORMAT_JPEG;
+
+ if (!strncmp(pBuffer, "BM", 2))
+ return PA_FORMAT_BMP;
+
+ return PA_FORMAT_UNKNOWN;
+}
+
+int CSkypeProto::DetectAvatarFormat(const wchar_t *path)
+{
+ int src = _wopen(path, _O_BINARY | _O_RDONLY, 0);
+ if (src == -1)
+ return PA_FORMAT_UNKNOWN;
+
+ char pBuf[32];
+ _read(src, pBuf, 32);
+ _close(src);
- return null_strdup(tmp);
- }*/
- return NULL;
+ return CSkypeProto::DetectAvatarFormatBuffer(pBuf);
}
-wchar_t* CSkypeProto::GetContactAvatarFilePath(wchar_t* skypeName)
+wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
{
wchar_t* path = new wchar_t[MAX_PATH * 2];
@@ -281,8 +299,10 @@ wchar_t* CSkypeProto::GetContactAvatarFilePath(wchar_t* skypeName)
// make sure the avatar cache directory exists
::CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- wcscat(path, skypeName);
- wcscat(path, L".jpg");
+ wchar_t *sid = this->GetSettingString("sid");
+ ::wcscat(path, sid);
+ ::wcscat(path, L".jpg");
+ ::mir_free(sid);
return path;
}