diff options
author | George Hazan <ghazan@miranda.im> | 2019-09-26 22:15:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-09-26 22:15:57 +0300 |
commit | 15c49e3fc4cf033fffbf79e9f68a0405d5a95d14 (patch) | |
tree | 3ba342e3e8645156102d3c5f3f9a1b5dafe4c22c /plugins/AVS | |
parent | d095047014348c9e8dd72a72dc59b2abd22bbf9c (diff) |
Clist_IsHidden / Clist_HideContact - two helpers to hide CList/Hidden variable and unify access to it
Diffstat (limited to 'plugins/AVS')
-rw-r--r-- | plugins/AVS/src/options.cpp | 18 | ||||
-rw-r--r-- | plugins/AVS/src/utils.cpp | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 1411ecffb3..93ef446f50 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -496,7 +496,7 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA ShowWindow(hwndDlg, SW_SHOWNORMAL); InvalidateRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), nullptr, FALSE); CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, db_get_b(hContact, "ContactPhoto", "Hidden", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, Clist_IsHidden(hContact) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), 0); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETRANGE, 0, MAKELONG(8, 2)); @@ -525,11 +525,11 @@ INT_PTR CALLBACK DlgProcAvatarOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case IDOK: { - BOOL locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR); - int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0; + bool locked = IsDlgButtonChecked(hwndDlg, IDC_PROTECTAVATAR) != 0; + bool hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) != 0; SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden); - if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0)) - db_set_b(hContact, "ContactPhoto", "Hidden", hidden); + if (hidden != Clist_IsHidden(hContact)) + Clist_HideContact(hContact, hidden); if (!locked && db_get_b(hContact, "ContactPhoto", "NeedUpdate", 0)) QueueAdd(hContact); @@ -750,7 +750,7 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa TranslateDialogDefault(hwndDlg); SendMessage(hwndDlg, DM_SETAVATARNAME, 0, 0); CheckDlgButton(hwndDlg, IDC_PROTECTAVATAR, db_get_b(hContact, "ContactPhoto", "Locked", 0) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, db_get_b(hContact, "ContactPhoto", "Hidden", 0) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_HIDEAVATAR, Clist_IsHidden(hContact) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETBUDDY, (WPARAM)GetDlgItem(hwndDlg, IDC_BKG_NUM_POINTS), 0); SendDlgItemMessage(hwndDlg, IDC_BKG_NUM_POINTS_SPIN, UDM_SETRANGE, 0, MAKELONG(8, 2)); @@ -783,10 +783,10 @@ static INT_PTR CALLBACK DlgProcAvatarUserInfo(HWND hwndDlg, UINT msg, WPARAM wPa case IDC_HIDEAVATAR: { - int hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) ? 1 : 0; + bool hidden = IsDlgButtonChecked(hwndDlg, IDC_HIDEAVATAR) != 0; SetAvatarAttribute(hContact, AVS_HIDEONCLIST, hidden); - if (hidden != db_get_b(hContact, "ContactPhoto", "Hidden", 0)) - db_set_b(hContact, "ContactPhoto", "Hidden", hidden); + if (hidden != Clist_IsHidden(hContact)) + Clist_HideContact(hContact, hidden); } break; diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index cea5beb71e..80b8add728 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -158,7 +158,7 @@ int CreateAvatarInCache(MCONTACT hContact, AVATARCACHEENTRY *ace, const char *sz GetObject(ace->hbmPic, sizeof(bminfo), &bminfo);
ace->dwFlags = AVS_BITMAP_VALID;
- if (hContact != NULL && db_get_b(hContact, "ContactPhoto", "Hidden", 0))
+ if (hContact != NULL && Clist_IsHidden(hContact))
ace->dwFlags |= AVS_HIDEONCLIST;
ace->hContact = hContact;
ace->bmHeight = bminfo.bmHeight;
|