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/MirandaG15/src/CAppletManager.cpp | 4 ++-- plugins/MirandaG15/src/CContactList.cpp | 4 ++-- plugins/MirandaG15/src/CEventScreen.cpp | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'plugins/MirandaG15/src') diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 602fec49f4..1942853761 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -1123,7 +1123,7 @@ int CAppletManager::HookChatInbound(WPARAM, LPARAM lParam) Event.hContact = NULL; // Ignore events from hidden chatrooms, except for join events - if (gce->pszID.w != nullptr && db_get_b(Event.hContact, "CList", "Hidden", 0)) { + if (gce->pszID.w != nullptr && Clist_IsHidden(Event.hContact)) { if (gce->iType == GC_EVENT_JOIN && pHistory) pHistory->LUsers.push_back(toTstring(gce->pszNick.w)); @@ -1645,7 +1645,7 @@ int CAppletManager::HookSettingChanged(WPARAM hContact, LPARAM lParam) else if (!strcmp(dbcws->szModule, "CList")) { if (!strcmp(dbcws->szSetting, "Hidden")) { Event.eType = EVENT_CONTACT_HIDDEN; - Event.iValue = db_get_b(hContact, "CList", "Hidden", 0); + Event.iValue = Clist_IsHidden(hContact); } else if (!strcmp(dbcws->szSetting, "Group")) { Event.eType = EVENT_CONTACT_GROUP; diff --git a/plugins/MirandaG15/src/CContactList.cpp b/plugins/MirandaG15/src/CContactList.cpp index c385b7965b..1331ef94e9 100644 --- a/plugins/MirandaG15/src/CContactList.cpp +++ b/plugins/MirandaG15/src/CContactList.cpp @@ -202,12 +202,12 @@ bool CContactList::IsVisible(CContactListEntry *pEntry) return true; if (CConfig::GetBoolSetting(CLIST_USEIGNORE)) { - if (db_get_b(pEntry->hHandle, "CList", "Hidden", 0)) + if (Clist_IsHidden(pEntry->hHandle)) return false; if (db_mc_isSub(pEntry->hHandle)) { MCONTACT hMetaContact = db_mc_getMeta(pEntry->hHandle); - if (db_get_b(hMetaContact, "CList", "Hidden", 0)) + if (Clist_IsHidden(hMetaContact)) return false; } } diff --git a/plugins/MirandaG15/src/CEventScreen.cpp b/plugins/MirandaG15/src/CEventScreen.cpp index 169a2caef9..c307a5715b 100644 --- a/plugins/MirandaG15/src/CEventScreen.cpp +++ b/plugins/MirandaG15/src/CEventScreen.cpp @@ -186,8 +186,7 @@ void CEventScreen::OnLCDButtonDown(int iButton) char *szProto = GetContactProto(pEntry->hContact); CIRCConnection *pIRCCon = CAppletManager::GetInstance()->GetIRCConnection(toTstring(szProto)); - if (pIRCCon && db_get_b(pEntry->hContact, szProto, "ChatRoom", 0) != 0 && - db_get_b(pEntry->hContact, "CList", "Hidden", 0)) + if (pIRCCon && db_get_b(pEntry->hContact, szProto, "ChatRoom", 0) != 0 && Clist_IsHidden(pEntry->hContact)) return; CAppletManager::GetInstance()->ActivateChatScreen(pEntry->hContact); -- cgit v1.2.3