diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2013-04-13 19:59:11 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2013-04-13 19:59:11 +0000 |
commit | 51b5164fd6c0ea0de58e4398e515dd73a0e12620 (patch) | |
tree | 94bed44c33f9c186f0110feadb56c1403ddf59cd /protocols/Skype/src/skype_profile.cpp | |
parent | 241aed20d47fe5e443370cd6224b5b2e844348d3 (diff) |
- fix some own avatar get/set bugs
git-svn-id: http://svn.miranda-ng.org/main/trunk@4449 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_profile.cpp')
-rw-r--r-- | protocols/Skype/src/skype_profile.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index c7ecd37e5d..ea35f7e482 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -11,7 +11,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) //if ((newTS > oldTS) || (!newTS && data.size() > 0 && _waccess(path, 0) == -1) || (newTS && _waccess(path, 0) == -1)) //hack for avatars without timestamp
bool hasNewAvatar = newTS > oldTS;
bool isAvatarEmpty = data.size() == 0;
- bool isAvatarFileExists = ::PathFileExists(path);
+ bool isAvatarFileExists = ::PathFileExists(path) > 0;
if ( !isAvatarEmpty)
{
if (hasNewAvatar || !isAvatarFileExists)
@@ -24,13 +24,24 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) this->SetSettingDword("AvatarTS", newTS);
- 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);
+ if (hContact)
+ {
+ 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);
+ }
+ else
+ {
+ ::mir_md5_byte_t digest[16];
+ ::mir_md5_hash((BYTE*)data.data(), data.size(), digest);
+ ::db_set_blob(hContact, this->m_szModuleName, "AvatarHash", digest, 16);
+
+ ::CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)path);
+ }
}
}
}
@@ -288,10 +299,11 @@ void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact)
{
+ this->UpdateProfileAvatar(obj, hContact);
+
uint newTS = obj->GetUintProp(/* *::P_PROFILE_TIMESTAMP */ 19);
if (newTS > this->GetSettingDword("ProfileTS"))
{
- this->UpdateProfileAvatar(obj, hContact);
this->UpdateProfileAboutText(obj, hContact);
this->UpdateProfileBirthday(obj, hContact);
this->UpdateProfileCity(obj, hContact);
|