summaryrefslogtreecommitdiff
path: root/src/modules/clist/clcitems.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/clist/clcitems.cpp')
-rw-r--r--src/modules/clist/clcitems.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index f2e6dac894..139c7e6e70 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -107,17 +107,15 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD
group->totalMembers = 0;
if (flags != (DWORD) - 1 && pNextField == NULL && calcTotalMembers) {
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- HANDLE hContact = db_find_first();
- while (hContact) {
- ClcCacheEntry* cache = cli.pfnGetCacheEntry(hContact);
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact);
if ( !lstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden))
group->totalMembers++;
-
- hContact = db_find_next(hContact);
}
}
}
- } while (pNextField);
+ }
+ while (pNextField);
return group;
}
@@ -348,32 +346,25 @@ void fnDeleteItemFromTree(HWND hwnd, HANDLE hItem)
void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
{
- char *szProto;
DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE);
- HANDLE hContact;
ClcGroup *group;
- DBVARIANT dbv;
dat->list.expanded = 1;
dat->list.hideOffline = db_get_b(NULL, "CLC", "HideOfflineRoot", 0) && style&CLS_USEGROUPS;
dat->list.cl.count = dat->list.cl.limit = 0;
dat->selection = -1;
- {
- int i;
- TCHAR *szGroupName;
- DWORD groupFlags;
- for (i = 1;; i++) {
- szGroupName = cli.pfnGetGroupName(i, &groupFlags);
- if (szGroupName == NULL)
- break;
- cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
- }
+ for (int i = 1;; i++) {
+ DWORD groupFlags;
+ TCHAR *szGroupName = cli.pfnGetGroupName(i, &groupFlags);
+ if (szGroupName == NULL)
+ break;
+ cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
}
- hContact = db_find_first();
- while (hContact) {
+ for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (style & CLS_SHOWHIDDEN || !db_get_b(hContact, "CList", "Hidden", 0)) {
+ DBVARIANT dbv;
if (db_get_ts(hContact, "CList", "Group", &dbv))
group = &dat->list;
else {
@@ -392,8 +383,9 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
if (_tcsstr(lowered_name, lowered_search))
cli.pfnAddContactToGroup(dat, group, hContact);
- } else if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
- szProto = GetContactProto(hContact);
+ }
+ else if ( !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
+ char *szProto = GetContactProto(hContact);
if (szProto == NULL) {
if ( !cli.pfnIsHiddenMode(dat, ID_STATUS_OFFLINE))
cli.pfnAddContactToGroup(dat, group, hContact);
@@ -404,7 +396,6 @@ void fnRebuildEntireList(HWND hwnd, struct ClcData *dat)
else cli.pfnAddContactToGroup(dat, group, hContact);
}
}
- hContact = db_find_next(hContact);
}
if (style & CLS_HIDEEMPTYGROUPS) {