summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/clist/clc.cpp15
-rw-r--r--src/modules/clist/clc.h1
-rw-r--r--src/modules/clist/clcmsgs.cpp11
-rw-r--r--src/modules/clist/clistcore.cpp1
-rw-r--r--src/modules/clist/clistsettings.cpp2
-rw-r--r--src/modules/clist/cluiservices.cpp2
6 files changed, 21 insertions, 11 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 0592f10ffb..7d44e89fc8 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -33,7 +33,7 @@ void UninitCustomMenus(void);
void MTG_OnmodulesLoad(void);
-static BOOL bModuleInitialized = FALSE;
+static bool bModuleInitialized = false;
static HANDLE hClcWindowList;
static HANDLE hShowInfoTipEvent;
HANDLE hHideInfoTipEvent;
@@ -43,6 +43,12 @@ int g_IconWidth, g_IconHeight;
void FreeDisplayNameCache(void);
+void fnInitAutoRebuild(HWND hWnd)
+{
+ if (!cli.bAutoRebuild && hWnd)
+ cli.bAutoRebuild = PostMessage(hWnd, CLM_AUTOREBUILD, 0, 0) != 0;
+}
+
void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam)
{
WindowList_Broadcast(hClcWindowList, msg, wParam, lParam);
@@ -208,7 +214,7 @@ static void SortClcByTimer(HWND hwnd)
int LoadCLCModule(void)
{
- bModuleInitialized = TRUE;
+ bModuleInitialized = true;
g_IconWidth = GetSystemMetrics(SM_CXSMICON);
g_IconHeight = GetSystemMetrics(SM_CYSMICON);
@@ -236,7 +242,8 @@ int LoadCLCModule(void)
void UnloadClcModule()
{
- if (!bModuleInitialized) return;
+ if (!bModuleInitialized)
+ return;
for (int i = 0; i < arEvents.getCount(); i++)
UnhookEvent(arEvents[i]);
@@ -442,7 +449,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
case INTM_NAMEORDERCHANGED:
- PostMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(hwnd);
break;
case INTM_CONTACTADDED:
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h
index 179ba84c46..9bd95c3c9d 100644
--- a/src/modules/clist/clc.h
+++ b/src/modules/clist/clc.h
@@ -40,6 +40,7 @@ extern int g_IconWidth, g_IconHeight;
void fnClcOptionsChanged(void);
void fnClcBroadcast(int msg, WPARAM wParam, LPARAM lParam);
HMENU fnBuildGroupPopupMenu(ClcGroup* group);
+void fnInitAutoRebuild(HWND hWnd);
LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index 40ebec9b12..96738ab866 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -76,6 +76,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_AUTOREBUILD:
KillTimer(hwnd, TIMERID_REBUILDAFTER);
cli.pfnSaveStateAndRebuildList(hwnd, dat);
+ cli.bAutoRebuild = false;
break;
case CLM_DELETEITEM:
@@ -417,17 +418,17 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
else
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(hwnd);
break;
case CLM_SETHIDEOFFLINEROOT:
db_set_b(NULL, "CLC", "HideOfflineRoot", (BYTE) wParam);
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(hwnd);
break;
case CLM_SETINDENT:
dat->groupIndent = wParam;
- cli.pfnInvalidateRect(hwnd, NULL, FALSE);
+ cli.pfnInitAutoRebuild(hwnd);
break;
case CLM_SETITEMTEXT:
@@ -448,7 +449,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
case CLM_SETOFFLINEMODES:
dat->offlineModes = wParam;
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(hwnd);
break;
case CLM_SETSCROLLTIME:
@@ -466,7 +467,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_USEGROUPS);
else
SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_USEGROUPS);
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(hwnd);
break;
}
return 0;
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp
index 2daaad4e52..89f6770927 100644
--- a/src/modules/clist/clistcore.cpp
+++ b/src/modules/clist/clistcore.cpp
@@ -215,6 +215,7 @@ static INT_PTR srvRetrieveInterface(WPARAM, LPARAM)
cli.pfnGetContactIcon = fnGetContactIcon;
cli.pfnGetAverageMode = fnGetAverageMode;
+ cli.pfnInitAutoRebuild = fnInitAutoRebuild;
rc = LoadContactListModule2();
if (rc == 0)
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp
index c17e6e0d24..d981d9e97f 100644
--- a/src/modules/clist/clistsettings.cpp
+++ b/src/modules/clist/clistsettings.cpp
@@ -91,7 +91,7 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact)
{
if (hContact == INVALID_CONTACT_ID) {
FreeDisplayNameCache();
- SendMessage(cli.hwndContactTree, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(cli.hwndContactTree);
}
else {
int idx = clistCache.getIndex((ClcCacheEntry*)&hContact);
diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp
index 02f1a0485c..50ef0e2953 100644
--- a/src/modules/clist/cluiservices.cpp
+++ b/src/modules/clist/cluiservices.cpp
@@ -103,7 +103,7 @@ static INT_PTR ListEndRebuild(WPARAM, LPARAM)
rebuild = 1;
}
if (rebuild)
- SendMessage(cli.hwndContactTree, CLM_AUTOREBUILD, 0, 0);
+ cli.pfnInitAutoRebuild(cli.hwndContactTree);
return 0;
}