summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdclist/src/clcpaint.cpp5
-rw-r--r--src/mir_app/src/clcidents.cpp9
-rw-r--r--src/mir_app/src/clcitems.cpp92
-rw-r--r--src/mir_app/src/clcutils.cpp29
4 files changed, 76 insertions, 59 deletions
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp
index 2df1197160..49afb4ab9f 100644
--- a/src/core/stdclist/src/clcpaint.cpp
+++ b/src/core/stdclist/src/clcpaint.cpp
@@ -266,11 +266,10 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
int indent = 0;
for (int index = 0; y < rcPaint->bottom;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- indent--;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
group->scanIndex++;
+ indent--;
continue;
}
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp
index ff377d900f..2256ff3c83 100644
--- a/src/mir_app/src/clcidents.cpp
+++ b/src/mir_app/src/clcidents.cpp
@@ -49,8 +49,7 @@ int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
group->scanIndex++;
continue;
@@ -83,8 +82,7 @@ int fnFindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcG
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
nowVisible = 1;
@@ -153,8 +151,7 @@ int fnGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
group->scanIndex++;
continue;
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index 46a288eb56..5a076a73a6 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -403,16 +403,19 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
+ if ((group = group->parent) == NULL)
+ break;
+ group->scanIndex++;
+ continue;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- if (group->cl.items[group->scanIndex]->group->cl.count == 0) {
- group = cli.pfnRemoveItemFromGroup(hwnd, group, group->cl.items[group->scanIndex], 0);
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ if (cc->group->cl.count == 0) {
+ group = cli.pfnRemoveItemFromGroup(hwnd, group, cc, 0);
}
else {
- group = group->cl.items[group->scanIndex]->group;
+ group = cc->group;
group->scanIndex = 0;
}
continue;
@@ -436,9 +439,13 @@ int fnGetGroupContentsCount(ClcGroup *group, int visibleOnly)
if (group == topgroup)
break;
group = group->parent;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (!visibleOnly || group->cl.items[group->scanIndex]->group->expanded)) {
- group = group->cl.items[group->scanIndex]->group;
+ group->scanIndex++;
+ continue;
+ }
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP && (!visibleOnly || cc->group->expanded)) {
+ group = cc->group;
group->scanIndex = 0;
count += group->cl.count;
continue;
@@ -555,12 +562,15 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort)
SortGroup(dat, group, useInsertionSort);
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
+ if ((group = group->parent) == NULL)
+ break;
+ group->scanIndex++;
+ continue;
+ }
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ group = cc->group;
group->scanIndex = 0;
SortGroup(dat, group, useInsertionSort);
continue;
@@ -620,12 +630,15 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat)
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
+ if ((group = group->parent) == NULL)
+ break;
+ group->scanIndex++;
+ continue;
+ }
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ group = cc->group;
group->scanIndex = 0;
SavedGroupState_t *p = new SavedGroupState_t;
@@ -634,17 +647,17 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat)
saveGroup.insert(p);
continue;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
+ else if (cc->type == CLCIT_CONTACT) {
SavedContactState_t *p = new SavedContactState_t;
- 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;
+ p->hContact = cc->hContact;
+ memcpy(p->iExtraImage, cc->iExtraImage, sizeof(p->iExtraImage));
+ p->checked = cc->flags & CONTACTF_CHECKED;
saveContact.insert(p);
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_INFO) {
+ else if (cc->type == CLCIT_INFO) {
SavedInfoState_t *p = new SavedInfoState_t;
p->parentId = (group->parent == NULL) ? -1 : group->groupId;
- p->contact = *group->cl.items[group->scanIndex];
+ p->contact = *cc;
saveInfo.insert(p);
}
group->scanIndex++;
@@ -657,12 +670,15 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat)
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
- break;
- }
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
+ if ((group = group->parent) == NULL)
+ break;
+ group->scanIndex++;
+ continue;
+ }
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ group = cc->group;
group->scanIndex = 0;
SavedGroupState_t tmp, *p;
@@ -671,13 +687,13 @@ void fnSaveStateAndRebuildList(HWND hwnd, ClcData *dat)
group->expanded = p->expanded;
continue;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT) {
+ else if (cc->type == CLCIT_CONTACT) {
SavedContactState_t tmp, *p;
- tmp.hContact = group->cl.items[group->scanIndex]->hContact;
+ tmp.hContact = cc->hContact;
if ((p = saveContact.find(&tmp)) != NULL) {
- memcpy(group->cl.items[group->scanIndex]->iExtraImage, p->iExtraImage, sizeof(p->iExtraImage));
+ memcpy(cc->iExtraImage, p->iExtraImage, sizeof(p->iExtraImage));
if (p->checked)
- group->cl.items[group->scanIndex]->flags |= CONTACTF_CHECKED;
+ cc->flags |= CONTACTF_CHECKED;
}
}
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index 94dccfc161..4530eb959d 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -43,15 +43,19 @@ TCHAR* fnGetGroupCountsText(ClcData *dat, ClcContact *contact)
if (group == topgroup)
break;
group = group->parent;
+ group->scanIndex++;
+ continue;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- group = group->cl.items[group->scanIndex]->group;
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ group = cc->group;
group->scanIndex = 0;
totalCount += group->totalMembers;
continue;
}
- else if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT)
- if (group->cl.items[group->scanIndex]->flags & CONTACTF_ONLINE)
+ else if (cc->type == CLCIT_CONTACT)
+ if (cc->flags & CONTACTF_ONLINE)
onlineCount++;
group->scanIndex++;
}
@@ -364,20 +368,21 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
group->scanIndex++;
continue;
}
- if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type != CLCIT_DIVIDER) {
bool show;
if (dat->bFilterSearch) {
- TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText));
+ TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(cc->szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
show = _tcsstr(lowered_szText, lowered_text) != NULL;
}
- else show = ((prefixOk && !_tcsnicmp(text, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, group->cl.items[group->scanIndex]->szText)));
+ else show = ((prefixOk && !_tcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
if (show) {
ClcGroup *contactGroup = group;
@@ -386,9 +391,9 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
cli.pfnSetGroupExpand(hwnd, dat, group, 1);
return cli.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
}
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
- if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) {
- group = group->cl.items[group->scanIndex]->group;
+ if (cc->type == CLCIT_GROUP) {
+ if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || cc->group->expanded) {
+ group = cc->group;
group->scanIndex = 0;
continue;
}