From 2d8b55b9bfd482225e5ab80ad76d8373b8677617 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 23 Nov 2012 18:22:46 +0000 Subject: little bit better with avatars git-svn-id: http://svn.miranda-ng.org/main/trunk@2452 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_contacts.cpp | 38 +++++++++++++++------------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'protocols/Skype/src/skype_contacts.cpp') diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 7669615456..0c809f4dfc 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -42,32 +42,28 @@ void CSkypeProto::UpdateContactAvatar(HANDLE hContact, CContact::Ref contact) uint newTS = 0; contact->GetPropAvatarTimestamp(newTS); DWORD oldTS = this->GetSettingDword(hContact, "AvatarTS"); - if (newTS > oldTS) + SEBinary data; + contact->GetPropAvatarImage(data); + if ((newTS > oldTS) || (!newTS && data.size() > 0)) //hack for avatars without timestamp { - SEBinary data; - contact->GetPropAvatarImage(data); - - if (data.size() > 0) + wchar_t *path = this->GetContactAvatarFilePath(this->GetSettingString(hContact, "sid")); + FILE* fp = _wfopen(path, L"wb"); + if (fp) { - wchar_t *path = this->GetContactAvatarFilePath(this->GetSettingString(hContact, "sid")); - FILE* fp = _wfopen(path, L"wb"); - if (fp) - { - fwrite(data.data(), sizeof(char), data.size(), fp); - fclose(fp); + fwrite(data.data(), sizeof(char), data.size(), fp); + fclose(fp); - this->SetSettingDword(hContact, "AvatarTS", newTS); + this->SetSettingDword(hContact, "AvatarTS", newTS); - PROTO_AVATAR_INFORMATIONW pai = {0}; - pai.cbSize = sizeof(pai); - pai.format = PA_FORMAT_JPEG; - pai.hContact = hContact; - wcscpy(pai.filename, path); + PROTO_AVATAR_INFORMATIONW pai = {0}; + pai.cbSize = sizeof(pai); + pai.format = PA_FORMAT_JPEG; + pai.hContact = hContact; + wcscpy(pai.filename, path); - this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); - } - delete path; - } + this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); + } + delete path; } } -- cgit v1.2.3