summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-10-21 18:07:57 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-10-21 18:07:57 +0000
commit551d0592a2632d64b17bba22880b31cad14566da (patch)
tree03fe720b0a4c4ba3130b9a8813f8a98e66e97064 /protocols/Skype/src/skype_contacts.cpp
parent75adc4e354b69e2daaa85896e23ef0f987e7e57a (diff)
- fixed contacts avatar loading
- fixed account logout git-svn-id: http://svn.miranda-ng.org/main/trunk@2035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_contacts.cpp')
-rw-r--r--protocols/Skype/src/skype_contacts.cpp36
1 files changed, 15 insertions, 21 deletions
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);
+ }
}
}