diff options
author | George Hazan <george.hazan@gmail.com> | 2014-06-14 18:31:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-06-14 18:31:24 +0000 |
commit | bec846007b6eb358d5dee8baea6cd870ce88cff2 (patch) | |
tree | 98f5b59d92356fc65a9ccc895ce64e66fc18ffdd /plugins/Clist_modern | |
parent | 6bcddf950c9540f89462706948dad7e28be31583 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@9483 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/hdr/modern_clist.h | 7 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clc.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcitems.cpp | 269 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clcutils.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistsettings.cpp | 30 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clui.cpp | 2 |
7 files changed, 159 insertions, 157 deletions
diff --git a/plugins/Clist_modern/src/hdr/modern_clist.h b/plugins/Clist_modern/src/hdr/modern_clist.h index 65cfaeb76e..064c7c3501 100644 --- a/plugins/Clist_modern/src/hdr/modern_clist.h +++ b/plugins/Clist_modern/src/hdr/modern_clist.h @@ -76,10 +76,10 @@ struct ClcCacheEntry : public ClcCacheEntryBase {
int m_cache_nNoHiddenOffline;
- char* m_cache_cszProto;
- bool m_cache_bProtoNotExists;
int m_cache_nStatus;
- int m_cache_nHiddenSubcontact;
+ char* m_cache_cszProto;
+ bool m_bProtoNotExists, m_bIsSub;
+ bool isUnknown;
int i;
int ApparentMode;
@@ -87,7 +87,6 @@ struct ClcCacheEntry : public ClcCacheEntryBase int IdleTS;
void* ClcContact;
BYTE IsExpanded;
- bool isUnknown;
TCHAR* szSecondLineText;
CSmileyString ssSecondLine;
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index fce65a6422..e8b27596a8 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -685,7 +685,7 @@ static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFun for (int i=0 ; i < group->cl.items[scanIndex]->SubAllocated ; i++)
if (!func(&group->cl.items[scanIndex]->subcontacts[i], TRUE, param))
return FALSE;
- }
+ }
}
else if (group->cl.items[scanIndex]->type == CLCIT_GROUP)
if (!ExecuteOnAllContactsOfGroup(group->cl.items[scanIndex]->group, func, param))
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 5f6e1e415a..75f6000129 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -600,7 +600,6 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP return 0;
default:
- {
NMKEY nmkey;
nmkey.hdr.hwndFrom = hwnd;
nmkey.hdr.idFrom = GetDlgCtrlID(hwnd);
@@ -613,7 +612,6 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP return 0;
}
}
- }
if (changeGroupExpand) {
ClcContact *contact;
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index c07816b578..8de05ac9cd 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
{
ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(cont->hContact);
- cont->SubExpanded = ( db_get_b(cont->hContact,"CList","Expanded",0) && ( db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)));
+ cont->SubExpanded = (db_get_b(cont->hContact, "CList", "Expanded", 0) && (db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT)));
int subcount = db_mc_getSubCount(cont->hContact);
if (subcount <= 0) {
cont->isSubcontact = 0;
@@ -42,15 +42,17 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) cont->isSubcontact = 0;
mir_free(cont->subcontacts);
- cont->subcontacts = (ClcContact *) mir_calloc(sizeof(ClcContact)*subcount);
+ cont->subcontacts = (ClcContact *)mir_calloc(sizeof(ClcContact)*subcount);
cont->SubAllocated = subcount;
- int i=0;
+ int i = 0;
+ int bHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
+ int bMetaHideOfflineSub = db_get_b(NULL, "CLC", "MetaHideOfflineSub", SETTING_METAHIDEOFFLINESUB_DEFAULT);
for (int j = 0; j < subcount; j++) {
MCONTACT hsub = db_mc_getSub(cont->hContact, j);
cacheEntry = pcli->pfnGetCacheEntry(hsub);
WORD wStatus = pdnce___GetStatus(cacheEntry);
- if (showOfflineHereGroup || (!( db_get_b(NULL,"CLC","MetaHideOfflineSub",SETTING_METAHIDEOFFLINESUB_DEFAULT) && db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT))
- || wStatus != ID_STATUS_OFFLINE )) {
+
+ if (showOfflineHereGroup || (!(bMetaHideOfflineSub && bHideOffline) || wStatus != ID_STATUS_OFFLINE)) {
ClcContact& p = cont->subcontacts[i];
p.hContact = cacheEntry->hContact;
@@ -62,23 +64,23 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) p.proto = cacheEntry->m_cache_cszProto;
p.type = CLCIT_CONTACT;
p.flags = 0;//CONTACTF_ONLINE;
- p.isSubcontact = i+1;
+ p.isSubcontact = i + 1;
p.lastPaintCounter = 0;
p.subcontacts = cont;
p.image_is_special = FALSE;
//p.status = cacheEntry->status;
Cache_GetTimezone(dat, (&p)->hContact);
- Cache_GetText(dat, &p,1);
+ Cache_GetText(dat, &p, 1);
char *szProto = cacheEntry->m_cache_cszProto;
- if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,wStatus))
+ if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, wStatus))
p.flags |= CONTACTF_ONLINE;
int apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0;
if (apparentMode == ID_STATUS_OFFLINE) p.flags |= CONTACTF_INVISTO;
else if (apparentMode == ID_STATUS_ONLINE) p.flags |= CONTACTF_VISTO;
- else if (apparentMode) p.flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
+ else if (apparentMode) p.flags |= CONTACTF_VISTO | CONTACTF_INVISTO;
if (cacheEntry->NotOnList) p.flags |= CONTACTF_NOTONLIST;
- int idleMode = szProto != NULL?cacheEntry->IdleTS:0;
+ int idleMode = szProto != NULL ? cacheEntry->IdleTS : 0;
if (idleMode) p.flags |= CONTACTF_IDLE;
i++;
}
@@ -89,20 +91,21 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) mir_free_and_nil(cont->subcontacts);
}
-int cli_AddItemToGroup(ClcGroup *group,int iAboveItem)
+int cli_AddItemToGroup(ClcGroup *group, int iAboveItem)
{
- if ( group == NULL ) return 0;
+ if (group == NULL)
+ return 0;
- iAboveItem = corecli.pfnAddItemToGroup( group, iAboveItem );
+ iAboveItem = corecli.pfnAddItemToGroup(group, iAboveItem);
ClearRowByIndexCache();
return iAboveItem;
}
-ClcGroup *cli_AddGroup(HWND hwnd,ClcData *dat,const TCHAR *szName, DWORD flags,int groupId,int calcTotalMembers)
+ClcGroup *cli_AddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
{
ClearRowByIndexCache();
if (!dat->force_in_dialog && !(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN))
- if (!lstrcmp(_T("-@-HIDDEN-GROUP-@-"),szName)) { //group is hidden
+ if (!lstrcmp(_T("-@-HIDDEN-GROUP-@-"), szName)) { //group is hidden
ClearRowByIndexCache();
return NULL;
}
@@ -114,45 +117,43 @@ ClcGroup *cli_AddGroup(HWND hwnd,ClcData *dat,const TCHAR *szName, DWORD flags,i void cli_FreeContact(ClcContact *p)
{
- if ( p->SubAllocated) {
- if ( p->subcontacts && !p->isSubcontact) {
- for (int i=0 ; i < p->SubAllocated ; i++ ) {
+ if (p->SubAllocated) {
+ if (p->subcontacts && !p->isSubcontact) {
+ for (int i = 0; i < p->SubAllocated; i++) {
p->subcontacts[i].ssText.DestroySmileyList();
- if ( p->subcontacts[i].avatar_pos == AVATAR_POS_ANIMATED )
- AniAva_RemoveAvatar( p->subcontacts[i].hContact );
- p->subcontacts[i].avatar_pos = AVATAR_POS_DONT_HAVE;
+ if (p->subcontacts[i].avatar_pos == AVATAR_POS_ANIMATED)
+ AniAva_RemoveAvatar(p->subcontacts[i].hContact);
+ p->subcontacts[i].avatar_pos = AVATAR_POS_DONT_HAVE;
}
mir_free_and_nil(p->subcontacts);
- } }
+ }
+ }
p->ssText.DestroySmileyList();
- if ( p->avatar_pos == AVATAR_POS_ANIMATED )
- AniAva_RemoveAvatar( p->hContact );
+ if (p->avatar_pos == AVATAR_POS_ANIMATED)
+ AniAva_RemoveAvatar(p->hContact);
p->avatar_pos = AVATAR_POS_DONT_HAVE;
- corecli.pfnFreeContact( p );
+ corecli.pfnFreeContact(p);
}
-void cli_FreeGroup( ClcGroup* group )
+void cli_FreeGroup(ClcGroup* group)
{
- corecli.pfnFreeGroup( group );
+ corecli.pfnFreeGroup(group);
ClearRowByIndexCache();
}
-int cli_AddInfoItemToGroup(ClcGroup *group,int flags,const TCHAR *pszText)
+int cli_AddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
{
- int i = corecli.pfnAddInfoItemToGroup( group, flags, pszText );
+ int i = corecli.pfnAddInfoItemToGroup(group, flags, pszText);
ClearRowByIndexCache();
return i;
}
static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, MCONTACT hContact)
{
- ClcCacheEntry *cacheEntry = NULL;
- WORD apparentMode;
- DWORD idleMode;
- char * szProto;
-
- if (!cont) return;
+ if (!cont)
+ return;
+
cont->type = CLCIT_CONTACT;
cont->SubAllocated = 0;
cont->isSubcontact = 0;
@@ -163,53 +164,50 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat, cont->hContact = hContact;
pcli->pfnInvalidateDisplayNameCacheEntry(hContact);
- cacheEntry = pcli->pfnGetCacheEntry(hContact);
- szProto = cacheEntry->m_cache_cszProto;
+ ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact);
+ char *szProto = cacheEntry->m_cache_cszProto;
cont->proto = szProto;
- if (szProto != NULL && !pcli->pfnIsHiddenMode(dat,pdnce___GetStatus( cacheEntry )))
+ if (szProto != NULL && !pcli->pfnIsHiddenMode(dat, pdnce___GetStatus(cacheEntry)))
cont->flags |= CONTACTF_ONLINE;
- apparentMode = szProto != NULL?cacheEntry->ApparentMode:0;
+ WORD apparentMode = szProto != NULL ? cacheEntry->ApparentMode : 0;
if (apparentMode)
- switch (apparentMode)
- {
- case ID_STATUS_OFFLINE:
- cont->flags |= CONTACTF_INVISTO;
- break;
- case ID_STATUS_ONLINE:
- cont->flags |= CONTACTF_VISTO;
- break;
- default:
- cont->flags |= CONTACTF_VISTO|CONTACTF_INVISTO;
+ switch (apparentMode) {
+ case ID_STATUS_OFFLINE:
+ cont->flags |= CONTACTF_INVISTO;
+ break;
+ case ID_STATUS_ONLINE:
+ cont->flags |= CONTACTF_VISTO;
+ break;
+ default:
+ cont->flags |= CONTACTF_VISTO | CONTACTF_INVISTO;
}
if (cacheEntry->NotOnList)
cont->flags |= CONTACTF_NOTONLIST;
- idleMode = szProto != NULL?cacheEntry->IdleTS:0;
+ DWORD idleMode = szProto != NULL ? cacheEntry->IdleTS : 0;
if (idleMode)
cont->flags |= CONTACTF_IDLE;
-
- //Add subcontacts
+ // Add subcontacts
if (szProto)
- {
if (dat->IsMetaContactsEnabled && mir_strcmp(cont->proto, META_PROTO) == 0)
- AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group));
- }
+ AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group));
+
cont->lastPaintCounter = 0;
cont->avatar_pos = AVATAR_POS_DONT_HAVE;
- Cache_GetAvatar(dat,cont);
- Cache_GetText(dat,cont,1);
- Cache_GetTimezone(dat,cont->hContact);
+ Cache_GetAvatar(dat, cont);
+ Cache_GetText(dat, cont, 1);
+ Cache_GetTimezone(dat, cont->hContact);
cont->iImage = corecli.pfnGetContactIcon(hContact);
- cont->bContactRate = db_get_b(hContact, "CList", "Rate",0);
+ cont->bContactRate = db_get_b(hContact, "CList", "Rate", 0);
}
-static ClcContact *AddContactToGroup(ClcData *dat,ClcGroup *group, ClcCacheEntry *cacheEntry)
+static ClcContact* AddContactToGroup(ClcData *dat, ClcGroup *group, ClcCacheEntry *cacheEntry)
{
MCONTACT hContact;
int i;
@@ -218,9 +216,9 @@ static ClcContact *AddContactToGroup(ClcData *dat,ClcGroup *group, ClcCacheEntry if (dat == NULL) return NULL;
hContact = cacheEntry->hContact;
dat->needsResort = 1;
- for (i = group->cl.count-1;i >= 0;i--)
+ for (i = group->cl.count - 1; i >= 0; i--)
if (group->cl.items[i]->type != CLCIT_INFO || !(group->cl.items[i]->flags&CLCIIF_BELOWCONTACTS)) break;
- i = cli_AddItemToGroup(group,i+1);
+ i = cli_AddItemToGroup(group, i + 1);
_LoadDataToContact(group->cl.items[i], group, dat, hContact);
cacheEntry = pcli->pfnGetCacheEntry(hContact);
@@ -228,64 +226,62 @@ static ClcContact *AddContactToGroup(ClcData *dat,ClcGroup *group, ClcCacheEntry return group->cl.items[i];
}
-void * AddTempGroup(HWND hwnd,ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers)
+void* AddTempGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
{
- int i=0;
+ int i = 0;
int f = 0;
- TCHAR * szGroupName;
DWORD groupFlags;
- if ( wildcmp( _T2A(szName), "-@-HIDDEN-GROUP-@-"))
+ if (wildcmp(_T2A(szName), "-@-HIDDEN-GROUP-@-"))
return NULL;
for (i = 1;; i++) {
- szGroupName = pcli->pfnGetGroupName(i,&groupFlags);
+ TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags);
if (szGroupName == NULL) break;
- if (!mir_tstrcmpi(szGroupName,szName)) f = 1;
+ if (!mir_tstrcmpi(szGroupName, szName)) f = 1;
}
- if (!f)
- {
+ if (!f) {
char buf[20];
TCHAR b2[255];
void * res = NULL;
- mir_snprintf(buf,SIZEOF(buf),"%d",(i-1));
- mir_sntprintf(b2,SIZEOF(b2),_T("#%s"),szName);
- b2[0] = 1|GROUPF_EXPANDED;
- db_set_ws(NULL,"CListGroups",buf,b2);
- pcli->pfnGetGroupName(i,&groupFlags);
- res = cli_AddGroup(hwnd,dat,szName,groupFlags,i,0);
+ mir_snprintf(buf, SIZEOF(buf), "%d", (i - 1));
+ mir_sntprintf(b2, SIZEOF(b2), _T("#%s"), szName);
+ b2[0] = 1 | GROUPF_EXPANDED;
+ db_set_ws(NULL, "CListGroups", buf, b2);
+ pcli->pfnGetGroupName(i, &groupFlags);
+ res = cli_AddGroup(hwnd, dat, szName, groupFlags, i, 0);
return res;
}
return NULL;
}
-void cli_AddContactToTree(HWND hwnd,ClcData *dat,MCONTACT hContact,int updateTotalCount,int checkHideOffline)
+void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline)
{
ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact);
- if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_cache_nHiddenSubcontact)
+ if (dat->IsMetaContactsEnabled && cacheEntry && cacheEntry->m_bIsSub)
return; //contact should not be added
if (!dat->IsMetaContactsEnabled && cacheEntry && !mir_strcmp(cacheEntry->m_cache_cszProto, META_PROTO))
return;
- corecli.pfnAddContactToTree(hwnd,dat,hContact,updateTotalCount,checkHideOffline);
+ corecli.pfnAddContactToTree(hwnd, dat, hContact, updateTotalCount, checkHideOffline);
ClcGroup *group;
ClcContact *cont;
- if ( FindItem(hwnd,dat,hContact,&cont,&group,NULL,FALSE))
+ if (FindItem(hwnd, dat, hContact, &cont, &group, NULL, FALSE))
_LoadDataToContact(cont, group, dat, hContact);
return;
}
void cli_DeleteItemFromTree(HWND hwnd, MCONTACT hItem)
{
- ClcData *dat = (ClcData *) GetWindowLongPtr(hwnd, 0);
+ ClcData *dat = (ClcData *)GetWindowLongPtr(hwnd, 0);
ClearRowByIndexCache();
corecli.pfnDeleteItemFromTree(hwnd, hItem);
//check here contacts are not resorting
if (hwnd == pcli->hwndContactTree)
- pcli->pfnFreeCacheItem( pcli->pfnGetCacheEntry(hItem));
+ pcli->pfnFreeCacheItem(pcli->pfnGetCacheEntry(hItem));
dat->needsResort = 1;
ClearRowByIndexCache();
}
@@ -296,7 +292,7 @@ __inline BOOL CLCItems_IsShowOfflineGroup(ClcGroup* group) DWORD groupFlags = 0;
if (!group) return FALSE;
if (group->hideOffline) return FALSE;
- pcli->pfnGetGroupName(group->groupId,&groupFlags);
+ pcli->pfnGetGroupName(group->groupId, &groupFlags);
return (groupFlags&GROUPF_SHOWOFFLINE) != 0;
}
@@ -319,12 +315,12 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) return dat->selection;
}
- if (!selcontact->isSubcontact )
- dat->selection = pcli->pfnGetRowsPriorTo( &dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact ));
+ if (!selcontact->isSubcontact)
+ dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact));
else {
- dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts ));
+ dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact->subcontacts));
- if (dat->selection != -1 )
+ if (dat->selection != -1)
dat->selection += selcontact->isSubcontact;
}
return dat->selection;
@@ -333,36 +329,36 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected) void cliRebuildEntireList(HWND hwnd, ClcData *dat)
{
- DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
+ DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
ClcContact *cont;
ClcGroup *group;
static int rebuildCounter = 0;
- BOOL PlaceOfflineToRoot = db_get_b(NULL,"CList","PlaceOfflineToRoot",SETTING_PLACEOFFLINETOROOT_DEFAULT);
- KillTimer(hwnd,TIMERID_REBUILDAFTER);
+ BOOL PlaceOfflineToRoot = db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOFFLINETOROOT_DEFAULT);
+ KillTimer(hwnd, TIMERID_REBUILDAFTER);
ClearRowByIndexCache();
ImageArray_Clear(&dat->avatar_cache);
RowHeights_Clear(dat);
RowHeights_GetMaxRowHeight(dat, hwnd);
- TRACEVAR("Rebuild Entire List %d times\n",++rebuildCounter);
+ TRACEVAR("Rebuild Entire List %d times\n", ++rebuildCounter);
dat->list.expanded = 1;
- dat->list.hideOffline = db_get_b(NULL,"CLC","HideOfflineRoot",SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
+ dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", SETTING_HIDEOFFLINEATROOT_DEFAULT) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
dat->list.cl.increment = 50;
dat->needsResort = 1;
MCONTACT hSelected = SaveSelection(dat);
dat->selection = -1;
- dat->HiLightMode = db_get_b(NULL,"CLC","HiLightMode",SETTING_HILIGHTMODE_DEFAULT);
+ dat->HiLightMode = db_get_b(NULL, "CLC", "HiLightMode", SETTING_HILIGHTMODE_DEFAULT);
{
for (int i = 1;; i++) {
DWORD groupFlags;
- TCHAR *szGroupName = pcli->pfnGetGroupName(i,&groupFlags); //UNICODE
+ TCHAR *szGroupName = pcli->pfnGetGroupName(i, &groupFlags); //UNICODE
if (szGroupName == NULL)
break;
- cli_AddGroup(hwnd,dat,szGroupName,groupFlags,i,0);
+ cli_AddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
}
}
@@ -376,10 +372,10 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) if (lstrlen(cacheEntry->tszGroup) == 0)
group = &dat->list;
else
- group = cli_AddGroup(hwnd,dat,cacheEntry->tszGroup,(DWORD)-1, 0, 0);
+ group = cli_AddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0);
if (group != NULL) {
- WORD wStatus = pdnce___GetStatus( cacheEntry );
+ WORD wStatus = pdnce___GetStatus(cacheEntry);
if (wStatus == ID_STATUS_OFFLINE)
if (PlaceOfflineToRoot)
group = &dat->list;
@@ -387,19 +383,19 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
if (cacheEntry->m_cache_cszProto == NULL) {
- if (!pcli->pfnIsHiddenMode(dat,ID_STATUS_OFFLINE) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
- cont = AddContactToGroup(dat,group,cacheEntry);
+ if (!pcli->pfnIsHiddenMode(dat, ID_STATUS_OFFLINE) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
+ cont = AddContactToGroup(dat, group, cacheEntry);
}
- else if (!pcli->pfnIsHiddenMode(dat,wStatus) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
- cont = AddContactToGroup(dat,group,cacheEntry);
+ else if (!pcli->pfnIsHiddenMode(dat, wStatus) || cacheEntry->m_cache_nNoHiddenOffline || CLCItems_IsShowOfflineGroup(group))
+ cont = AddContactToGroup(dat, group, cacheEntry);
}
- else cont = AddContactToGroup(dat,group,cacheEntry);
+ else cont = AddContactToGroup(dat, group, cacheEntry);
}
}
if (cont) {
cont->SubAllocated = 0;
if (cont->proto && dat->IsMetaContactsEnabled && strcmp(cont->proto, META_PROTO) == 0)
- AddSubcontacts(dat,cont,CLCItems_IsShowOfflineGroup(group));
+ AddSubcontacts(dat, cont, CLCItems_IsShowOfflineGroup(group));
}
}
@@ -413,7 +409,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) }
else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
if (group->cl.items[group->scanIndex]->group->cl.count == 0) {
- group = pcli->pfnRemoveItemFromGroup(hwnd,group,group->cl.items[group->scanIndex],0);
+ group = pcli->pfnRemoveItemFromGroup(hwnd, group, group->cl.items[group->scanIndex], 0);
}
else {
group = group->cl.items[group->scanIndex]->group;
@@ -433,10 +429,8 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) void cli_SortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
{
MCONTACT hSelected = SaveSelection(dat);
-
- corecli.pfnSortCLC(hwnd,dat,useInsertionSort);
-
- RestoreSelection( dat, hSelected );
+ corecli.pfnSortCLC(hwnd, dat, useInsertionSort);
+ RestoreSelection(dat, hSelected);
}
int GetNewSelection(ClcGroup *group, int selection, int direction)
@@ -457,7 +451,7 @@ int GetNewSelection(ClcGroup *group, int selection, int direction) lastcount = count;
count++;
if (!direction) {
- if (count>selection) return lastcount;
+ if (count > selection) return lastcount;
}
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
@@ -476,7 +470,7 @@ struct SavedContactState_t { };
struct SavedGroupState_t {
- int groupId,expanded;
+ int groupId, expanded;
};
struct SavedInfoState_t {
@@ -491,9 +485,9 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) NMCLISTCONTROL nm;
int i, j;
- OBJLIST<SavedGroupState_t> savedGroup( 4 );
- OBJLIST<SavedContactState_t> savedContact( 4 );
- OBJLIST<SavedInfoState_t> savedInfo( 4 );
+ OBJLIST<SavedGroupState_t> savedGroup(4);
+ OBJLIST<SavedContactState_t> savedContact(4);
+ OBJLIST<SavedInfoState_t> savedInfo(4);
ClcGroup *group;
ClcContact *contact;
@@ -519,7 +513,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) SavedGroupState_t* p = new SavedGroupState_t;
p->groupId = group->groupId;
p->expanded = group->expanded;
- savedGroup.insert( p );
+ savedGroup.insert(p);
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
@@ -527,17 +521,17 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) p->hContact = group->cl.items[group->scanIndex]->hContact;
memcpy(p->iExtraImage, group->cl.items[group->scanIndex]->iExtraImage, sizeof(p->iExtraImage));
p->checked = group->cl.items[group->scanIndex]->flags & CONTACTF_CHECKED;
- savedContact.insert( p );
+ savedContact.insert(p);
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
- SavedInfoState_t* p = new SavedInfoState_t;
- memset( p, 0, sizeof( SavedInfoState_t ));
+ SavedInfoState_t *p = new SavedInfoState_t;
+ memset(p, 0, sizeof(SavedInfoState_t));
if (group->parent == NULL)
p->parentId = -1;
else
p->parentId = group->groupId;
p->contact = *group->cl.items[group->scanIndex];
- savedInfo.insert( p );
+ savedInfo.insert(p);
}
group->scanIndex++;
}
@@ -556,26 +550,26 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
- for (i=0; i < savedGroup.getCount(); i++)
+ for (i = 0; i < savedGroup.getCount(); i++)
if (savedGroup[i].groupId == group->groupId) {
- group->expanded = savedGroup[i].expanded;
- break;
+ group->expanded = savedGroup[i].expanded;
+ break;
}
continue;
}
else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
- for (i=0; i < savedContact.getCount(); i++)
+ for (i = 0; i < savedContact.getCount(); i++)
if (savedContact[i].hContact == group->cl.items[group->scanIndex]->hContact) {
- memcpy(group->cl.items[group->scanIndex]->iExtraImage, savedContact[i].iExtraImage, sizeof(contact->iExtraImage));
- if (savedContact[i].checked)
- group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
- break;
+ memcpy(group->cl.items[group->scanIndex]->iExtraImage, savedContact[i].iExtraImage, sizeof(contact->iExtraImage));
+ if (savedContact[i].checked)
+ group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
+ break;
}
}
group->scanIndex++;
}
- for (i=0; i < savedInfo.getCount(); i++) {
+ for (i = 0; i < savedInfo.getCount(); i++) {
if (savedInfo[i].parentId == -1)
group = &dat->list;
else {
@@ -594,7 +588,7 @@ void cli_SaveStateAndRebuildList(HWND hwnd, ClcData *dat) nm.hdr.code = CLN_LISTREBUILT;
nm.hdr.hwndFrom = hwnd;
nm.hdr.idFrom = GetDlgCtrlID(hwnd);
- SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm);
+ SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
@@ -606,7 +600,7 @@ WORD pdnce___GetStatus(ClcCacheEntry *pdnce) return pdnce->m_cache_nStatus;
}
-void pdnce___SetStatus( ClcCacheEntry *pdnce, WORD wStatus )
+void pdnce___SetStatus(ClcCacheEntry *pdnce, WORD wStatus)
{
if (pdnce)
pdnce->m_cache_nStatus = wStatus;
@@ -614,14 +608,14 @@ void pdnce___SetStatus( ClcCacheEntry *pdnce, WORD wStatus ) ClcContact* cliCreateClcContact()
{
- ClcContact* contact = (ClcContact*)mir_calloc(sizeof( ClcContact ));
+ ClcContact* contact = (ClcContact*)mir_calloc(sizeof(ClcContact));
memset(contact->iExtraImage, 0xFF, sizeof(contact->iExtraImage));
return contact;
}
-ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact )
+ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact)
{
- ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc(sizeof( ClcCacheEntry ));
+ ClcCacheEntry *p = (ClcCacheEntry *)mir_calloc(sizeof(ClcCacheEntry));
if (p == NULL)
return NULL;
@@ -641,7 +635,7 @@ void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact) else {
ClcCacheEntry *p = pcli->pfnGetCacheEntry(hContact);
if (p)
- InvalidateDNCEbyPointer(hContact,p,0);
+ InvalidateDNCEbyPointer(hContact, p, 0);
}
}
@@ -662,16 +656,15 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly) break;
group = group->parent;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!(visibleOnly&0x01) || group->cl.items[group->scanIndex]->group->expanded)) {
+ else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!(visibleOnly & 0x01) || group->cl.items[group->scanIndex]->group->expanded)) {
group = group->cl.items[group->scanIndex]->group;
group->scanIndex = 0;
count += group->cl.count;
continue;
}
else if ((group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) &&
- (group->cl.items[group->scanIndex]->subcontacts != NULL) &&
- ((group->cl.items[group->scanIndex]->SubExpanded || (!visibleOnly))))
- {
+ (group->cl.items[group->scanIndex]->subcontacts != NULL) &&
+ ((group->cl.items[group->scanIndex]->SubExpanded || (!visibleOnly)))) {
count += group->cl.items[group->scanIndex]->SubAllocated;
}
group->scanIndex++;
@@ -690,7 +683,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it.
int filterResult = 1;
int searchResult = 0;
- DBVARIANT dbv = {0};
+ DBVARIANT dbv = { 0 };
char szTemp[64];
TCHAR szGroupMask[256];
DWORD dwLocalMask;
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 11b4374f22..4ff3243fd6 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -785,7 +785,9 @@ int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand {
ClcContact *ht = NULL;
KillTimer(hwnd,TIMERID_SUBEXPAND);
- if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT)) return 0;
+ if (contact->type != CLCIT_CONTACT || contact->SubAllocated == 0 || contact->SubExpanded == bExpand || !db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT))
+ return 0;
+
contact->SubExpanded = bExpand;
db_set_b(contact->hContact,"CList","Expanded",contact->SubExpanded);
dat->needsResort = 1;
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 993eedc5a0..d83af199f4 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -138,9 +138,9 @@ void CListSettings_CopyCacheItems(ClcCacheEntry *pDst, ClcCacheEntry *pSrc, DWOR if (flag & CCI_OTHER) {
pDst->bIsHidden = pSrc->bIsHidden;
pDst->m_cache_nNoHiddenOffline = pSrc->m_cache_nNoHiddenOffline;
- pDst->m_cache_bProtoNotExists = pSrc->m_cache_bProtoNotExists;
+ pDst->m_bProtoNotExists = pSrc->m_bProtoNotExists;
- pDst->m_cache_nHiddenSubcontact = pSrc->m_cache_nHiddenSubcontact;
+ pDst->m_bIsSub = pSrc->m_bIsSub;
pDst->i = pSrc->i;
pDst->ApparentMode = pSrc->ApparentMode;
pDst->NotOnList = pSrc->NotOnList;
@@ -199,10 +199,10 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) return;
}
- if (pdnce->m_cache_cszProto == NULL && pdnce->m_cache_bProtoNotExists == FALSE) {
+ if (pdnce->m_cache_cszProto == NULL && pdnce->m_bProtoNotExists == FALSE) {
pdnce->m_cache_cszProto = GetProtoForContact(pdnce->hContact);
if (pdnce->m_cache_cszProto == NULL)
- pdnce->m_cache_bProtoNotExists = FALSE;
+ pdnce->m_bProtoNotExists = FALSE;
else if (pdnce->m_cache_cszProto && pdnce->tszName)
pdnce->freeName();
}
@@ -210,9 +210,9 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->tszName == NULL)
pdnce->getName();
- else if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_cache_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) {
+ else if (pdnce->isUnknown && pdnce->m_cache_cszProto && pdnce->m_bProtoNotExists == TRUE && g_flag_bOnModulesLoadedCalled) {
if (CallService(MS_PROTO_ISPROTOCOLLOADED, 0, (LPARAM)pdnce->m_cache_cszProto) == 0) {
- pdnce->m_cache_bProtoNotExists = FALSE;
+ pdnce->m_bProtoNotExists = FALSE;
pdnce->getName();
}
}
@@ -232,7 +232,7 @@ void cliCheckCacheItem(ClcCacheEntry *pdnce) if (pdnce->bIsHidden == -1)
pdnce->bIsHidden = db_get_b(pdnce->hContact, "CList", "Hidden", 0);
- pdnce->m_cache_nHiddenSubcontact = db_mc_isSub(pdnce->hContact);
+ pdnce->m_bIsSub = db_mc_isSub(pdnce->hContact) != 0;
if (pdnce->m_cache_nNoHiddenOffline == -1)
pdnce->m_cache_nNoHiddenOffline = db_get_b(pdnce->hContact, "CList", "noOffline", 0);
@@ -299,8 +299,7 @@ void InvalidateDNCEbyPointer(MCONTACT hContact, ClcCacheEntry *pdnce, int Settin else pdnce->dwLastMsgTime = -1;
pdnce->bIsHidden = -1;
- pdnce->m_cache_nHiddenSubcontact = -1;
- pdnce->m_cache_bProtoNotExists = FALSE;
+ pdnce->m_bIsSub = pdnce->m_bProtoNotExists = false;
pdnce___SetStatus(pdnce, 0);
pdnce->IdleTS = -1;
pdnce->ApparentMode = -1;
@@ -343,7 +342,7 @@ void ClcCacheEntry::getName() {
freeName();
- if (m_cache_bProtoNotExists || !m_cache_cszProto) {
+ if (m_bProtoNotExists || !m_cache_cszProto) {
LBL_Unknown:
tszName = UnknownConctactTranslatedName;
isUnknown = true;
@@ -388,6 +387,15 @@ int ContactAdded(WPARAM hContact, LPARAM lParam) return 0;
}
+int MetaStatusChanged(WPARAM hMeta, LPARAM hSub)
+{
+ ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hMeta);
+ if (pdnce)
+ pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hMeta, 0);
+
+ return 0;
+}
+
int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
if (MirandaExiting() || !pcli || hContact == NULL)
@@ -399,7 +407,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
- if (pdnce->m_cache_bProtoNotExists || !pdnce->m_cache_cszProto)
+ if (pdnce->m_bProtoNotExists || !pdnce->m_cache_cszProto)
return 0;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 4c9d90e046..99767a01fe 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_sync.h"
int ContactSettingChanged(WPARAM, LPARAM);
+int MetaStatusChanged(WPARAM, LPARAM);
HRESULT (WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& result );
@@ -448,6 +449,7 @@ HRESULT CLUI::CreateCLC() mutex_bDisableAutoUpdate = 0;
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged);
+ HookEvent(ME_MC_DEFAULTTCHANGED, MetaStatusChanged);
return S_OK;
}
|