diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-11-23 18:22:46 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-11-23 18:22:46 +0000 |
commit | 2d8b55b9bfd482225e5ab80ad76d8373b8677617 (patch) | |
tree | 706cd5725b72388c4112d34b3a8aba61c16e422c /protocols/Skype/src/skype_contacts.cpp | |
parent | 1cdc1003e20312844ed02214301b5a6f48ea7eda (diff) |
little bit better with avatars
git-svn-id: http://svn.miranda-ng.org/main/trunk@2452 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_contacts.cpp')
-rw-r--r-- | protocols/Skype/src/skype_contacts.cpp | 38 |
1 files changed, 17 insertions, 21 deletions
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;
}
}
|