From 3361d33bd5782edb07270518705a41f4cd57697b Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 26 Apr 2013 20:54:36 +0000 Subject: - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4543 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/Skype_10.vcxproj | 1 - protocols/Skype/Skype_10.vcxproj.filters | 3 -- protocols/Skype/src/skype_account.cpp | 10 ++--- protocols/Skype/src/skype_avatars.cpp | 6 +-- protocols/Skype/src/skype_contacts.cpp | 36 +++++++++--------- protocols/Skype/src/skype_dialogs.cpp | 42 ++++++++++----------- protocols/Skype/src/skype_events.cpp | 10 ++--- protocols/Skype/src/skype_menus.cpp | 12 +++--- protocols/Skype/src/skype_profile.cpp | 64 ++++++++++++++++---------------- protocols/Skype/src/skype_proto.cpp | 2 +- protocols/Skype/src/skype_proto.h | 24 ------------ 11 files changed, 91 insertions(+), 119 deletions(-) diff --git a/protocols/Skype/Skype_10.vcxproj b/protocols/Skype/Skype_10.vcxproj index 6f96c50ebc..398ac252ff 100644 --- a/protocols/Skype/Skype_10.vcxproj +++ b/protocols/Skype/Skype_10.vcxproj @@ -226,7 +226,6 @@ - diff --git a/protocols/Skype/Skype_10.vcxproj.filters b/protocols/Skype/Skype_10.vcxproj.filters index c06a89d188..e8d089c327 100644 --- a/protocols/Skype/Skype_10.vcxproj.filters +++ b/protocols/Skype/Skype_10.vcxproj.filters @@ -36,9 +36,6 @@ Source Files - - Source Files - Source Files diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index 44b01e9216..7091dc35ab 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -139,16 +139,16 @@ void CSkypeProto::LogOut() void CSkypeProto::SetAccountSettings() { - int port = this->GetSettingWord("Port", rand() % 10000 + 10000); + int port = ::db_get_w(NULL, this->m_szModuleName, "Port", rand() % 10000 + 10000); g_skype->SetInt(SETUPKEY_PORT, port); - g_skype->SetInt(SETUPKEY_DISABLE_PORT80, (int)!this->GetSettingByte("UseAlternativePorts", 1)); + g_skype->SetInt(SETUPKEY_DISABLE_PORT80, (int)!::db_get_b(NULL, this->m_szModuleName, "UseAlternativePorts", 1)); // Create default group for new contacts DBVARIANT dbv = {0}; - if (!db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0) + if (!::db_get_ts(NULL, m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0) { - CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal); - db_free(&dbv); + ::CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)dbv.ptszVal); + ::db_free(&dbv); } } diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index afb2dac02f..9b2781725e 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -89,7 +89,7 @@ INT_PTR __cdecl CSkypeProto::GetAvatarInfo(WPARAM, LPARAM lParam) { PROTO_AVATAR_INFORMATIONW *pai = (PROTO_AVATAR_INFORMATIONW*)lParam; - if (this->GetSettingWord(pai->hContact, "AvatarTS")) + if (::db_get_dw(pai->hContact, this->m_szModuleName, "AvatarTS", 0)) { return GAIR_NOAVATAR; } @@ -204,13 +204,13 @@ INT_PTR __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam) } uint newTS = this->account->GetUintProp(/* *::P_AVATAR_TIMESTAMP */ 182); - this->SetSettingDword("AvatarTS", newTS); + ::db_set_dw(NULL, this->m_szModuleName, "AvatarTS", newTS); iRet = 0; } else { this->account->SetBinProperty(Account::P_AVATAR_IMAGE, SEBinary()); - this->DeleteSetting("AvatarTS"); + ::db_unset(NULL, this->m_szModuleName, "AvatarTS"); iRet = 0; } diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 221e1f7669..11f36f8c43 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -4,24 +4,24 @@ void CSkypeProto::UpdateContactAuthState(HANDLE hContact, CContact::Ref contact) { uint newTS = 0; contact->GetPropAuthreqTimestamp(newTS); - DWORD oldTS = this->GetSettingDword(hContact, "AuthTS"); + DWORD oldTS = ::db_get_dw(NULL, this->m_szModuleName, "AuthTS", 0); if (newTS > oldTS) { bool result; if (contact->HasAuthorizedMe(result) && !result) { - this->SetSettingByte(hContact, "Auth", !result); + ::db_set_b(hContact, this->m_szModuleName, "Auth", !result); } else { - this->DeleteSetting(hContact, "Auth"); + ::db_unset(hContact, this->m_szModuleName, "Auth"); if (contact->IsMemberOfHardwiredGroup(CContactGroup::ALL_BUDDIES, result) && !result) - this->SetSettingByte(hContact, "Grant", !result); + ::db_set_b(hContact, this->m_szModuleName, "Grant", !result); else - this->DeleteSetting(hContact, "Grant"); + ::db_unset(hContact, this->m_szModuleName, "Grant"); } - this->SetSettingDword(hContact, "AuthTS", newTS); + ::db_set_dw(hContact, this->m_szModuleName, "AuthTS", newTS); } } @@ -29,35 +29,35 @@ void CSkypeProto::UpdateContactStatus(HANDLE hContact, CContact::Ref contact) { CContact::AVAILABILITY availability; contact->GetPropAvailability(availability); - this->SetSettingWord(hContact, SKYPE_SETTINGS_STATUS, this->SkypeToMirandaStatus(availability)); + ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, this->SkypeToMirandaStatus(availability)); if (availability == CContact::SKYPEOUT) { - this->SetSettingWord(hContact, SKYPE_SETTINGS_STATUS, ID_STATUS_OUTTOLUNCH); + ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, ID_STATUS_OUTTOLUNCH); } else { if (availability == CContact::PENDINGAUTH) - this->SetSettingByte(hContact, "Auth", 1); + ::db_set_b(hContact, this->m_szModuleName, "Auth", 1); else - this->DeleteSetting(hContact, "Auth"); + ::db_unset(hContact, this->m_szModuleName, "Auth"); } } void CSkypeProto::UpdateContactOnlineSinceTime(SEObject *obj, HANDLE hContact) { uint newTS = obj->GetUintProp(/* CContact::P_LASTONLINE_TIMESTAMP */35); - DWORD oldTS = this->GetSettingDword(hContact, "OnlineSinceTS"); + DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "OnlineSinceTS", 0); if (newTS > oldTS) - this->SetSettingDword(hContact, "OnlineSinceTS", newTS); + ::db_set_dw(hContact, this->m_szModuleName, "OnlineSinceTS", newTS); } void CSkypeProto::UpdateContactLastEventDate(SEObject *obj, HANDLE hContact) { uint newTS = obj->GetUintProp(/* CContact::P_LASTUSED_TIMESTAMP */39); - DWORD oldTS = this->GetSettingDword(hContact, "LastEventDateTS"); + DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "LastEventDateTS", 0); if (newTS > oldTS) - this->SetSettingDword(hContact, "LastEventDateTS", newTS); + ::db_set_dw(hContact, this->m_szModuleName, "LastEventDateTS", newTS); } void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) @@ -78,7 +78,7 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) { uint newTS = 0; contact->GetPropAuthreqTimestamp(newTS); - DWORD oldTS = this->GetSettingDword(hContact, "AuthTS"); + DWORD oldTS = ::db_get_dw(hContact, this->m_szModuleName, "AuthTS", 0); if (newTS > oldTS) { this->RaiseAuthRequestEvent(newTS, contact); @@ -204,7 +204,7 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact) switch(availability) { case CContact::SKYPEOUT: - this->SetSettingByte(hContact, "IsSkypeOut", 1); + ::db_set_b(hContact, this->m_szModuleName, "IsSkypeOut", 1); break; case CContact::PENDINGAUTH: @@ -336,8 +336,8 @@ void CSkypeProto::SetAllContactStatus(int status) HANDLE hContact = ::db_find_first(); while (hContact) { - if (this->IsProtoContact(hContact) && this->GetSettingByte(hContact, "IsSkypeOut", 0) == 0) - this->SetSettingWord(hContact, SKYPE_SETTINGS_STATUS, status); + if (this->IsProtoContact(hContact) && ::db_get_b(hContact, this->m_szModuleName, "IsSkypeOut", 0) == 0) + ::db_set_w(hContact, this->m_szModuleName, SKYPE_SETTINGS_STATUS, status); hContact = ::db_find_next(hContact); } diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index adb3405f6b..597c21a0ca 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -33,11 +33,11 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR } { int port = rand() % 10000 + 10000; - SetDlgItemInt(hwnd, IDC_PORT, proto->GetSettingWord("Port", port), FALSE); + SetDlgItemInt(hwnd, IDC_PORT, ::db_get_w(NULL, proto->m_szModuleName, "Port", port), FALSE); SendMessage(GetDlgItem(hwnd, IDC_PORT), EM_SETLIMITTEXT, 5, 0); } { - CheckDlgButton(hwnd, IDC_USE_ALT_PORTS, proto->GetSettingByte("UseAlternativePorts", 1)); + CheckDlgButton(hwnd, IDC_USE_ALT_PORTS, ::db_set_b(NULL, proto->m_szModuleName, "UseAlternativePorts", 1)); } if (proto->IsOnline()) { @@ -48,7 +48,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_CHANGE_PWD), TRUE); } - else if (proto->GetSettingWord("Status") > ID_STATUS_OFFLINE) + else if (::db_get_w(NULL, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) > ID_STATUS_OFFLINE) { EnableWindow(GetDlgItem(hwnd, IDC_REGISTER), FALSE); } @@ -69,7 +69,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR { if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; - if (!proto->IsOnline() && proto->GetSettingWord("Status") <= ID_STATUS_OFFLINE) + if (!proto->IsOnline() && ::db_get_w(NULL, proto->m_szModuleName, "Status", ID_STATUS_OFFLINE) <= ID_STATUS_OFFLINE) { wchar_t sid[128]; GetDlgItemText(hwnd, IDC_SL, sid, SIZEOF(sid)); @@ -173,19 +173,19 @@ INT_PTR CALLBACK CSkypeProto::SkypeMainOptionsProc(HWND hwnd, UINT message, WPAR { BOOL error; int port = GetDlgItemInt(hwnd, IDC_PORT, &error, FALSE); - proto->SetSettingWord("Port", port); - proto->SetSettingByte("UseAlternativePorts", (BYTE)IsDlgButtonChecked(hwnd, IDC_USE_ALT_PORTS)); + ::db_set_w(NULL, proto->m_szModuleName, "Port", port); + ::db_set_b(NULL, proto->m_szModuleName, "UseAlternativePorts", (BYTE)IsDlgButtonChecked(hwnd, IDC_USE_ALT_PORTS)); } wchar_t tstr[128]; GetDlgItemText(hwnd, IDC_GROUP, tstr, SIZEOF(tstr)); if (lstrlen(tstr) > 0) { - db_set_ts(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, tstr); - CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)tstr); + ::db_set_ts(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP, tstr); + ::CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)tstr); } else - db_unset(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP); + ::db_unset(NULL, proto->m_szModuleName, SKYPE_SETTINGS_DEF_GROUP); return TRUE; } @@ -392,38 +392,38 @@ INT_PTR CALLBACK CSkypeProto::SkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam if (!szProto) break; - ::SetDlgItemText(hwndDlg, IDC_SID, ppro->GetSettingString(hContact, SKYPE_SETTINGS_LOGIN)); - ::SetDlgItemText(hwndDlg, IDC_STATUSTEXT, ppro->GetSettingString(hContact, "XStatusMsg") ? ppro->GetSettingString(hContact, "XStatusMsg") : TranslateT("")); + ::SetDlgItemText(hwndDlg, IDC_SID, ::db_get_wsa(hContact, ppro->m_szModuleName, SKYPE_SETTINGS_LOGIN)); + ::SetDlgItemText(hwndDlg, IDC_STATUSTEXT, ::db_get_wsa(hContact, ppro->m_szModuleName, "XStatusMsg") ? ::db_get_wsa(hContact, ppro->m_szModuleName, "XStatusMsg") : TranslateT("")); - if (ppro->GetSettingDword(hContact, "OnlineSinceTS")) { + if (::db_get_dw(hContact, ppro->m_szModuleName, "OnlineSinceTS", 0)) { TCHAR date[64]; DBTIMETOSTRINGT tts = {0}; tts.szFormat = _T("d s"); tts.szDest = date; tts.cbDest = sizeof(date); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppro->GetSettingDword(hContact, "OnlineSinceTS"), (LPARAM)&tts); + CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "OnlineSinceTS", 0), (LPARAM)&tts); ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, date); } else ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, TranslateT("")); - if (ppro->GetSettingDword(hContact, "LastEventDateTS")) { + if (::db_get_dw(hContact, ppro->m_szModuleName, "LastEventDateTS", 0)) { TCHAR date[64]; DBTIMETOSTRINGT tts = {0}; tts.szFormat = _T("d s"); tts.szDest = date; tts.cbDest = sizeof(date); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppro->GetSettingDword(hContact, "LastEventDateTS"), (LPARAM)&tts); + ::CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "LastEventDateTS", 0), (LPARAM)&tts); ::SetDlgItemText(hwndDlg, IDC_LASTEVENTDATE, date); } else ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, TranslateT("")); - if (ppro->GetSettingDword(hContact, "ProfileTS")) { + if (::db_get_dw(hContact, ppro->m_szModuleName, "ProfileTS", 0)) { TCHAR date[64]; DBTIMETOSTRINGT tts = {0}; tts.szFormat = _T("d s"); tts.szDest = date; tts.cbDest = sizeof(date); - CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ppro->GetSettingDword(hContact, "ProfileTS"), (LPARAM)&tts); + ::CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)::db_get_dw(hContact, ppro->m_szModuleName, "ProfileTS", 0), (LPARAM)&tts); ::SetDlgItemText(hwndDlg, IDC_LASTPROFILECHANGE, date); } else ::SetDlgItemText(hwndDlg, IDC_ONLINESINCE, TranslateT("")); @@ -491,12 +491,12 @@ INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa wchar_t *text = L""; switch(setting[lvi.iItem].dbType) { case DBVT_WCHAR: - text = ppro->GetSettingString(setting[lvi.iItem].szDbSetting); + text = ::db_get_wsa(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting); break; case DBVT_BYTE: { if (!strcmp(setting[lvi.iItem].szDbSetting, "Gender")) { - switch(ppro->GetSettingByte(setting[lvi.iItem].szDbSetting)) { + switch(::db_get_b(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 'M')) { case 'M': text = L"Male"; break; @@ -510,7 +510,7 @@ INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa text = mir_tstrdup(TzDescr); } else { wchar_t tmp[10]; - _ltot(ppro->GetSettingByte(setting[lvi.iItem].szDbSetting), tmp, 10); + _ltot(::db_get_b(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 0), tmp, 10); text = mir_tstrdup(tmp); } break; @@ -518,7 +518,7 @@ INT_PTR CALLBACK CSkypeProto::OwnSkypeDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa case DBVT_WORD: { wchar_t tmp[10]; - _ltot(ppro->GetSettingWord(setting[lvi.iItem].szDbSetting), tmp, 10); + _ltot(::db_get_w(NULL, ppro->m_szModuleName, setting[lvi.iItem].szDbSetting, 0), tmp, 10); text = mir_tstrdup(tmp); //text = (wchar_t*)ppro->GetSettingWord(setting[lvi.iItem].szDbSetting); break; diff --git a/protocols/Skype/src/skype_events.cpp b/protocols/Skype/src/skype_events.cpp index d7b120e074..7a79b782a5 100644 --- a/protocols/Skype/src/skype_events.cpp +++ b/protocols/Skype/src/skype_events.cpp @@ -101,11 +101,11 @@ void CSkypeProto::OnMessageSended(CConversation::Ref &conversation, CMessage::Re SEBinary guid; message->GetPropGuid(guid); - //this->RaiseMessageSendedEvent( - //hContact, - //timestamp, - //guid.data(), - //text); + this->RaiseMessageSendedEvent( + hContact, + timestamp, + guid.data(), + text); } } else diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp index 9fcff09721..48efbfe558 100644 --- a/protocols/Skype/src/skype_menus.cpp +++ b/protocols/Skype/src/skype_menus.cpp @@ -31,12 +31,12 @@ int CSkypeProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) if (hContact == NULL) return 0; - if (this->IsOnline() && !this->GetSettingByte(hContact, "ChatRoom")) + if (this->IsOnline() && !::db_get_b(hContact, this->m_szModuleName, "ChatRoom", 0)) { bool ctrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0; - bool authNeed = this->GetSettingByte(hContact, "Auth") > 0; - bool grantNeed = this->GetSettingByte(hContact, "Grant") > 0; + bool authNeed = ::db_get_b(hContact, this->m_szModuleName, "Auth", 0) > 0; + bool grantNeed = ::db_get_b(hContact, this->m_szModuleName, "Grant", 0) > 0; sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_REQUEST], ctrlPressed || authNeed); sttEnableMenuItem( g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || grantNeed); @@ -81,8 +81,8 @@ int CSkypeProto::GrantAuth(WPARAM wParam, LPARAM lParam) { if (contact->SetBuddyStatus(true)) { - this->DeleteSetting(hContact, "Auth"); - this->DeleteSetting(hContact, "Grant"); + ::db_unset(hContact, this->m_szModuleName, "Auth"); + ::db_unset(hContact, this->m_szModuleName, "Grant"); } } @@ -98,7 +98,7 @@ int CSkypeProto::RevokeAuth(WPARAM wParam, LPARAM lParam) { if (contact->SetBuddyStatus(false)) { - this->SetSettingByte(hContact, "Grant", 1); + ::db_set_b(hContact, this->m_szModuleName, "Grant", 1); } this->contactList.remove_val(contact); } diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index 65eea35410..4d7af22d45 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -46,7 +46,7 @@ void CSkypeProto::UpdateProfileAvatar(SEObject *obj, HANDLE hContact) ::fwrite(data.data(), sizeof(char), data.size(), fp); ::fclose(fp); - this->SetSettingDword("AvatarTS", newTS); + ::db_set_dw(NULL, this->m_szModuleName, "AvatarTS", newTS); if (hContact) { @@ -82,7 +82,7 @@ void CSkypeProto::UpdateProfileAboutText(SEObject *obj, HANDLE hContact) { wchar_t* aboutText = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_ABOUT */ 18)); if ( !::wcslen(aboutText)) - this->DeleteSetting(hContact, "About"); + ::db_unset(hContact, this->m_szModuleName, "About"); else ::db_set_ws(hContact, this->m_szModuleName, "About", aboutText); ::mir_free(aboutText); @@ -99,9 +99,9 @@ void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) INT day, month, year; _stscanf(date, _T("%04d%02d%02d"), &year, &month, &day); - this->SetSettingByte(hContact, "BirthDay", day); - this->SetSettingByte(hContact, "BirthMonth", month); - this->SetSettingWord(hContact, "BirthYear", year); + ::db_set_b(hContact, this->m_szModuleName, "BirthDay", day); + ::db_set_b(hContact, this->m_szModuleName, "BirthMonth", month); + ::db_set_w(hContact, this->m_szModuleName, "BirthYear", year); SYSTEMTIME sToday = {0}; GetLocalTime(&sToday); @@ -109,14 +109,14 @@ void CSkypeProto::UpdateProfileBirthday(SEObject *obj, HANDLE hContact) if (sToday.wMonth < month || (sToday.wMonth == month && sToday.wDay < day)) nAge--; if (nAge) - this->SetSettingWord( hContact, "Age", ( WORD )nAge ); + ::db_set_w(hContact, this->m_szModuleName, "Age", ( WORD )nAge ); } else { - this->DeleteSetting(hContact, "BirthDay"); - this->DeleteSetting(hContact, "BirthMonth"); - this->DeleteSetting(hContact, "BirthYear"); - this->DeleteSetting(hContact, "Age"); + ::db_unset(hContact, this->m_szModuleName, "BirthDay"); + ::db_unset(hContact, this->m_szModuleName, "BirthMonth"); + ::db_unset(hContact, this->m_szModuleName, "BirthYear"); + ::db_unset(hContact, this->m_szModuleName, "Age"); } } @@ -124,7 +124,7 @@ void CSkypeProto::UpdateProfileCity(SEObject *obj, HANDLE hContact) { wchar_t* city = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_CITY */ 12)); if ( !::wcslen(city)) - this->DeleteSetting(hContact, "City"); + ::db_unset(hContact, this->m_szModuleName, "City"); else ::db_set_ws(hContact, this->m_szModuleName, "City", city); ::mir_free(city); @@ -152,20 +152,20 @@ void CSkypeProto::UpdateProfileEmails(SEObject *obj, HANDLE hContact) wchar_t* emails = ::mir_a2u(obj->GetStrProp(/* *::P_EMAILS */ 16)); if (wcscmp(emails, L"") == 0) { - this->DeleteSetting(hContact, "e-mail0"); - this->DeleteSetting(hContact, "e-mail1"); - this->DeleteSetting(hContact, "e-mail2"); + ::db_unset(hContact, this->m_szModuleName, "e-mail0"); + ::db_unset(hContact, this->m_szModuleName, "e-mail1"); + ::db_unset(hContact, this->m_szModuleName, "e-mail2"); } else { wchar_t* p = wcstok(emails, L" "); if (p == NULL) { - this->SetSettingString(hContact, "e-mail0", emails); + ::db_set_ws(hContact, this->m_szModuleName, "e-mail0", emails); } else { - this->SetSettingString(hContact, "e-mail0", p); + ::db_set_ws(hContact, this->m_szModuleName, "e-mail0", p); p = wcstok(NULL, L" "); if (p) ::db_set_ws(hContact, this->m_szModuleName, "e-mail1", p); p = wcstok(NULL, L" "); @@ -181,8 +181,8 @@ void CSkypeProto::UpdateProfileFullName(SEObject *obj, HANDLE hContact) wchar_t *fullname = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_FULLNAME */ 5)); if ( !::wcslen(fullname)) { - this->DeleteSetting(hContact, "FirstName"); - this->DeleteSetting(hContact, "LastName"); + ::db_unset(hContact, this->m_szModuleName, "FirstName"); + ::db_unset(hContact, this->m_szModuleName, "LastName"); } else { @@ -202,16 +202,16 @@ void CSkypeProto::UpdateProfileGender(SEObject *obj, HANDLE hContact) { uint data = obj->GetUintProp(/* *::P_GENDER */ 8); if (data) - this->SetSettingByte(hContact, "Gender", (BYTE)(data == 1 ? 'M' : 'F')); + ::db_set_b(hContact, this->m_szModuleName, "Gender", (BYTE)(data == 1 ? 'M' : 'F')); else - this->DeleteSetting(hContact, "Gender"); + ::db_unset(hContact, this->m_szModuleName, "Gender"); } void CSkypeProto::UpdateProfileHomepage(SEObject *obj, HANDLE hContact) { wchar_t* homepage = ::mir_a2u(obj->GetStrProp(/* *::P_HOMEPAGE */ 17)); if (::wcscmp(homepage, L"") == 0) - this->DeleteSetting(hContact, "Homepage"); + ::db_unset(hContact, this->m_szModuleName, "Homepage"); else ::db_set_ws(hContact, this->m_szModuleName, "Homepage", homepage); ::mir_free(homepage); @@ -222,9 +222,9 @@ void CSkypeProto::UpdateProfileLanguages(SEObject *obj, HANDLE hContact) wchar_t *isocodes = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_LANGUAGES */ 9)); if ( !::wcslen(isocodes)) { - this->DeleteSetting(hContact, "Language1"); - this->DeleteSetting(hContact, "Language2"); - this->DeleteSetting(hContact, "Language3"); + ::db_unset(hContact, this->m_szModuleName, "Language1"); + ::db_unset(hContact, this->m_szModuleName, "Language2"); + ::db_unset(hContact, this->m_szModuleName, "Language3"); } else { @@ -257,7 +257,7 @@ void CSkypeProto::UpdateProfileMobilePhone(SEObject *obj, HANDLE hContact) { wchar_t* phone = ::mir_a2u(obj->GetStrProp(/* *::P_PHONE_MOBILE */ 15)); if ( !::wcslen(phone)) - this->DeleteSetting(hContact, "Cellular"); + ::db_unset(hContact, this->m_szModuleName, "Cellular"); else ::db_set_ws(hContact, this->m_szModuleName, "Cellular", phone); ::mir_free(phone); @@ -275,7 +275,7 @@ void CSkypeProto::UpdateProfilePhone(SEObject *obj, HANDLE hContact) { wchar_t* phone = ::mir_a2u(obj->GetStrProp(/* *::P_PHONE_HOME */ 13)); if ( !::wcslen(phone)) - this->DeleteSetting(hContact, "Phone"); + ::db_unset(hContact, this->m_szModuleName, "Phone"); else ::db_set_ws(hContact, this->m_szModuleName, "Phone", phone); ::mir_free(phone); @@ -285,7 +285,7 @@ void CSkypeProto::UpdateProfileOfficePhone(SEObject *obj, HANDLE hContact) { wchar_t* phone = ::mir_a2u(obj->GetStrProp(/* *::P_PHONE_OFFICE */ 14)); if ( !::wcslen(phone)) - this->DeleteSetting(hContact, "CompanyPhone"); + ::db_unset(hContact, this->m_szModuleName, "CompanyPhone"); else ::db_set_ws(hContact, this->m_szModuleName, "CompanyPhone", phone); ::mir_free(phone); @@ -295,7 +295,7 @@ void CSkypeProto::UpdateProfileState(SEObject *obj, HANDLE hContact) { wchar_t* state = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_PROVINCE */ 11)); if ( !::wcslen(state)) - this->DeleteSetting(hContact, "State"); + ::db_unset(hContact, this->m_szModuleName, "State"); else ::db_set_ws(hContact, this->m_szModuleName, "State", state); ::mir_free(state); @@ -305,7 +305,7 @@ void CSkypeProto::UpdateProfileStatusMessage(SEObject *obj, HANDLE hContact) { wchar_t* statusMessage = ::mir_utf8decodeW(obj->GetStrProp(/* *::P_MOOD_TEXT */ 26)); if ( !::wcslen(statusMessage)) - this->DeleteSetting(hContact, "XStatusMsg"); + ::db_unset(hContact, this->m_szModuleName, "XStatusMsg"); else ::db_set_ws(hContact, this->m_szModuleName, "XStatusMsg", statusMessage); ::mir_free(statusMessage); @@ -335,10 +335,10 @@ void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact) if (::GetTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_DAYLIGHT) nTz -= tzinfo.DaylightBias / 30; - this->SetSettingByte(hContact, "Timezone", (signed char)nTz); + ::db_set_b(hContact, this->m_szModuleName, "Timezone", (signed char)nTz); } else - this->DeleteSetting(hContact, "TimeZone"); + ::db_unset(hContact, this->m_szModuleName, "TimeZone"); } void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) @@ -372,7 +372,7 @@ void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact) ::db_set_ws(hContact, this->m_szModuleName, "MirVer", L"Skype"); } - this->SetSettingDword("ProfileTS", newTS); + ::db_set_dw(NULL, this->m_szModuleName, "ProfileTS", newTS); } } diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 52f976e934..2412bc5fd0 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -120,7 +120,7 @@ int __cdecl CSkypeProto::AuthRequest(HANDLE hContact, const TCHAR* szMessage) if (this->IsOnline() && hContact) { CContact::Ref contact; - SEString sid(::mir_u2a(this->GetSettingString(hContact, SKYPE_SETTINGS_LOGIN))); + SEString sid(::mir_u2a(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_LOGIN))); if (g_skype->GetContact(sid, contact)) { contact->SetBuddyStatus(Contact::AUTHORIZED_BY_ME); diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index c58e0fe581..ec8967734a 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -488,30 +488,6 @@ protected: DWORD timestamp, CContact::Ref contact); - // database settings - BYTE GetSettingByte(const char *setting, BYTE errorValue = 0); - BYTE GetSettingByte(HANDLE hContact, const char *setting, BYTE errorValue = 0); - WORD GetSettingWord(const char *setting, WORD errorValue = 0); - WORD GetSettingWord(HANDLE hContact, const char *setting, WORD errorValue = 0); - DWORD GetSettingDword(const char *setting, DWORD defVal = 0); - DWORD GetSettingDword(HANDLE hContact, const char *setting, DWORD errorValue = 0); - wchar_t *GetSettingString(const char *setting, wchar_t* errorValue = NULL); - wchar_t *GetSettingString(HANDLE hContact, const char *setting, wchar_t* errorValue = NULL); - char *GetDecodeSettingString(HANDLE hContact, const char *setting, char* errorValue = NULL); - // - bool SetSettingByte(const char *setting, BYTE value); - bool SetSettingByte(HANDLE hContact, const char *setting, BYTE value); - bool SetSettingWord(const char *setting, WORD value); - bool SetSettingWord(HANDLE hContact, const char *setting, WORD value); - bool SetSettingDword(const char *setting, DWORD value); - bool SetSettingDword(HANDLE hContact, const char *setting, DWORD value); - bool SetSettingString(const char *setting, const wchar_t* value); - bool SetSettingString(HANDLE hContact, const char *setting, const wchar_t* value); - bool SetDecodeSettingString(HANDLE hContact, const char *setting, const char* value); - // - void DeleteSetting(const char *setting); - void DeleteSetting(HANDLE hContact, const char *setting); - // dialog procs static INT_PTR CALLBACK SkypeMainOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); static INT_PTR CALLBACK SkypePasswordRequestProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -- cgit v1.2.3