summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp47
-rw-r--r--plugins/Clist_modern/src/modern_clc.h2
-rw-r--r--plugins/Clist_modern/src/modern_clcidents.cpp69
-rw-r--r--plugins/Clist_modern/src/modern_clcitems.cpp52
-rw-r--r--plugins/Clist_modern/src/modern_clcmsgs.cpp4
-rw-r--r--plugins/Clist_modern/src/modern_clcpaint.cpp14
-rw-r--r--plugins/Clist_modern/src/modern_clcutils.cpp61
-rw-r--r--plugins/Clist_modern/src/modern_rowheight_funcs.cpp14
-rw-r--r--plugins/Clist_nicer/src/clcitems.cpp15
-rw-r--r--plugins/Clist_nicer/src/clcpaint.cpp34
-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
14 files changed, 236 insertions, 211 deletions
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 249f1eb8b8..61a07f0e63 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -212,24 +212,25 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR
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 found;
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
+ if (cc->type == CLCIT_GROUP) {
found = true;
}
else 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_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
found = _tcsstr(lowered_szText, lowered_search) != NULL;
}
else {
- found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, group->cl.items[group->scanIndex]->szText)));
+ found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
}
if (found) {
ClcGroup *contactGroup = group;
@@ -249,9 +250,9 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR
group = contactGroup;
group->scanIndex = 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;
}
@@ -509,12 +510,12 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
return 0;
}
- if (contact->type == CLCIT_CONTACT && (contact->nSubContacts || contact->iSubAllocated > 0)) {
- if (contact->nSubContacts && changeGroupExpand == 1) {
- dat->selection -= contact->nSubContacts;
+ if (contact->type == CLCIT_CONTACT && (contact->iSubNumber || contact->iSubAllocated > 0)) {
+ if (contact->iSubNumber && changeGroupExpand == 1) {
+ dat->selection -= contact->iSubNumber;
selMoved = 1;
}
- else if (!contact->nSubContacts && contact->iSubAllocated > 0) {
+ else if (!contact->iSubNumber && contact->iSubAllocated > 0) {
if (changeGroupExpand == 1 && !contact->bSubExpanded) {
dat->selection = cliGetRowsPriorTo(&dat->list, group, -1);
selMoved = 1;
@@ -590,8 +591,6 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM
cliInvalidateRect(hwnd, NULL, FALSE);
pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0);
UpdateWindow(hwnd);
- SetCapture(hwnd);
- return 0;
}
SetCapture(hwnd);
return 0;
@@ -745,7 +744,7 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT, WPARAM, LPARAM lP
}
}
- if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->iSubAllocated && !contact->nSubContacts)
+ if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->iSubAllocated && !contact->iSubNumber)
if (hitFlags & CLCHT_ONITEMICON && dat->expandMeta) {
hitcontact = contact;
HitPoint.x = (short)LOWORD(lParam);
@@ -972,7 +971,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
if (contSour->isChat())
break;
if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) {
- if (!contSour->nSubContacts)
+ if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta
else
hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DROPMETA));
@@ -985,7 +984,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
if (contSour->isChat() || contDest->isChat())
break;
if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) {
- if (!contSour->nSubContacts)
+ if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta
else if (contSour->subcontacts == contDest)
hNewCursor = LoadCursor(g_hInst, MAKEINTRESOURCE(IDC_DEFAULTSUB)); ///MakeDefault
@@ -1000,7 +999,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
if (contSour->isChat() || contDest->isChat())
break;
if (contSour->type == CLCIT_CONTACT && mir_strcmp(contSour->proto, META_PROTO)) {
- if (!contSour->nSubContacts)
+ if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta
else if (contDest->subcontacts == contSour->subcontacts)
break;
@@ -1048,7 +1047,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR
cliGetRowByIndex(dat, dat->iDragItem, NULL, &group);
if (group && group->parent) {
cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL);
- if (!contSour->nSubContacts)
+ if (!contSour->iSubNumber)
hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER));
}
break;
@@ -1104,7 +1103,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
MCONTACT hcontact = contSour->hContact;
if (mir_strcmp(contSour->proto, META_PROTO)) {
- if (!contSour->nSubContacts) {
+ if (!contSour->iSubNumber) {
MCONTACT hDest = contDest->hContact;
mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be converted to metacontact and '%s' be added to it?"), contDest->szText, contSour->szText);
int res = MessageBox(hwnd, Wording, TranslateT("Converting to metacontact"), MB_OKCANCEL | MB_ICONQUESTION);
@@ -1142,7 +1141,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
if (!mir_strcmp(contSour->proto, META_PROTO))
break;
- if (!contSour->nSubContacts) {
+ if (!contSour->iSubNumber) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->hContact;
mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText);
@@ -1184,7 +1183,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam,
if (contSour->type == CLCIT_CONTACT) {
if (!mir_strcmp(contSour->proto, META_PROTO))
break;
- if (!contSour->nSubContacts) {
+ if (!contSour->iSubNumber) {
MCONTACT hcontact = contSour->hContact;
MCONTACT handle = contDest->subcontacts->hContact;
mir_sntprintf(Wording, TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->subcontacts->szText);
@@ -1544,7 +1543,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM
if (contact->type == CLCIT_CONTACT) {
if (!contact->bImageIsSpecial && pdnce->getStatus() > ID_STATUS_OFFLINE)
contact->iImage = corecli.pfnGetContactIcon(wParam);
- if (contact->nSubContacts && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT)
+ if (contact->iSubNumber && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT)
pcli->pfnClcBroadcast(INTM_STATUSCHANGED, contact->subcontacts->hContact, 0); //forward status changing to host meta contact
}
}
diff --git a/plugins/Clist_modern/src/modern_clc.h b/plugins/Clist_modern/src/modern_clc.h
index 5e457b7b94..f4ed7279c4 100644
--- a/plugins/Clist_modern/src/modern_clc.h
+++ b/plugins/Clist_modern/src/modern_clc.h
@@ -181,7 +181,7 @@ struct tContactItems
struct ClcContact : public ClcContactBase
{
ClcContact *subcontacts;
- int iSubAllocated, nSubContacts;
+ int iSubAllocated, iSubNumber;
bool bSubExpanded, bImageIsSpecial;
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp
index 8afc03b8b6..27d645eb3c 100644
--- a/plugins/Clist_modern/src/modern_clcidents.cpp
+++ b/plugins/Clist_modern/src/modern_clcidents.cpp
@@ -41,34 +41,34 @@ int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
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;
}
if (group == subgroup && contactIndex - subcontactscount == group->scanIndex) return count;
count++;
- ClcContact *c = group->cl.items[group->scanIndex];
- if (c->type == CLCIT_GROUP) {
- if (c->group == subgroup && contactIndex == -1)
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ if (cc->group == subgroup && contactIndex == -1)
return count - 1;
- if (c->group->expanded) {
- group = c->group;
+ if (cc->group->expanded) {
+ group = cc->group;
group->scanIndex = 0;
subcontactscount = 0;
continue;
}
}
- int iRows = (bMetaExpanding && c->bSubExpanded) ? c->iSubAllocated : 0;
+ int iRows = (bMetaExpanding && cc->bSubExpanded) ? cc->iSubAllocated : 0;
if (group == subgroup) {
- if (c->type == CLCIT_CONTACT && c->iSubAllocated) {
+ if (cc->type == CLCIT_CONTACT && cc->iSubAllocated) {
if (group->scanIndex + iRows >= contactIndex)
return count + (contactIndex - group->scanIndex) - 1;
}
}
- if (c->type == CLCIT_CONTACT) {
+ if (cc->type == CLCIT_CONTACT) {
count += iRows;
subcontactscount += iRows;
}
@@ -93,8 +93,7 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro
for (;;) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL)
+ if ((group = group->parent) == NULL)
break;
nowVisible = 1;
@@ -111,10 +110,10 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro
if (nowVisible)
index++;
- ClcContact *c = group->cl.items[group->scanIndex];
- if ((IsHContactGroup(dwItem) && c->type == CLCIT_GROUP && (dwItem & ~HCONTACT_ISGROUP) == c->groupId) ||
- (IsHContactContact(dwItem) && c->type == CLCIT_CONTACT && c->hContact == dwItem) ||
- (IsHContactInfo(dwItem) && c->type == CLCIT_INFO && c->hContact == (dwItem & ~HCONTACT_ISINFO))) {
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if ((IsHContactGroup(dwItem) && cc->type == CLCIT_GROUP && (dwItem & ~HCONTACT_ISGROUP) == cc->groupId) ||
+ (IsHContactContact(dwItem) && cc->type == CLCIT_CONTACT && cc->hContact == dwItem) ||
+ (IsHContactInfo(dwItem) && cc->type == CLCIT_INFO && cc->hContact == (dwItem & ~HCONTACT_ISINFO))) {
if (isVisible) {
if (!nowVisible) *isVisible = 0;
else {
@@ -128,24 +127,24 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro
}
}
}
- if (contact) *contact = c;
+ if (contact) *contact = cc;
if (subgroup) *subgroup = group;
return 1;
}
- if (!isIgnoreSubcontacts && IsHContactContact(dwItem) && c->type == CLCIT_CONTACT && c->iSubAllocated > 0) {
- for (int i = 0; i < c->iSubAllocated; i++) {
- if (c->subcontacts[i].hContact == dwItem) {
- if (contact) *contact = &c->subcontacts[i];
+ if (!isIgnoreSubcontacts && IsHContactContact(dwItem) && cc->type == CLCIT_CONTACT && cc->iSubAllocated > 0) {
+ for (int i = 0; i < cc->iSubAllocated; i++) {
+ if (cc->subcontacts[i].hContact == dwItem) {
+ if (contact) *contact = &cc->subcontacts[i];
if (subgroup) *subgroup = group;
return 1;
}
}
}
- if (c->type == CLCIT_GROUP) {
- group = c->group;
+ if (cc->type == CLCIT_GROUP) {
+ group = cc->group;
group->scanIndex = 0;
nowVisible &= group->expanded;
continue;
@@ -169,28 +168,28 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup
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;
}
- ClcContact *c = group->cl.items[group->scanIndex];
+ ClcContact *cc = group->cl.items[group->scanIndex];
if (testindex == index) {
- if (contact) *contact = c;
+ if (contact) *contact = cc;
if (subgroup) *subgroup = group;
return index;
}
- if (c->type == CLCIT_CONTACT)
- if (c->iSubAllocated)
- if (c->bSubExpanded && dat->expandMeta) {
- for (i = 0; i < c->iSubAllocated; i++) {
+ if (cc->type == CLCIT_CONTACT)
+ if (cc->iSubAllocated)
+ if (cc->bSubExpanded && dat->expandMeta) {
+ for (i = 0; i < cc->iSubAllocated; i++) {
index++;
if (testindex == index) {
if (contact) {
- *contact = &c->subcontacts[i];
- (*contact)->subcontacts = c;
+ *contact = &cc->subcontacts[i];
+ (*contact)->subcontacts = cc;
}
if (subgroup) *subgroup = group;
@@ -200,8 +199,8 @@ int cliGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup
}
index++;
- if (c->type == CLCIT_GROUP && c->group->expanded) {
- group = c->group;
+ if (cc->type == CLCIT_GROUP && cc->group->expanded) {
+ group = cc->group;
group->scanIndex = 0;
continue;
}
diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp
index d8a14a5753..fc14c85bc9 100644
--- a/plugins/Clist_modern/src/modern_clcitems.cpp
+++ b/plugins/Clist_modern/src/modern_clcitems.cpp
@@ -29,13 +29,13 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
cont->bSubExpanded = 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->nSubContacts = 0;
+ cont->iSubNumber = 0;
cont->subcontacts = NULL;
cont->iSubAllocated = 0;
return;
}
- cont->nSubContacts = 0;
+ cont->iSubNumber = 0;
mir_free(cont->subcontacts);
cont->subcontacts = (ClcContact *)mir_calloc(sizeof(ClcContact)*subcount);
cont->iSubAllocated = subcount;
@@ -61,7 +61,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
p.proto = cacheEntry->m_pszProto;
p.type = CLCIT_CONTACT;
p.flags = 0;//CONTACTF_ONLINE;
- p.nSubContacts = i + 1;
+ p.iSubNumber = i + 1;
p.lastPaintCounter = 0;
p.subcontacts = cont;
p.bImageIsSpecial = false;
@@ -90,7 +90,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup)
void cli_FreeContact(ClcContact *p)
{
if (p->iSubAllocated) {
- if (p->subcontacts && !p->nSubContacts) {
+ if (p->subcontacts && !p->iSubNumber) {
for (int i = 0; i < p->iSubAllocated; i++) {
p->subcontacts[i].ssText.DestroySmileyList();
if (p->subcontacts[i].avatar_pos == AVATAR_POS_ANIMATED)
@@ -120,7 +120,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcGroup *group, ClcData *dat,
cont->type = CLCIT_CONTACT;
cont->pce = cacheEntry;
cont->iSubAllocated = 0;
- cont->nSubContacts = 0;
+ cont->iSubNumber = 0;
cont->subcontacts = NULL;
cont->szText[0] = 0;
cont->lastPaintCounter = 0;
@@ -227,13 +227,12 @@ int RestoreSelection(ClcData *dat, MCONTACT hSelected)
return dat->selection;
}
- if (!selcontact->nSubContacts)
+ if (!selcontact->iSubNumber)
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));
-
if (dat->selection != -1)
- dat->selection += selcontact->nSubContacts;
+ dat->selection += selcontact->iSubNumber;
}
return dat->selection;
}
@@ -309,15 +308,18 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat)
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;
}
- 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);
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ if (cc->group->cl.count == 0)
+ group = pcli->pfnRemoveItemFromGroup(hwnd, group, cc, 0);
else {
- group = group->cl.items[group->scanIndex]->group;
+ group = cc->group;
group->scanIndex = 0;
}
continue;
@@ -350,8 +352,8 @@ int GetNewSelection(ClcGroup *group, int selection, int direction)
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;
}
@@ -364,8 +366,9 @@ int GetNewSelection(ClcGroup *group, int selection, int direction)
if (!direction && 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;
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP && (cc->group->expanded)) {
+ group = cc->group;
group->scanIndex = 0;
continue;
}
@@ -448,11 +451,9 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly)
count += group->cl.count;
continue;
}
- else if ((cc->type == CLCIT_CONTACT) &&
- (cc->subcontacts != NULL) &&
- ((cc->bSubExpanded || (!visibleOnly)))) {
- count += group->cl.items[group->scanIndex]->iSubAllocated;
- }
+ if (cc->type == CLCIT_CONTACT && cc->subcontacts != NULL && (cc->bSubExpanded || !visibleOnly))
+ count += cc->iSubAllocated;
+
group->scanIndex++;
}
return count;
@@ -487,6 +488,7 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
searchResult = _tcsstr(lowered_name, lowered_search) ? 0 : 1;
}
+
if (pdnce && g_CluiData.bFilterEffective && dat != NULL && !dat->force_in_dialog) {
if (szProto == NULL)
szProto = GetContactProto(hContact);
@@ -500,11 +502,13 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
return 0 | searchResult;
}
}
+
// check the proto, use it as a base filter result for all further checks
if (g_CluiData.bFilterEffective & CLVM_FILTER_PROTOS) {
mir_snprintf(szTemp, "%s|", szProto);
filterResult = strstr(g_CluiData.protoFilter, szTemp) ? 1 : 0;
}
+
if (g_CluiData.bFilterEffective & CLVM_FILTER_GROUPS) {
if (!db_get_ts(hContact, "CList", "Group", &dbv)) {
mir_sntprintf(szGroupMask, _T("%s|"), &dbv.ptszVal[0]);
@@ -516,10 +520,12 @@ int __fastcall CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, Clc
else
filterResult = (g_CluiData.filterFlags & CLVM_PROTOGROUP_OP) ? filterResult : filterResult & 0;
}
+
if (g_CluiData.bFilterEffective & CLVM_FILTER_STATUS) {
WORD wStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
filterResult = (g_CluiData.filterFlags & CLVM_GROUPSTATUS_OP) ? ((filterResult | ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0))) : (filterResult & ((1 << (wStatus - ID_STATUS_OFFLINE)) & g_CluiData.statusMaskFilter ? 1 : 0));
}
+
if (g_CluiData.bFilterEffective & CLVM_FILTER_LASTMSG) {
if (pdnce->dwLastMsgTime != -1) {
DWORD now = g_CluiData.t_now;
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp
index 0edbb82ae8..0f21a91832 100644
--- a/plugins/Clist_modern/src/modern_clcmsgs.cpp
+++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp
@@ -184,14 +184,14 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wP
for (tgroup = group; tgroup; tgroup = tgroup->parent)
pcli->pfnSetGroupExpand(hwnd, dat, tgroup, 1);
- if (!contact->nSubContacts) {
+ if (!contact->iSubNumber) {
index = List_IndexOf((SortedList*)&group->cl, contact);
mainindex = index;
}
else {
index = List_IndexOf((SortedList*)&group->cl, contact->subcontacts);
mainindex = index;
- index += contact->nSubContacts;
+ index += contact->iSubNumber;
}
BYTE k = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT);
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp
index 8c759b9af4..a910fb0ea8 100644
--- a/plugins/Clist_modern/src/modern_clcpaint.cpp
+++ b/plugins/Clist_modern/src/modern_clcpaint.cpp
@@ -554,13 +554,13 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask(ClcGroup *group, ClcContac
case CLCIT_CONTACT:
{
ClcContact *mCont = Drawing;
- if (Drawing->nSubContacts) {
+ if (Drawing->iSubNumber) {
_AddParamShort(mpModernMask, hi_Type, hi_SubContact);
- if (Drawing->nSubContacts == 1 && Drawing->subcontacts->iSubAllocated == 1)
+ if (Drawing->iSubNumber == 1 && Drawing->subcontacts->iSubAllocated == 1)
_AddParamShort(mpModernMask, hi_SubPos, hi_First_Single);
- else if (Drawing->nSubContacts == 1)
+ else if (Drawing->iSubNumber == 1)
_AddParamShort(mpModernMask, hi_SubPos, hi_First);
- else if (Drawing->nSubContacts == Drawing->subcontacts->iSubAllocated)
+ else if (Drawing->iSubNumber == Drawing->subcontacts->iSubAllocated)
_AddParamShort(mpModernMask, hi_SubPos, hi_Last);
else
_AddParamShort(mpModernMask, hi_SubPos, hi_Middle);
@@ -1323,7 +1323,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
case TC_EXTRA:
if (Drawing->type == CLCIT_CONTACT &&
- (!Drawing->nSubContacts || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
+ (!Drawing->iSubNumber || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
int BlendedInActiveState = dat->dbbBlendInActiveState;
int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50;
int count = 0;
@@ -1375,7 +1375,7 @@ void CLCPaint::_PaintRowItemsEx(HDC hdcMem, ClcData *dat, ClcContact *Drawing, R
case TC_EXTRA7:
case TC_EXTRA8:
case TC_EXTRA9:
- if (Drawing->type == CLCIT_CONTACT && (!Drawing->nSubContacts || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
+ if (Drawing->type == CLCIT_CONTACT && (!Drawing->iSubNumber || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) {
int eNum = gl_RowTabAccess[i]->type - TC_EXTRA1;
if (eNum < dat->extraColumnsCount) {
if (Drawing->iExtraImage[eNum] != EMPTY_EXTRA_ICON) {
@@ -2160,7 +2160,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT
case ITEM_EXTRA_ICONS: //////////////////////////////////////////////////////////////////////////////////////////////
// Draw extra icons
- if (!Drawing->nSubContacts || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0) {
+ if (!Drawing->iSubNumber || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0) {
int iImage;
int count = 0;
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp
index 1899349d80..a18420734d 100644
--- a/plugins/Clist_modern/src/modern_clcutils.cpp
+++ b/plugins/Clist_modern/src/modern_clcutils.cpp
@@ -67,9 +67,9 @@ int cliHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **conta
if (flags) *flags |= CLCHT_NOWHERE | CLCHT_BELOWITEMS;
return -1;
}
+
if (contact) *contact = hitcontact;
if (group) *group = hitgroup;
- /////////
if (((testx < hitcontact->pos_indent) && !dat->text_rtl) || ((testx>clRect.right - hitcontact->pos_indent) && dat->text_rtl)) {
if (flags) *flags |= CLCHT_ONITEMINDENT;
@@ -252,7 +252,7 @@ void cliBeginRenameSelection(HWND hwnd, ClcData *dat)
return;
int indent, subindent;
- if (contact->type == CLCIT_CONTACT && contact->nSubContacts)
+ if (contact->type == CLCIT_CONTACT && contact->iSubNumber)
subindent = dat->subIndent;
else
subindent = 0;
@@ -411,7 +411,7 @@ int GetDropTargetInformation(HWND hwnd, ClcData *dat, POINT pt)
if (!mir_strcmp(contact->proto, META_PROTO))
return DROPTARGET_ONMETACONTACT;
- if (contact->nSubContacts)
+ if (contact->iSubNumber)
return DROPTARGET_ONSUBCONTACT;
return DROPTARGET_ONCONTACT;
}
@@ -663,72 +663,73 @@ int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
{
ClcGroup *group = &dat->list;
int testlen = (int)mir_tstrlen(text);
- ClcContact *contact = NULL;
int SubCount = 0;
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;
}
- contact = group->cl.items[group->scanIndex];
- if (contact->type != CLCIT_DIVIDER) {
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type != CLCIT_DIVIDER) {
bool found;
if (dat->bFilterSearch) {
- TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(contact->szText));
+ TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(cc->szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
found = _tcsstr(lowered_szText, lowered_text) != NULL;
}
- else found = (prefixOk && !_tcsnicmp(text, contact->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, contact->szText));
+ else found = (prefixOk && !_tcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText));
if (found) {
- ClcGroup *contactGroup = group;
- int contactScanIndex = group->scanIndex;
+ ClcGroup *ccGroup = group;
+ int ccScanIndex = group->scanIndex;
for (; group; group = group->parent)
pcli->pfnSetGroupExpand(hwnd, dat, group, 1);
- return pcli->pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex + SubCount);
+ return pcli->pfnGetRowsPriorTo(&dat->list, ccGroup, ccScanIndex + SubCount);
}
- 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;
SubCount = 0;
continue;
}
}
}
- if (contact->type == CLCIT_CONTACT && contact->iSubAllocated) {
- if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || contact->bSubExpanded) {
- int i = 0;
- for (i = 0; i < contact->iSubAllocated; i++) {
- ClcContact *subcontact = &(contact->subcontacts[i]);
+
+ if (cc->type == CLCIT_CONTACT && cc->iSubAllocated) {
+ if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || cc->bSubExpanded) {
+ for (int i = 0; i < cc->iSubAllocated; i++) {
+ const ClcContact &ccSub = cc->subcontacts[i];
bool found;
if (dat->bFilterSearch) {
- TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(subcontact->szText));
+ TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(ccSub.szText));
TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
found = _tcsstr(lowered_szText, lowered_text) != NULL;
}
- else found = (prefixOk && !_tcsnicmp(text, subcontact->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, subcontact->szText));
+ else found = (prefixOk && !_tcsnicmp(text, ccSub.szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, ccSub.szText));
if (found) {
- ClcGroup *contactGroup = group;
- int contactScanIndex = group->scanIndex;
+ ClcGroup *ccGroup = group;
+ int ccScanIndex = group->scanIndex;
for (; group; group = group->parent)
pcli->pfnSetGroupExpand(hwnd, dat, group, 1);
- if (!contact->bSubExpanded)
- ExpandMetaContact(hwnd, contact, dat);
- return pcli->pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex + SubCount + i + 1);
+ if (!cc->bSubExpanded)
+ ExpandMetaContact(hwnd, cc, dat);
+ return pcli->pfnGetRowsPriorTo(&dat->list, ccGroup, ccScanIndex + SubCount + i + 1);
}
}
}
}
- if (contact->type == CLCIT_CONTACT && contact->iSubAllocated && contact->bSubExpanded)
- SubCount += contact->iSubAllocated;
+
+ if (cc->type == CLCIT_CONTACT && cc->iSubAllocated && cc->bSubExpanded)
+ SubCount += cc->iSubAllocated;
group->scanIndex++;
}
return -1;
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
index 38d843c130..fbd3362f7e 100644
--- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
+++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp
@@ -199,7 +199,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item)
case TC_EXTRA: // Draw extra icons
if (contact->type == CLCIT_CONTACT &&
- (!contact->nSubContacts || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) {
+ (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) {
BOOL hasExtra = FALSE;
int width = 0;
for (int k = 0; k < dat->extraColumnsCount; k++)
@@ -225,7 +225,7 @@ int RowHeight_CalcRowHeight(ClcData *dat, ClcContact *contact, int item)
case TC_EXTRA8:
case TC_EXTRA9:
if (contact->type == CLCIT_CONTACT &&
- (!contact->nSubContacts || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) {
+ (!contact->iSubNumber || db_get_b(NULL, "CLC", "MetaHideExtra", SETTING_METAHIDEEXTRA_DEFAULT) == 0 && dat->extraColumnsCount > 0)) {
int eNum = pCell->type - TC_EXTRA1;
if (eNum < dat->extraColumnsCount)
if (contact->iExtraImage[eNum] != EMPTY_EXTRA_ICON || !dat->MetaIgnoreEmptyExtra) {
@@ -413,15 +413,15 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd)
RowHeights_Clear(dat);
- while (TRUE) {
+ while (true) {
int subident;
ClcContact *Drawing;
if (subindex == -1) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- indent--;
- if (group == NULL) break; // Finished list
+ if ((group = group->parent) == NULL)
+ break;
group->scanIndex++;
+ indent--;
continue;
}
@@ -431,7 +431,7 @@ void RowHeights_CalcRowHeights(ClcData *dat, HWND hwnd)
}
else {
// Get item to draw
- Drawing = &(group->cl.items[group->scanIndex]->subcontacts[subindex]);
+ Drawing = &group->cl.items[group->scanIndex]->subcontacts[subindex];
subident = dat->subIndent;
}
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp
index 5bcbdfd9ad..a73a0827e2 100644
--- a/plugins/Clist_nicer/src/clcitems.cpp
+++ b/plugins/Clist_nicer/src/clcitems.cpp
@@ -199,15 +199,18 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat)
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;
}
- 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);
+
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->type == CLCIT_GROUP) {
+ if (cc->group->cl.count == 0)
+ group = pcli->pfnRemoveItemFromGroup(hwnd, group, cc, 0);
else {
- group = group->cl.items[group->scanIndex]->group;
+ group = cc->group;
group->scanIndex = 0;
}
continue;
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp
index 2a17249a7e..e79d0838b4 100644
--- a/plugins/Clist_nicer/src/clcpaint.cpp
+++ b/plugins/Clist_nicer/src/clcpaint.cpp
@@ -1423,17 +1423,18 @@ bgdone:
g_list_avatars = 0;
while (true) {
if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL) break; // Finished list
+ if ((group = group->parent) == NULL)
+ break;
group->scanIndex++;
continue;
}
- if (group->cl.items[group->scanIndex]->cFlags & ECF_AVATAR)
+ ClcContact *cc = group->cl.items[group->scanIndex];
+ if (cc->cFlags & ECF_AVATAR)
g_list_avatars++;
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) {
- group = group->cl.items[group->scanIndex]->group;
+ if (cc->type == CLCIT_GROUP && (cc->group->expanded)) {
+ group = cc->group;
group->scanIndex = 0;
continue;
}
@@ -1443,33 +1444,32 @@ bgdone:
group = &dat->list;
group->scanIndex = 0;
- int indent = 0;
+ 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;
}
line_num++;
+ ClcContact *cc = group->cl.items[group->scanIndex];
if (cfg::dat.bForceRefetchOnPaint)
- group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry*) - 1;
+ cc->ace = (struct avatarCacheEntry*) - 1;
if (y > rcPaint->top - dat->row_heights[line_num] && y <= rcPaint->bottom) {
- if (group->cl.items[group->scanIndex]->ace == (struct avatarCacheEntry*) - 1)
- group->cl.items[group->scanIndex]->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)group->cl.items[group->scanIndex]->hContact, 0);
- RowHeight::getRowHeight(dat, group->cl.items[group->scanIndex], line_num, style);
- PaintItem(hdcMem, group, group->cl.items[group->scanIndex], indent, y, dat, index, hwnd, style, &clRect, &bFirstNGdrawn, groupCountsFontTopShift, dat->row_heights[line_num]);
+ if (cc->ace == (struct avatarCacheEntry*) - 1)
+ cc->ace = (struct avatarCacheEntry *)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)cc->hContact, 0);
+ RowHeight::getRowHeight(dat, cc, line_num, style);
+ PaintItem(hdcMem, group, cc, indent, y, dat, index, hwnd, style, &clRect, &bFirstNGdrawn, groupCountsFontTopShift, dat->row_heights[line_num]);
}
index++;
y += dat->row_heights[line_num];
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && (group->cl.items[group->scanIndex]->group->expanded)) {
- group = group->cl.items[group->scanIndex]->group;
+ if (cc->type == CLCIT_GROUP && (cc->group->expanded)) {
+ group = cc->group;
indent++;
group->scanIndex = 0;
continue;
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;
}