summaryrefslogtreecommitdiff
path: root/protocols/Skype/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r--protocols/Skype/src/skype_contacts.cpp38
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp5
-rw-r--r--protocols/Skype/src/skype_proto.h47
-rw-r--r--protocols/Skype/src/skype_services.cpp4
-rw-r--r--protocols/Skype/src/skype_utils.cpp11
5 files changed, 49 insertions, 56 deletions
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp
index 7669615456..0c809f4dfc 100644
--- a/protocols/Skype/src/skype_contacts.cpp
+++ b/protocols/Skype/src/skype_contacts.cpp
@@ -42,32 +42,28 @@ void CSkypeProto::UpdateContactAvatar(HANDLE hContact, CContact::Ref contact)
uint newTS = 0;
contact->GetPropAvatarTimestamp(newTS);
DWORD oldTS = this->GetSettingDword(hContact, "AvatarTS");
- if (newTS > oldTS)
+ SEBinary data;
+ contact->GetPropAvatarImage(data);
+ if ((newTS > oldTS) || (!newTS && data.size() > 0)) //hack for avatars without timestamp
{
- SEBinary data;
- contact->GetPropAvatarImage(data);
-
- if (data.size() > 0)
+ wchar_t *path = this->GetContactAvatarFilePath(this->GetSettingString(hContact, "sid"));
+ FILE* fp = _wfopen(path, L"wb");
+ if (fp)
{
- wchar_t *path = this->GetContactAvatarFilePath(this->GetSettingString(hContact, "sid"));
- 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(hContact, "AvatarTS", newTS);
+ 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);
+ 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);
- }
- delete path;
- }
+ this->SendBroadcast(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0);
+ }
+ delete path;
}
}
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index 092a17f927..fbb960e392 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -326,11 +326,6 @@ INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
TranslateDialogDefault(hwndDlg);
HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT);
- /*LOGFONT lf;
- GetObject((HFONT)SendMessage(hwndList, WM_GETFONT, 0, 0), sizeof(lf), &lf);
- lf.lfHeight -= 5;
- HFONT hFont = CreateFontIndirect(&lf);
- SendMessage(hwndList, WM_SETFONT, (WPARAM)hFont, 0);*/
// Prepare ListView Columns
LV_COLUMN lvc = {0};
RECT rc;
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 19f8d35657..ca1f70a595 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -28,31 +28,32 @@ struct SettingItem
{
const TCHAR *szDescription;
const char *szDbSetting;
+ int dbType; //DBVT_ constant
};
const SettingItem setting[]={
- {LPGENT("Full name"), "Nick"},
- {LPGENT("Mood"), "XStatusMsg"},
-
- {LPGENT("Mobile phone"), "Cellular"},
- {LPGENT("Home phone"), "Phone"},
- {LPGENT("Office phone"), "CompanyPhone"},
- {LPGENT("E-mail 1"), "e-mail0"},
- {LPGENT("E-mail 2"), "e-mail1"},
- {LPGENT("E-mail 3"), "e-mail2"},
-
- {LPGENT("Country"), "Country"},
- {LPGENT("State"), "State"},
- {LPGENT("City"), "City"},
- {LPGENT("Time zone"), "Timezone"},
- {LPGENT("Homepage"), "Homepage"},
- {LPGENT("Gender"), "Gender"},
- {LPGENT("Birth day"), "BirthDay"},
- {LPGENT("Birth month"), "BirthMonth"},
- {LPGENT("Birth year"), "BirthYear"},
- {LPGENT("Language"), "Language1"},
-
- {LPGENT("About"), "About"}
+ {LPGENT("Full name"), "Nick", DBVT_WCHAR},
+ {LPGENT("Mood"), "XStatusMsg", DBVT_WCHAR},
+
+ {LPGENT("Mobile phone"), "Cellular", DBVT_WCHAR},
+ {LPGENT("Home phone"), "Phone", DBVT_WCHAR},
+ {LPGENT("Office phone"), "CompanyPhone", DBVT_WCHAR},
+ {LPGENT("E-mail 1"), "e-mail0", DBVT_WCHAR},
+ {LPGENT("E-mail 2"), "e-mail1", DBVT_WCHAR},
+ {LPGENT("E-mail 3"), "e-mail2", DBVT_WCHAR},
+
+ {LPGENT("Country"), "Country", DBVT_WCHAR},
+ {LPGENT("State"), "State", DBVT_WCHAR},
+ {LPGENT("City"), "City", DBVT_WCHAR},
+ {LPGENT("Time zone"), "Timezone", DBVT_BYTE},
+ {LPGENT("Homepage"), "Homepage", DBVT_WCHAR},
+ {LPGENT("Gender"), "Gender", DBVT_BYTE},
+ {LPGENT("Birth day"), "BirthDay", DBVT_BYTE},
+ {LPGENT("Birth month"), "BirthMonth", DBVT_BYTE},
+ {LPGENT("Birth year"), "BirthYear", DBVT_WORD},
+ {LPGENT("Language"), "Language1", DBVT_WCHAR},
+
+ {LPGENT("About"), "About", DBVT_WCHAR}
};
struct CSkypeProto : public PROTO_INTERFACE, public MZeroedObject
@@ -236,7 +237,7 @@ protected:
static int DetectAvatarFormatBuffer(const char *pBuffer);
static int DetectAvatarFormat(const wchar_t *path);
- wchar_t* GetContactAvatarFilePath(HANDLE hContact = 0);
+ wchar_t* GetContactAvatarFilePath(wchar_t *sid);
int SkypeToMirandaLoginError(CAccount::LOGOUTREASON logoutReason);
diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp
index c9b140b4d0..c0a9135443 100644
--- a/protocols/Skype/src/skype_services.cpp
+++ b/protocols/Skype/src/skype_services.cpp
@@ -80,7 +80,7 @@ int __cdecl CSkypeProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
if (!wParam) return -2;
- wchar_t *path = this->GetContactAvatarFilePath();
+ wchar_t *path = this->GetContactAvatarFilePath(NULL);
if (path && !_waccess(path, 0))
{
::wcsncpy((wchar_t *)wParam, path, (int)lParam);
@@ -107,7 +107,7 @@ int __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam)
::DeleteObject(avt);
}
- wchar_t *avatarPath = this->GetContactAvatarFilePath();
+ wchar_t *avatarPath = this->GetContactAvatarFilePath(NULL);
if (::wcscmp(path, avatarPath) && !::CopyFile(path, avatarPath, FALSE))
{
this->Log("Failed to copy our avatar to local storage.");
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 5e2573d6f5..2af0a496cf 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -264,7 +264,7 @@ int CSkypeProto::DetectAvatarFormat(const wchar_t *path)
return CSkypeProto::DetectAvatarFormatBuffer(pBuf);
}
-wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
+wchar_t* CSkypeProto::GetContactAvatarFilePath(wchar_t *sid)
{
wchar_t* path = new wchar_t[MAX_PATH * 2];
@@ -299,10 +299,11 @@ wchar_t* CSkypeProto::GetContactAvatarFilePath(HANDLE hContact)
// make sure the avatar cache directory exists
::CallService(MS_UTILS_CREATEDIRTREET, 0, (LPARAM)path);
- wchar_t *sid = this->GetSettingString("sid", ::mir_wstrdup(L""));
- ::wcscat(path, sid);
- ::wcscat(path, L".jpg");
- ::mir_free(sid);
+ if (sid) {
+ ::wcscat(path, sid);
+ ::wcscat(path, L".jpg");
+ } else
+ path = NULL;
return path;
}