summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_own_info.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2013-05-10 15:07:47 +0000
committerAlexander Lantsev <aunsane@gmail.com>2013-05-10 15:07:47 +0000
commit32cc6d62a154d5724c40085f22747df2ee2ff4cb (patch)
treef47241b283331f42b0955de792493e8139925a73 /protocols/Skype/src/skype_own_info.cpp
parent763272b5a51b73eedb013c209ad256f85afc8fd2 (diff)
- fixed several issues in own details saving
- fixed issues with contacts look cycle in db - fixed freez offline status after login error - other few bugs git-svn-id: http://svn.miranda-ng.org/main/trunk@4621 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype_own_info.cpp')
-rw-r--r--protocols/Skype/src/skype_own_info.cpp38
1 files changed, 24 insertions, 14 deletions
diff --git a/protocols/Skype/src/skype_own_info.cpp b/protocols/Skype/src/skype_own_info.cpp
index 4a3b5415fc..cc5fb4c123 100644
--- a/protocols/Skype/src/skype_own_info.cpp
+++ b/protocols/Skype/src/skype_own_info.cpp
@@ -3,7 +3,7 @@
void __cdecl CSkypeProto::LoadOwnInfo(void *)
{
mir_ptr<wchar_t> nick( ::db_get_wsa(NULL, this->m_szModuleName, "Nick"));
- if (nick == NULL)
+ if ( !nick)
{
SEString data;
this->account->GetPropFullname(data);
@@ -11,7 +11,7 @@ void __cdecl CSkypeProto::LoadOwnInfo(void *)
nick = ::mir_utf8decodeW(data);
::db_set_ws(NULL, this->m_szModuleName, "Nick", nick);
}
- //this->UpdateProfileAvatar(this->account.fetch());
+
this->UpdateProfile(this->account.fetch());
}
@@ -25,7 +25,8 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
case 0:
{
::GetDlgItemText(hwndPage, IDC_FULLNAME, text, SIZEOF(text));
- this->account->SetStrProperty(Account::P_FULLNAME, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ if (this->account->SetStrProperty(Account::P_FULLNAME, (char*)mir_ptr<char>(::mir_utf8encodeW(text))))
+ ::db_set_ws(NULL, this->m_szModuleName, "Nick", text);
::GetDlgItemText(hwndPage, IDC_MOOD, text, SIZEOF(text));
this->account->SetStrProperty(Account::P_MOOD_TEXT, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
@@ -49,12 +50,10 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
this->account->SetIntProperty(Account::P_BIRTHDAY, value);
int lang = ::SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETCURSEL, 0, 0);
- if (lang != -1) {
- std::wstring key = *(std::wstring *)SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETITEMDATA, lang, 0);
- this->account->SetStrProperty(
- Account::P_LANGUAGES,
- (char*)mir_ptr<char>(::mir_utf8encodeW(CSkypeProto::languages[key].c_str())));
- }
+ std::wstring key = *(std::wstring *)SendMessage(GetDlgItem(hwndPage, IDC_LANGUAGE), CB_GETITEMDATA, lang, 0);
+ this->account->SetStrProperty(
+ Account::P_LANGUAGES,
+ (char*)mir_ptr<char>(::mir_utf8encodeW(key.c_str())));
}
break;
@@ -74,7 +73,7 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
::wcscat(emails, L" ");
::wcscat(emails, text);
}
- this->account->SetStrProperty(Account::P_EMAILS, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
+ this->account->SetStrProperty(Account::P_EMAILS, (char*)mir_ptr<char>(::mir_utf8encodeW(emails)));
::GetDlgItemText(hwndPage, IDC_MOBPHONE, text, SIZEOF(text));
this->account->SetStrProperty(Account::P_PHONE_MOBILE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
@@ -95,10 +94,21 @@ void CSkypeProto::SaveOwnInfoToServer(HWND hwndPage, int iPage)
::GetDlgItemText(hwndPage, IDC_STATE, text, SIZEOF(text));
this->account->SetStrProperty(Account::P_PROVINCE, (char*)mir_ptr<char>(::mir_utf8encodeW(text)));
- int i = ::SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
- int id = ::SendMessage(GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETITEMDATA, i, 0);
- char *countrystr = (char *)::CallService(MS_UTILS_GETCOUNTRYBYNUMBER, (WPARAM)id, 0);
- this->account->SetStrProperty(Account::P_COUNTRY, countrystr);
+ int i = ::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETCURSEL, 0, 0);
+ char *iso = (char *)::SendMessage(::GetDlgItem(hwndPage, IDC_COUNTRY), CB_GETITEMDATA, i, 0);
+ this->account->SetStrProperty(Account::P_COUNTRY, iso);
+
+ HWND ctrl = ::GetDlgItem(hwndPage, IDC_TIMEZONE);
+ i = ::SendMessage(ctrl, CB_GETCURSEL, 0, 0);
+ HANDLE hTimeZone = (HANDLE)::SendMessage(ctrl, CB_GETITEMDATA, i, 0);
+
+ SYSTEMTIME my_st, utc_ts;
+ tmi.getTimeZoneTime(hTimeZone, &my_st);
+ tmi.getTimeZoneTime(UTC_TIME_HANDLE, &utc_ts);
+
+ uint diff_to_UTC_in_seconds = (my_st.wHour - utc_ts.wHour) * 3600 + (my_st.wMinute - utc_ts.wMinute) * 60;
+ uint timezone = 24*3600 + diff_to_UTC_in_seconds;
+ this->account->SetIntProperty(Account::P_TIMEZONE, timezone);
break;
}