From e027d86c08e0b00e33152f2541bf58875bad8a51 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 25 Nov 2012 11:08:37 +0000 Subject: fixed getting of own avatar git-svn-id: http://svn.miranda-ng.org/main/trunk@2475 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype.cpp | 2 +- protocols/Skype/src/skype_profile.cpp | 42 +++++++++++++++------------------- protocols/Skype/src/skype_services.cpp | 1 + 3 files changed, 21 insertions(+), 24 deletions(-) (limited to 'protocols/Skype/src') diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp index 915a178276..7c19a055aa 100644 --- a/protocols/Skype/src/skype.cpp +++ b/protocols/Skype/src/skype.cpp @@ -333,7 +333,7 @@ int StartSkypeRuntime() } CloseHandle(snapshot); - mir_sntprintf(param, SIZEOF(param), L"-p -m -f nodb -p %d", port); + mir_sntprintf(param, SIZEOF(param), L"-p -P %d", port); int startingrt = CreateProcess(szFilename, param, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &cif, &pi); return startingrt; diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index a5854ab9ff..eede0e216e 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -2,36 +2,32 @@ void CSkypeProto::UpdateOwnAvatar() { - /*uint newTS = 0; + uint newTS = 0; this->account->GetPropAvatarTimestamp(newTS); DWORD oldTS = this->GetSettingDword("AvatarTS"); - if (newTS > oldTS) + wchar_t *path = this->GetContactAvatarFilePath(NULL); + SEBinary data; + this->account->GetPropAvatarImage(data); + if ((newTS > oldTS) || (!newTS && data.size() > 0 && _waccess(path, 0) == -1) || (newTS && _waccess(path, 0) == -1)) //hack for avatars without timestamp { - SEBinary data; - this->account->GetPropAvatarImage(data); - - if (data.size() > 0) + FILE* fp = _wfopen(path, L"wb"); + if (fp) { - wchar_t *path = this->GetContactAvatarFilePath(NULL); - 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("AvatarTS", newTS); + this->SetSettingDword("AvatarTS", newTS); - PROTO_AVATAR_INFORMATIONW pai = {0}; - pai.cbSize = sizeof(pai); - pai.format = PA_FORMAT_JPEG; - pai.hContact = NULL; - wcscpy(pai.filename, path); + PROTO_AVATAR_INFORMATIONW pai = {0}; + pai.cbSize = sizeof(pai); + pai.format = PA_FORMAT_JPEG; + pai.hContact = NULL; + wcscpy(pai.filename, path); - this->SendBroadcast(ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); - } - delete path; - } - }*/ + this->SendBroadcast(ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); + } + delete path; + } } void CSkypeProto::UpdateOwnBirthday() diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp index 09aa2f29f2..591a1d862b 100644 --- a/protocols/Skype/src/skype_services.cpp +++ b/protocols/Skype/src/skype_services.cpp @@ -113,6 +113,7 @@ int __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam) this->Log("Failed to copy our avatar to local storage."); return iRet; } + //this->account->SetBinProperty(Account::P_AVATAR_IMAGE, avt); // todo: add avatar loading to skype server -- cgit v1.2.3