summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-06-01 16:39:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-06-01 16:39:34 +0000
commite983f96899f1103c4df3b47c5610e3dd1d81e6e0 (patch)
treec0a485c0b1bbc8bc329fb2bbc52a7228065302ad
parent3dbaef0eac24e4e50b6b8f7f26be00600e75b4f1 (diff)
extended visibility control for contacts
git-svn-id: http://svn.miranda-ng.org/main/trunk@16899 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_clistint.h2
-rw-r--r--plugins/Clist_modern/src/init.cpp3
-rw-r--r--plugins/Clist_modern/src/modern_clc.h1
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp11
-rw-r--r--src/mir_app/src/clcitems.cpp6
-rw-r--r--src/mir_app/src/clistcore.cpp6
6 files changed, 25 insertions, 4 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index 918c4830bf..1ff9fc07b2 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -291,7 +291,7 @@ struct CLIST_INTERFACE
int (*pfnFindItem)(HWND hwnd, struct ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGroup **subgroup, int *isVisible);
int (*pfnGetRowByIndex)(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
int (*pfnGetContactHiddenStatus)(MCONTACT hContact, char *szProto, ClcData *dat);
- HANDLE(*unused2)(ClcContact *contact, DWORD *nmFlags);
+ int (*pfnIsVisibleContact)(ClcCacheEntry *pce, ClcGroup *group);
/* clcitems.c */
ClcContact* (*pfnCreateClcContact)(void);
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp
index 182a0129b2..72b297c2bc 100644
--- a/plugins/Clist_modern/src/init.cpp
+++ b/plugins/Clist_modern/src/init.cpp
@@ -157,6 +157,7 @@ static HRESULT SubclassClistInterface()
pcli->pfnOnCreateClc = CLUI::cliOnCreateClc;
pcli->pfnPaintClc = CLCPaint::cliPaintClc;
pcli->pfnRebuildEntireList = cliRebuildEntireList;
+ pcli->pfnIsVisibleContact = cliIsVisibleContact;
pcli->pfnRecalcScrollBar = cliRecalcScrollBar;
pcli->pfnRowHitTest = cliRowHitTest;
pcli->pfnScrollTo = cliScrollTo;
@@ -171,7 +172,7 @@ static HRESULT SubclassClistInterface()
pcli->pfnFindRowByText = cliFindRowByText;
pcli->pfnGetContactHiddenStatus = CLVM_GetContactHiddenStatus;
- //partialy overloaded - call default handlers from inside
+ // partialy overloaded - call default handlers from inside
pcli->pfnGetContactIcon = cli_GetContactIcon;
pcli->pfnIconFromStatusMode = cli_IconFromStatusMode;
pcli->pfnLoadCluiGlobalOpts = CLUI_cli_LoadCluiGlobalOpts;
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h
index 03e05d44b6..a895e46231 100644
--- a/plugins/Clist_modern/src/modern_clc.h
+++ b/plugins/Clist_modern/src/modern_clc.h
@@ -346,6 +346,7 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGrou
// clcitems.c
ClcContact* cli_AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact);
+int cliIsVisibleContact(ClcCacheEntry *pce, ClcGroup *group);
void cliRebuildEntireList(HWND hwnd, ClcData *dat);
void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline);
void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort);
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index 9340e05877..889effd163 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -228,6 +228,17 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected)
return dat->selection;
}
+int cliIsVisibleContact(ClcCacheEntry *pce, ClcGroup *group)
+{
+ if (pce->m_bNoHiddenOffline)
+ return true;
+
+ if (CLCItems_IsShowOfflineGroup(group))
+ return true;
+
+ return false;
+}
+
void cliRebuildEntireList(HWND hwnd, ClcData *dat)
{
KillTimer(hwnd, TIMERID_REBUILDAFTER);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index 6c15e45a43..407346a86a 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -362,6 +362,8 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, NULL, dat);
if (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus) {
+ ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact);
+
ClcGroup *group;
ptrT tszGroupName(db_get_tsa(hContact, "CList", "Group"));
if (tszGroupName == NULL)
@@ -386,10 +388,10 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
char *szProto = GetContactProto(hContact);
if (szProto == NULL) {
- if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
+ if (!cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE) || cli.pfnIsVisibleContact(pce, group))
cli.pfnAddContactToGroup(dat, group, hContact);
}
- else if (!cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)))
+ else if (!cli.pfnIsHiddenMode(dat, db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE)) || cli.pfnIsVisibleContact(pce, group))
cli.pfnAddContactToGroup(dat, group, hContact);
}
else cli.pfnAddContactToGroup(dat, group, hContact);
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp
index f381c3eb95..d34baadf52 100644
--- a/src/mir_app/src/clistcore.cpp
+++ b/src/mir_app/src/clistcore.cpp
@@ -55,6 +55,11 @@ static void fnOnCreateClc(void)
{
}
+static int fnIsVisibleContact(ClcCacheEntry*, ClcGroup*)
+{
+ return false;
+}
+
static void fnReloadProtoMenus(void)
{
RebuildMenuOrder();
@@ -118,6 +123,7 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM)
cli.pfnGetDropTargetInformation = fnGetDropTargetInformation;
cli.pfnClcStatusToPf2 = fnClcStatusToPf2;
cli.pfnIsHiddenMode = fnIsHiddenMode;
+ cli.pfnIsVisibleContact = fnIsVisibleContact;
cli.pfnHideInfoTip = fnHideInfoTip;
cli.pfnNotifyNewContact = fnNotifyNewContact;
cli.pfnGetDefaultExStyle = fnGetDefaultExStyle;