summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-05-20 10:40:38 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-05-20 10:40:38 +0000
commit5b55ebfcc6a6835c17b90bebcf4395b82b937d04 (patch)
tree3c9ec25667ed5a8df32e472c26d94995bbe2c4e7
parentc44d4835faed14e31a1e531537c30398ce9e7e0c (diff)
fixes #1242 (Clist_modern's cache changes related bugs)
git-svn-id: http://svn.miranda-ng.org/main/trunk@16857 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--include/m_clistint.h1
-rw-r--r--plugins/Clist_modern/src/modern_clc.cpp9
-rw-r--r--src/mir_app/src/clc.cpp54
3 files changed, 60 insertions, 4 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h
index 4d30d4e23c..b8afd7e7f8 100644
--- a/include/m_clistint.h
+++ b/include/m_clistint.h
@@ -50,6 +50,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define INTM_NAMECHANGED (WM_USER+10)
#define INTM_ICONCHANGED (WM_USER+11)
#define INTM_GROUPCHANGED (WM_USER+12)
+#define INTM_GROUPSCHANGED (WM_USER+13)
#define INTM_CONTACTADDED (WM_USER+14)
#define INTM_CONTACTDELETED (WM_USER+15)
#define INTM_HIDDENCHANGED (WM_USER+16)
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp
index 36462ff35a..5cf0d6f8ba 100644
--- a/plugins/Clist_modern/src/modern_clc.cpp
+++ b/plugins/Clist_modern/src/modern_clc.cpp
@@ -67,9 +67,10 @@ static int clcHookProtoAck(WPARAM, LPARAM lParam)
static int clcHookIconsChanged(WPARAM, LPARAM)
{
- int i;
- if (MirandaExiting()) return 0;
- for (i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
+ if (MirandaExiting())
+ return 0;
+
+ for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
g_pAvatarOverlayIcons[i].listID = -1;
g_pStatusOverlayIcons[i].listID = -1;
}
@@ -78,7 +79,7 @@ static int clcHookIconsChanged(WPARAM, LPARAM)
ImageList_Destroy(hAvatarOverlays);
hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, _countof(g_pAvatarOverlayIcons) * 2, 1);
- for (i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
+ for (int i = 0; i < _countof(g_pAvatarOverlayIcons); i++) {
HICON hIcon = IcoLib_GetIcon(g_pAvatarOverlayIcons[i].name);
g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon);
IcoLib_Release(g_pAvatarOverlayIcons[i].name);
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index 7a5b558588..fd34ede385 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -64,6 +64,11 @@ void fnClcOptionsChanged(void)
static int ClcSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
+ if (hContact == NULL) {
+ if (!strcmp(cws->szModule, "CListGroups"))
+ cli.pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ return 0;
+ }
if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "MyHandle")) {
@@ -370,6 +375,55 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
case WM_GETFONT:
return (LRESULT)dat->fontInfo[FONTID_CONTACTS].hFont;
+ case INTM_GROUPSCHANGED:
+ {
+ DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
+ if (dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8) {
+ int groupId = atoi(dbcws->szSetting) + 1;
+ TCHAR szFullName[512];
+ int i, eq;
+ //check name of group and ignore message if just being expanded/collapsed
+ if (cli.pfnFindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) {
+ mir_tstrcpy(szFullName, contact->szText);
+ while (group->parent) {
+ for (i = 0; i < group->parent->cl.count; i++)
+ if (group->parent->cl.items[i]->group == group)
+ break;
+ if (i == group->parent->cl.count) {
+ szFullName[0] = '\0';
+ break;
+ }
+ group = group->parent;
+ size_t nameLen = mir_tstrlen(group->cl.items[i]->szText);
+ if (mir_tstrlen(szFullName) + 1 + nameLen > _countof(szFullName)) {
+ szFullName[0] = '\0';
+ break;
+ }
+ memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(mir_tstrlen(szFullName) + 1));
+ memcpy(szFullName, group->cl.items[i]->szText, sizeof(TCHAR)*nameLen);
+ szFullName[nameLen] = '\\';
+ }
+
+ if (dbcws->value.type == DBVT_ASCIIZ) {
+ WCHAR* wszGrpName = mir_a2u(dbcws->value.pszVal + 1);
+ eq = !mir_tstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
+ }
+ else {
+ char* szGrpName = NEWSTR_ALLOCA(dbcws->value.pszVal + 1);
+ WCHAR* wszGrpName;
+ Utf8Decode(szGrpName, &wszGrpName);
+ eq = !mir_tstrcmp(szFullName, wszGrpName);
+ mir_free(wszGrpName);
+ }
+ if (eq && (contact->group->hideOffline != 0) == ((dbcws->value.pszVal[0] & GROUPF_HIDEOFFLINE) != 0))
+ break; //only expanded has changed: no action reqd
+ }
+ }
+ cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ }
+ break;
+
case INTM_NAMEORDERCHANGED:
cli.pfnInitAutoRebuild(hwnd);
break;