summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-20 20:20:22 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-20 20:20:22 +0300
commit605e2d465d21cfb1379d528a1ef07606335ca4de (patch)
treee5a3d8aa0612b3f114537366a9befd11f67c3060
parente51039fa9d1626a504ee44d9c8b9c739d71fdeb7 (diff)
code cleaning
-rw-r--r--src/mir_app/src/clcitems.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index b8626f0625..48483f3c72 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -224,43 +224,38 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
if (szProto != nullptr)
status = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- int i;
- uint32_t groupFlags;
ClcGroup *group;
- ptrW tszGroup(Clist_GetGroup(hContact));
- if (tszGroup == nullptr)
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ if (wszGroup == nullptr)
group = &dat->list;
else {
- group = g_clistApi.pfnAddGroup(hwnd, dat, tszGroup, (uint32_t)-1, 0, 0);
+ group = g_clistApi.pfnAddGroup(hwnd, dat, wszGroup, (uint32_t)-1, 0, 0);
if (group == nullptr) {
+ MGROUP hGroup = Clist_GroupCreate(NULL, wszGroup);
+
if (!(style & CLS_HIDEEMPTYGROUPS))
return;
+ uint32_t groupFlags;
if (checkHideOffline && Clist_IsHiddenMode(dat, status)) {
- for (i = 1;; i++) {
- wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
- if (szGroupName == nullptr)
- return;
-
- if (!mir_wstrcmp(szGroupName, tszGroup))
- break;
- }
+ Clist_GroupGetName(hGroup, &groupFlags);
if (groupFlags & GROUPF_HIDEOFFLINE)
return;
}
- for (i = 1;; i++) {
+
+ for (MGROUP i = 1;; i++) {
wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == nullptr)
return;
- if (!mir_wstrcmp(szGroupName, tszGroup))
+ if (!mir_wstrcmp(szGroupName, wszGroup))
break;
size_t len = mir_wstrlen(szGroupName);
- if (!wcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\')
+ if (!wcsncmp(szGroupName, wszGroup, len) && wszGroup[len] == '\\')
g_clistApi.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
- group = g_clistApi.pfnAddGroup(hwnd, dat, tszGroup, groupFlags, i, 1);
+ group = g_clistApi.pfnAddGroup(hwnd, dat, wszGroup, groupFlags, hGroup, 1);
}
}