From 15c49e3fc4cf033fffbf79e9f68a0405d5a95d14 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 26 Sep 2019 22:15:57 +0300 Subject: Clist_IsHidden / Clist_HideContact - two helpers to hide CList/Hidden variable and unify access to it --- plugins/MenuItemEx/src/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'plugins/MenuItemEx') diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 5a1c87ab99..a8c8a6f3c5 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -377,7 +377,7 @@ static INT_PTR onSetVis(WPARAM wparam, LPARAM) static INT_PTR onHide(WPARAM wparam, LPARAM) { MCONTACT hContact = (MCONTACT)wparam; - db_set_b(hContact, "CList", "Hidden", (BYTE)!db_get_b(hContact, "CList", "Hidden", 0)); + Clist_HideContact(hContact, !Clist_IsHidden(hContact)); return 0; } @@ -643,7 +643,7 @@ static int isIgnored(MCONTACT hContact, int type) static INT_PTR onIgnore(WPARAM wparam, LPARAM lparam) { if (g_plugin.getByte("ignorehide", 0) && (lparam == IGNOREEVENT_ALL)) - db_set_b((MCONTACT)wparam, "CList", "Hidden", (isIgnored((MCONTACT)wparam, lparam) ? (byte)0 : (byte)1)); + Clist_HideContact(wparam, !isIgnored((MCONTACT)wparam, lparam)); CallService(isIgnored((MCONTACT)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam); return 0; @@ -693,8 +693,7 @@ static int BuildMenu(WPARAM wparam, LPARAM) bEnabled = bShowAll || (flags & VF_HFL); Menu_ShowItem(hmenuHide, bEnabled); if (bEnabled) { - BYTE bHidden = db_get_b(hContact, "CList", "Hidden", 0); - if (bHidden) + if (Clist_IsHidden(hContact)) Menu_ModifyItem(hmenuHide, LPGENW("Show in list"), IcoLib_GetIconHandle("miex_showil")); else Menu_ModifyItem(hmenuHide, LPGENW("Hide from list"), IcoLib_GetIconHandle("miex_hidefl")); -- cgit v1.2.3