summaryrefslogtreecommitdiff
path: root/protocols
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
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')
-rw-r--r--protocols/Skype/docs/todo_list.txt1
-rw-r--r--protocols/Skype/src/skype_contacts.cpp36
-rw-r--r--protocols/Skype/src/skype_proto.cpp4
-rw-r--r--protocols/Skype/src/skype_subclassing.cpp1
-rw-r--r--protocols/Skype/src/skype_utils.cpp6
5 files changed, 20 insertions, 28 deletions
diff --git a/protocols/Skype/docs/todo_list.txt b/protocols/Skype/docs/todo_list.txt
index 29184498e2..88281a48b4 100644
--- a/protocols/Skype/docs/todo_list.txt
+++ b/protocols/Skype/docs/todo_list.txt
@@ -1,5 +1,4 @@
Bugs:
-- avatar loading
Features:
- own info(profile)
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);
+ }
}
}
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index 6ed5366ccc..e818938247 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -19,8 +19,6 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName)
this->SetAllContactStatus(ID_STATUS_OFFLINE);
this->InitNetLib();
-
- this->CreateService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit);
}
CSkypeProto::~CSkypeProto()
@@ -42,7 +40,7 @@ HANDLE __cdecl CSkypeProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
//if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
return 0;
- //return this->AddContactBySkypeName(psr->id, psr->nick, flags);
+ return this->AddContactBySid(psr->id, psr->nick, flags);
}
HANDLE __cdecl CSkypeProto::AddToListByEvent(int flags, int iContact, HANDLE hDbEvent)
diff --git a/protocols/Skype/src/skype_subclassing.cpp b/protocols/Skype/src/skype_subclassing.cpp
index 7f1bfc73a0..8014241905 100644
--- a/protocols/Skype/src/skype_subclassing.cpp
+++ b/protocols/Skype/src/skype_subclassing.cpp
@@ -80,6 +80,7 @@ void CAccount::OnChange(int prop)
// todo: rewrite!!
strcpy(this->logoutReasonString, (const char*)tostring(whyLogout));
}
+ this->isLoggedIn = false;
this->isLoggedOut = true;
}
}
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index c712d10e2e..15f421cb2d 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -59,12 +59,12 @@ wchar_t* CSkypeProto::GetAvatarFilePath(wchar_t* skypeName)
else
wcscat(path, L"\\");
- wcscat(path, skypeName);
- wcscat(path, L".jpg");
-
// make sure the avatar cache directory exists
::CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
+ wcscat(path, skypeName);
+ wcscat(path, L".jpg");
+
return path;
}