diff options
-rw-r--r-- | protocols/ICQ-WIM/src/userinfo.cpp | 1 | ||||
-rw-r--r-- | src/core/stduserinfo/src/userinfo.cpp | 25 |
2 files changed, 15 insertions, 11 deletions
diff --git a/protocols/ICQ-WIM/src/userinfo.cpp b/protocols/ICQ-WIM/src/userinfo.cpp index 6265dc6a4a..63d5631566 100644 --- a/protocols/ICQ-WIM/src/userinfo.cpp +++ b/protocols/ICQ-WIM/src/userinfo.cpp @@ -55,6 +55,7 @@ int CIcqProto::OnUserInfoInit(WPARAM wParam, LPARAM hContact) uip.flags = ODPF_UNICODE | ODPF_USERINFOTAB | ODPF_DONTTRANSLATE | ODPF_ICON; uip.dwInitParam = (LPARAM)Skin_GetProtoIcon(m_szModuleName, ID_STATUS_ONLINE); uip.szTitle.w = L"ICQ"; + uip.szGroup.w = m_tszUserName; uip.position = -1900000000; uip.pDialog = new IcqUserInfoDlg(this); g_plugin.addUserInfo(wParam, &uip); diff --git a/src/core/stduserinfo/src/userinfo.cpp b/src/core/stduserinfo/src/userinfo.cpp index 109fd6bbbf..f2ef8788bd 100644 --- a/src/core/stduserinfo/src/userinfo.cpp +++ b/src/core/stduserinfo/src/userinfo.cpp @@ -129,19 +129,22 @@ class CUserInfoDlg : public CDlgBase if (items.getCount() == 0)
return;
- HTREEITEM hParent;
- {
- TVINSERTSTRUCT tvis = {};
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.lParam = (LPARAM)items[0];
- tvis.item.iImage = tvis.item.iSelectedImage = iFolderImage;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
- tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
- tvis.item.pszText = pwszRoot;
- hParent = m_tree.InsertItem(&tvis);
- }
+ HTREEITEM hParent = nullptr;
+ const wchar_t *pwszPrevGroup = nullptr;
for (auto &it : items) {
+ if (hParent == nullptr || (!hContact && mir_wstrcmp(pwszPrevGroup, it->pwszGroup))) {
+ TVINSERTSTRUCT tvis = {};
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.lParam = (LPARAM)it;
+ tvis.item.iImage = tvis.item.iSelectedImage = iFolderImage;
+ tvis.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
+ tvis.item.state = tvis.item.stateMask = TVIS_EXPANDED;
+ tvis.item.pszText = (it->pwszGroup == 0) ? pwszRoot : it->pwszGroup;
+ hParent = m_tree.InsertItem(&tvis);
+ pwszPrevGroup = it->pwszGroup;
+ }
+
int iImage = 1;
if ((it->dwFlags & ODPF_ICON) && it->lParam) {
HICON hIcon = IcoLib_GetIconByHandle((HANDLE)it->lParam);
|