From 551d0592a2632d64b17bba22880b31cad14566da Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 21 Oct 2012 18:07:57 +0000 Subject: - fixed contacts avatar loading - fixed account logout git-svn-id: http://svn.miranda-ng.org/main/trunk@2035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_contacts.cpp | 36 ++++++++++++++-------------------- 1 file changed, 15 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 5b64c6b5fe..72f9e9b8a4 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -44,31 +44,25 @@ void CSkypeProto::UpdateContactAvatar(HANDLE hContact, CContact::Ref contact) if (data.size() > 0) { - wchar_t* path = this->GetAvatarFilePath(this->GetSettingString(hContact, "sid")); - FILE* fp = _wfopen(path, L"w"); + wchar_t *path = this->GetAvatarFilePath(this->GetSettingString(hContact, "sid")); + FILE* fp = _wfopen(path, L"wb"); if (fp) { - for (uint i = 0; i < data.size(); i++) - { - if (i) - fputc(',', fp); - fputc('\'', fp); - switch(data[i]) - { - case '\n': - fputc('\\', fp); - fputc('n', fp); - break; + fwrite(data.data(), sizeof(char), data.size(), fp); + fclose(fp); - default: - fputc(data[i], fp); - } - } - CloseHandle(fp); + 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); + + this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); } - } - // todo: need to register avatar to contact - this->SetSettingDword(hContact, "AvatarTS", newTS); + ::mir_free(path); + } } } -- cgit v1.2.3