diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-19 18:42:19 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-19 18:42:19 +0000 |
commit | 3d3a8bb209b190732f8530f3dc5b2baa46d3078e (patch) | |
tree | 28afcae563cff29fdd686e1a4874bda0f6aee801 | |
parent | d67f238b33aa9fae3e877dc579ac9260323219fe (diff) |
fix against recursions in clists
git-svn-id: http://svn.miranda-ng.org/main/trunk@8664 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
23 files changed, 273 insertions, 355 deletions
diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index 71e22c8273..cac3aa3c3d 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -487,6 +487,7 @@ type currentStatusMenuItem : int;
currentDesiredStatusMode : int;
bDisplayLocked : bool;
+ bAutoRebuild : bool;
pfnGetProtocolMenu : function (_para1:PAnsiChar):HGENMENU; cdecl;
pfnStub2 : function (_para1:int):int; cdecl;
@@ -545,9 +546,10 @@ type * Miranda NG additions
*************************************************************************************)
- pfnGetContactIcon: function(hContact:TMCONTACT):int; cdecl;
- pfnTrayCalcChanged:function(szChangedProto:PAnsiChar; averageMode:int; iProtoCount:int):int; cdecl;
+ pfnGetContactIcon: function(hContact:TMCONTACT):int; cdecl;
+ pfnTrayCalcChanged:function(szChangedProto:PAnsiChar; averageMode:int; iProtoCount:int):int; cdecl;
pfnGetAverageMode:function(pNetProtoCount:pint):int; cdecl;
+ pfnInitAutoRebuild:procedure(hwnd:HWND); cdecl;
end;
{
diff --git a/include/m_clistint.h b/include/m_clistint.h index 307d7fd0f2..3f754715bd 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -422,7 +422,7 @@ typedef struct HANDLE hPreBuildStatusMenuEvent;
int currentStatusMenuItem, currentDesiredStatusMode;
- BOOL bDisplayLocked;
+ BOOL bDisplayLocked, bAutoRebuild;
HGENMENU (*pfnGetProtocolMenu)(const char*);
int (*pfnStub2)(int);
@@ -479,7 +479,7 @@ typedef struct int (*pfnGetContactIcon)(MCONTACT hContact);
int (*pfnTrayCalcChanged)(const char *szChangedProto, int averageMode, int iProtoCount);
int (*pfnGetAverageMode)(int *pNetProtoCount);
-
+ void (*pfnInitAutoRebuild)(HWND hwnd);
}
CLIST_INTERFACE;
diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 75386a571d..07d0d510a7 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -275,16 +275,6 @@ void pdnce___SetStatus( ClcCacheEntry *pdnce, WORD wStatus ); /* move to list module */
typedef void (*ItemDestuctor)(void*);
-template <class T> class INIT : public T
-{
-public:
- INIT()
- {
- memset(this, 0, sizeof(T));
- this->cbSize=sizeof(T);
- }
-};
-
#ifdef __cplusplus
const ROWCELL * rowAddCell(ROWCELL* &, int );
void rowDeleteTree(ROWCELL *cell);
diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 65b08b6443..7c0cea9fab 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -23,7 +23,6 @@ extern CLIST_INTERFACE corecli; //Global variables
extern int ON_SETALLEXTRAICON_CYCLE;
-extern BOOL CLM_AUTOREBUILD_WAS_POSTED;
extern FRAMEWND *g_pfwFrames;
extern int g_nFramesCount;
extern RECT g_rcEdgeSizingRect;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 9f4bf199dd..efc8646734 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -439,22 +439,18 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP pcli->pfnBeginRenameSelection(hwnd, dat);
return 0;
case POPUP_DELETEGROUP:
- if (contact->type != CLCIT_GROUP)
- return 0;
- CallService(MS_CLIST_GROUPDELETE, contact->groupId, 0);
+ if (contact->type == CLCIT_GROUP)
+ CallService(MS_CLIST_GROUPDELETE, contact->groupId, 0);
return 0;
case POPUP_GROUPSHOWOFFLINE:
- if (contact->type != CLCIT_GROUP)
- return 0;
- CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId,
- MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
- pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ if (contact->type == CLCIT_GROUP) {
+ CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE));
+ pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
+ }
return 0;
case POPUP_GROUPHIDEOFFLINE:
- if (contact->type != CLCIT_GROUP)
- return 0;
- CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId,
- MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
+ if (contact->type == CLCIT_GROUP)
+ CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE));
return 0;
}
@@ -1687,7 +1683,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM }
if (db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOOFLINETOROOT_DEFAULT))
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ pcli->pfnInitAutoRebuild(hwnd);
else {
pcli->pfnSortContacts();
PostMessage(hwnd, INTM_INVALIDATE, 0, 0);
diff --git a/plugins/Clist_modern/src/modern_clcidents.cpp b/plugins/Clist_modern/src/modern_clcidents.cpp index e59870b5f3..85d3e3e969 100644 --- a/plugins/Clist_modern/src/modern_clcidents.cpp +++ b/plugins/Clist_modern/src/modern_clcidents.cpp @@ -113,10 +113,8 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro {
int index = 0, i;
int nowVisible = 1;
- ClcGroup *group;
-
- group = &dat->list;
+ ClcGroup *group = &dat->list;
group->scanIndex = 0;
group = &dat->list;
@@ -124,12 +122,12 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro if (group->scanIndex == group->cl.count) {
ClcGroup *tgroup;
group = group->parent;
- if (group == NULL) break;
+ if (group == NULL)
+ break;
+
nowVisible = 1;
- for (tgroup = group;tgroup;tgroup = tgroup->parent)
- {
- if (!tgroup->expanded)
- {
+ for (tgroup = group; tgroup; tgroup = tgroup->parent) {
+ if (!tgroup->expanded) {
nowVisible = 0;
break;
}
@@ -161,24 +159,12 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro return 1;
}
- if (!isIgnoreSubcontacts && IsHContactContact(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->SubAllocated > 0)
- {
- for (i=0; i < group->cl.items[group->scanIndex]->SubAllocated; i++)
- {
- if (group->cl.items[group->scanIndex]->subcontacts[i].hContact == dwItem)
- {
-#ifdef _DEBUG
- if (IsBadWritePtr(&group->cl.items[group->scanIndex]->subcontacts[i], sizeof(ClcContact)))
- {
- log1("FindIltem->IsBadWritePtr | 2o [%08x]", &group->cl.items[group->scanIndex]->subcontacts[i]);
- PostMessage(hwnd,CLM_AUTOREBUILD, 0, 0);
- return 0;
- }
-#endif
+ if (!isIgnoreSubcontacts && IsHContactContact(dwItem) && group->cl.items[group->scanIndex]->type == CLCIT_CONTACT && group->cl.items[group->scanIndex]->SubAllocated > 0) {
+ for (i = 0; i < group->cl.items[group->scanIndex]->SubAllocated; i++) {
+ if (group->cl.items[group->scanIndex]->subcontacts[i].hContact == dwItem) {
if (contact) *contact = &group->cl.items[group->scanIndex]->subcontacts[i];
if (subgroup) *subgroup = group;
-
return 1;
}
}
@@ -201,73 +187,68 @@ int FindItem(HWND hwnd, ClcData *dat, DWORD dwItem, ClcContact **contact, ClcGro void ClearRowByIndexCache()
{
- if (!CacheIndexClear)
- {
+ if (!CacheIndexClear) {
memset(CacheIndex, 0, sizeof(CacheIndex));
CacheIndexClear = TRUE;
- };
+ }
}
+
int cliGetRowByIndex(ClcData *dat,int testindex,ClcContact **contact,ClcGroup **subgroup)
{
int index = 0, i;
ClcGroup *group = &dat->list;
if (testindex < 0) return (-1);
- {
- group->scanIndex = 0;
- for (;;) {
- if (group->scanIndex == group->cl.count) {
- group = group->parent;
- if (group == NULL) break;
- group->scanIndex++;
- continue;
- }
- if ((index>0) && (index < CacheArrSize))
- {
- CacheIndex[index] = group;
- CacheIndexClear = FALSE;
- };
-
- if (testindex == index) {
- if (contact) *contact = group->cl.items[group->scanIndex];
- if (subgroup) *subgroup = group;
- return index;
- }
- if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT)
- if (group->cl.items[group->scanIndex]->SubAllocated)
- if (group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta)
- {
- for (i=0; i < group->cl.items[group->scanIndex]->SubAllocated; i++)
- {
- if ((index>0) && (index < CacheArrSize))
- {
- CacheIndex[index] = group;
- CacheIndexClear = FALSE;
- };
- index++;
- if (testindex == index) {
- if (contact)
- {
- *contact = &group->cl.items[group->scanIndex]->subcontacts[i];
- (*contact)->subcontacts = group->cl.items[group->scanIndex];
- }
+ group->scanIndex = 0;
+ for (;;) {
+ if (group->scanIndex == group->cl.count) {
+ group = group->parent;
+ if (group == NULL) break;
+ group->scanIndex++;
+ continue;
+ }
+
+ if (index > 0 && index < CacheArrSize) {
+ CacheIndex[index] = group;
+ CacheIndexClear = FALSE;
+ }
- if (subgroup) *subgroup = group;
- return index;
- }
- }
+ if (testindex == index) {
+ if (contact) *contact = group->cl.items[group->scanIndex];
+ if (subgroup) *subgroup = group;
+ return index;
+ }
+ if (group->cl.items[group->scanIndex]->type == CLCIT_CONTACT)
+ if (group->cl.items[group->scanIndex]->SubAllocated)
+ if (group->cl.items[group->scanIndex]->SubExpanded && dat->expandMeta) {
+ for (i = 0; i < group->cl.items[group->scanIndex]->SubAllocated; i++) {
+ if ((index>0) && (index < CacheArrSize)) {
+ CacheIndex[index] = group;
+ CacheIndexClear = FALSE;
+ }
+ index++;
+ if (testindex == index) {
+ if (contact) {
+ *contact = &group->cl.items[group->scanIndex]->subcontacts[i];
+ (*contact)->subcontacts = group->cl.items[group->scanIndex];
}
- index++;
- if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) {
- group = group->cl.items[group->scanIndex]->group;
- group->scanIndex = 0;
- continue;
- }
- group->scanIndex++;
+
+ if (subgroup) *subgroup = group;
+ return index;
+ }
+ }
+ }
+
+ index++;
+ if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP && group->cl.items[group->scanIndex]->group->expanded) {
+ group = group->cl.items[group->scanIndex]->group;
+ group->scanIndex = 0;
+ continue;
}
- };
+ group->scanIndex++;
+ }
return -1;
}
diff --git a/plugins/Clist_modern/src/modern_clcmsgs.cpp b/plugins/Clist_modern/src/modern_clcmsgs.cpp index 5a65694d73..5ea6fac23b 100644 --- a/plugins/Clist_modern/src/modern_clcmsgs.cpp +++ b/plugins/Clist_modern/src/modern_clcmsgs.cpp @@ -36,17 +36,17 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara switch(msg) {
case CLM_DELETEITEM:
pcli->pfnDeleteItemFromTree(hwnd, wParam);
- clcSetDelayTimer( TIMERID_DELAYEDRESORTCLC, hwnd, 1 ); //pcli->pfnSortCLC(hwnd, dat, 1);
- clcSetDelayTimer( TIMERID_RECALCSCROLLBAR, hwnd, 2 ); //pcli->pfnRecalcScrollBar(hwnd, dat);
+ clcSetDelayTimer(TIMERID_DELAYEDRESORTCLC, hwnd, 1); //pcli->pfnSortCLC(hwnd, dat, 1);
+ clcSetDelayTimer(TIMERID_RECALCSCROLLBAR, hwnd, 2); //pcli->pfnRecalcScrollBar(hwnd, dat);
return 0;
case CLM_AUTOREBUILD:
if (dat->force_in_dialog)
pcli->pfnSaveStateAndRebuildList(hwnd, dat);
- else {
- clcSetDelayTimer( TIMERID_REBUILDAFTER, hwnd );
- CLM_AUTOREBUILD_WAS_POSTED = FALSE;
- }
+ else
+ clcSetDelayTimer(TIMERID_REBUILDAFTER, hwnd);
+
+ pcli->bAutoRebuild = false;
return 0;
case CLM_SETFONT:
@@ -70,7 +70,7 @@ LRESULT cli_ProcessExternalMessages(HWND hwnd,ClcData *dat,UINT msg,WPARAM wPara SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) &~ CLS_HIDEEMPTYGROUPS);
BOOL newval = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
if (newval != old)
- SendMessage(hwnd,CLM_AUTOREBUILD, 0, 0);
+ pcli->pfnInitAutoRebuild(hwnd);
}
return 0;
diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index aa98df3946..36ad63b726 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -738,7 +738,7 @@ static INT_PTR CALLBACK DlgProcClistOpts(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, "CList", "PlaceOfflineToRoot", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_OFFLINETOROOT));
pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */
- SendMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0); /* force reshuffle */
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree); /* force reshuffle */
ClcOptionsChanged(); // Used to force loading avatar an list height related options
return TRUE;
}
@@ -888,7 +888,7 @@ static INT_PTR CALLBACK DlgProcTrayOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L pcli->pfnTrayIconIconsChanged();
pcli->pfnLoadContactTree(); /* this won't do job properly since it only really works when changes happen */
- SendMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0); /* force reshuffle */
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree); /* force reshuffle */
ClcOptionsChanged(); // Used to force loading avatar an list height related options
return TRUE;
}
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index 841244e6a4..35b49b5a0e 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -427,7 +427,7 @@ int EventArea_Create(HWND hCluiWnd) 0, 0, 0, h,hCluiWnd,NULL,g_hInst,NULL);
// register frame
- CLISTFrame Frame = { sizeof(CLISTFrame) };
+ CLISTFrame Frame = { sizeof(Frame) };
Frame.hWnd = g_CluiData.hwndEventFrame;
Frame.align = alBottom;
Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME);
diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 2fe657b50c..993eedc5a0 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -30,15 +30,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void InsertContactIntoTree(MCONTACT hContact,int status);
void CListSettings_FreeCacheItemDataOption( ClcCacheEntry *pDst, DWORD flag );
-int PostAutoRebuidMessage(HWND hwnd);
static int displayNameCacheSize;
LIST<ClcCacheEntry> clistCache(50, NumericKeySortT);
-BOOL CLM_AUTOREBUILD_WAS_POSTED = FALSE;
-char *GetProtoForContact(MCONTACT hContact);
-int GetStatusForContact(MCONTACT hContact,char *szProto);
-TCHAR *UnknownConctactTranslatedName = NULL;
+char* GetProtoForContact(MCONTACT hContact);
+int GetStatusForContact(MCONTACT hContact,char *szProto);
+TCHAR* UnknownConctactTranslatedName = NULL;
void InvalidateDNCEbyPointer(MCONTACT hContact,ClcCacheEntry *pdnce,int SettingType);
@@ -409,13 +407,13 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) InvalidateDNCEbyPointer(hContact, pdnce, cws->value.type);
if (!strcmp(cws->szSetting, "IsSubcontact"))
- PostMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
if (!mir_strcmp(cws->szSetting, "Status") || wildcmp(cws->szSetting, "Status?")) {
if (!mir_strcmp(cws->szModule, META_PROTO) && mir_strcmp(cws->szSetting, "Status")) {
int res = 0;
if (pcli->hwndContactTree && g_flag_bOnModulesLoadedCalled)
- res = PostAutoRebuidMessage(pcli->hwndContactTree);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
if ((db_get_w(NULL, "CList", "SecondLineType", SETTING_SECONDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE || db_get_w(NULL, "CList", "ThirdLineType", SETTING_THIRDLINE_TYPE_DEFAULT) == TEXT_STATUS_MESSAGE) && pdnce->hContact && pdnce->m_cache_cszProto)
amRequestAwayMsg(hContact);
@@ -482,13 +480,6 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) return 0;
}
-int PostAutoRebuidMessage(HWND hwnd)
-{
- if (!CLM_AUTOREBUILD_WAS_POSTED)
- CLM_AUTOREBUILD_WAS_POSTED = PostMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
- return CLM_AUTOREBUILD_WAS_POSTED;
-}
-
int OnLoadLangpack(WPARAM, LPARAM)
{
UnknownConctactTranslatedName = TranslateT("(Unknown Contact)");
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index cb51119ca8..e241b27d11 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -152,7 +152,7 @@ int CLUI::OnEvent_ModulesLoaded(WPARAM wParam, LPARAM lParam) SleepEx(0, TRUE);
g_flag_bOnModulesLoadedCalled = TRUE;
- SendMessage(pcli->hwndContactList,UM_CREATECLC, 0, 0); //$$$
+ SendMessage(pcli->hwndContactList, UM_CREATECLC, 0, 0); //$$$
InitSkinHotKeys();
g_CluiData.bSTATE = STATE_NORMAL;
ske_RedrawCompleteWindow();
@@ -163,7 +163,7 @@ int CLUI::OnEvent_FontReload(WPARAM wParam, LPARAM lParam) {
pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, wParam, lParam);
- g_CluiData.dwKeyColor = db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT);
+ g_CluiData.dwKeyColor = db_get_dw(NULL, "ModernSettings", "KeyColor", (DWORD)SETTING_KEYCOLOR_DEFAULT);
CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0);
return 0;
@@ -177,24 +177,24 @@ int CLUI::OnEvent_ContactMenuPreBuild(WPARAM wParam, LPARAM lParam) HWND hwndClist = GetFocus();
TCHAR cls[128];
GetClassName(hwndClist, cls, SIZEOF(cls));
- if ( lstrcmp( _T(CLISTCONTROL_CLASS), cls))
+ if (lstrcmp(_T(CLISTCONTROL_CLASS), cls))
hwndClist = pcli->hwndContactList;
MCONTACT hItem = (MCONTACT)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != 0);
- if (!hItem || !IsHContactContact(hItem) || !db_get_b(NULL,"CList","AvatarsShow",SETTINGS_SHOWAVATARS_DEFAULT)) {
+ if (!hItem || !IsHContactContact(hItem) || !db_get_b(NULL, "CList", "AvatarsShow", SETTINGS_SHOWAVATARS_DEFAULT)) {
Menu_ShowItem(hShowAvatarMenuItem, false);
Menu_ShowItem(hHideAvatarMenuItem, false);
}
else {
int has_avatar;
- if ( ServiceExists(MS_AV_GETAVATARBITMAP))
+ if (ServiceExists(MS_AV_GETAVATARBITMAP))
has_avatar = CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hItem, 0);
else {
DBVARIANT dbv;
- if ( db_get_ts(hItem, "ContactPhoto", "File", &dbv))
+ if (db_get_ts(hItem, "ContactPhoto", "File", &dbv))
has_avatar = 0;
else {
has_avatar = 1;
@@ -253,10 +253,10 @@ HRESULT CLUI::CreateCluiFrames() MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_SUBMENU;
mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN, 0, 0);
- SetMenuItemInfo(g_hMenuMain, 0, TRUE,&mii);
+ SetMenuItemInfo(g_hMenuMain, 0, TRUE, &mii);
mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
- SetMenuItemInfo(g_hMenuMain,1,TRUE,&mii);
+ SetMenuItemInfo(g_hMenuMain, 1, TRUE, &mii);
CreateCLCWindow(CluiWnd());
@@ -268,14 +268,14 @@ HRESULT CLUI::CreateCluiFrames() CreateUIFrames();
- HookEvent(ME_SYSTEM_MODULESLOADED,CLUI::OnEvent_ModulesLoaded);
- HookEvent(ME_SKIN2_ICONSCHANGED,CLUI_IconsChanged);
+ HookEvent(ME_SYSTEM_MODULESLOADED, CLUI::OnEvent_ModulesLoaded);
+ HookEvent(ME_SKIN2_ICONSCHANGED, CLUI_IconsChanged);
HookEvent(ME_FONT_RELOAD, CLUI::OnEvent_FontReload);
return S_OK;
}
CLUI::CLUI() :
- m_hDwmapiDll( NULL )
+ m_hDwmapiDll(NULL)
{
m_pCLUI = this;
g_CluiData.bSTATE = STATE_CLUI_LOADING;
@@ -287,8 +287,8 @@ CLUI::CLUI() : // Call InitGroup menus before
GroupMenus_Init();
- CreateServiceFunction(MS_CLUI_SHOWMAINMENU,Service_ShowMainMenu);
- CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU,Service_ShowStatusMenu);
+ CreateServiceFunction(MS_CLUI_SHOWMAINMENU, Service_ShowMainMenu);
+ CreateServiceFunction(MS_CLUI_SHOWSTATUSMENU, Service_ShowStatusMenu);
//TODO Add Row template loading here.
@@ -299,10 +299,10 @@ CLUI::CLUI() : LoadCLUIFramesModule();
g_CluiData.boldHideOffline = -1;
- bOldHideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
+ bOldHideOffline = db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT);
g_CluiData.bOldUseGroups = -1;
- bOldUseGroups = db_get_b( NULL,"CList","UseGroups", SETTING_USEGROUPS_DEFAULT );
+ bOldUseGroups = db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT);
}
CLUI::~CLUI()
@@ -313,14 +313,14 @@ CLUI::~CLUI() HRESULT CLUI::LoadDllsRuntime()
{
- g_CluiData.fLayered = !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+ g_CluiData.fLayered = !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT);
g_CluiData.fSmoothAnimation = db_get_b(NULL, "CLUI", "FadeInOut", SETTING_FADEIN_DEFAULT);
- g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL,"ModernData","DisableEngine", SETTING_DISABLESKIN_DEFAULT);
+ g_CluiData.fLayered = (g_CluiData.fLayered*db_get_b(NULL, "ModernData", "EnableLayering", g_CluiData.fLayered)) && !db_get_b(NULL, "ModernData", "DisableEngine", SETTING_DISABLESKIN_DEFAULT);
- if ( IsWinVerVistaPlus()) {
+ if (IsWinVerVistaPlus()) {
m_hDwmapiDll = LoadLibrary(_T("dwmapi.dll"));
if (m_hDwmapiDll)
- g_proc_DWMEnableBlurBehindWindow = (HRESULT (WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(m_hDwmapiDll, "DwmEnableBlurBehindWindow");
+ g_proc_DWMEnableBlurBehindWindow = (HRESULT(WINAPI *)(HWND, DWM_BLURBEHIND *))GetProcAddress(m_hDwmapiDll, "DwmEnableBlurBehindWindow");
}
g_CluiData.fAeroGlass = FALSE;
@@ -330,7 +330,7 @@ HRESULT CLUI::LoadDllsRuntime() HRESULT CLUI::RegisterAvatarMenu()
{
CLISTMENUITEM mi = { sizeof(mi) };
- CreateServiceFunction("CList/ShowContactAvatar",CLUI::Service_Menu_ShowContactAvatar);
+ CreateServiceFunction("CList/ShowContactAvatar", CLUI::Service_Menu_ShowContactAvatar);
mi.position = 2000150000;
mi.hIcon = LoadSmallIcon(g_hInst, IDI_SHOW_AVATAR);
mi.pszName = LPGEN("Show Contact &Avatar");
@@ -338,7 +338,7 @@ HRESULT CLUI::RegisterAvatarMenu() hShowAvatarMenuItem = Menu_AddContactMenuItem(&mi);
DestroyIcon_protect(mi.hIcon);
- CreateServiceFunction("CList/HideContactAvatar",CLUI::Service_Menu_HideContactAvatar);
+ CreateServiceFunction("CList/HideContactAvatar", CLUI::Service_Menu_HideContactAvatar);
mi.position = 2000150001;
mi.hIcon = LoadSmallIcon(g_hInst, IDI_HIDE_AVATAR);
mi.pszName = LPGEN("Hide Contact &Avatar");
@@ -373,36 +373,36 @@ HRESULT CLUI::CreateUIFrames() return S_OK;
}
-HRESULT CLUI::FillAlphaChannel( HDC hDC, RECT *prcParent, BYTE bAlpha)
+HRESULT CLUI::FillAlphaChannel(HDC hDC, RECT *prcParent, BYTE bAlpha)
{
RECT rcWindow;
- GetWindowRect( m_hWnd, &rcWindow );
+ GetWindowRect(m_hWnd, &rcWindow);
HRGN hRgn = CreateRectRgn(0, 0, 0, 0);
- if ( GetWindowRgn(m_hWnd,hRgn) == ERROR) {
+ if (GetWindowRgn(m_hWnd, hRgn) == ERROR) {
DeleteObject(hRgn);
- hRgn = CreateRectRgn(rcWindow.left ,rcWindow.top ,rcWindow.right,rcWindow.bottom);
+ hRgn = CreateRectRgn(rcWindow.left, rcWindow.top, rcWindow.right, rcWindow.bottom);
}
- OffsetRgn(hRgn,-prcParent->left,-prcParent->top);
+ OffsetRgn(hRgn, -prcParent->left, -prcParent->top);
RECT rcBounds;
- GetRgnBox(hRgn,&rcBounds);
+ GetRgnBox(hRgn, &rcBounds);
- if ( IsRectEmpty(&rcBounds)) {
+ if (IsRectEmpty(&rcBounds)) {
DeleteObject(hRgn);
return S_FALSE;
}
- DWORD dwRgnSize = GetRegionData( hRgn, 0, NULL );
+ DWORD dwRgnSize = GetRegionData(hRgn, 0, NULL);
RGNDATA *rgnData = (RGNDATA *)malloc(dwRgnSize);
- GetRegionData(hRgn,dwRgnSize,rgnData);
+ GetRegionData(hRgn, dwRgnSize, rgnData);
RECT *pRect = (RECT *)rgnData->Buffer;
- for (DWORD i=0; i < rgnData->rdh.nCount; i++)
- ske_SetRectOpaque( hDC, &pRect[i] );
+ for (DWORD i = 0; i < rgnData->rdh.nCount; i++)
+ ske_SetRectOpaque(hDC, &pRect[i]);
free(rgnData);
DeleteObject(hRgn);
@@ -412,8 +412,7 @@ HRESULT CLUI::FillAlphaChannel( HDC hDC, RECT *prcParent, BYTE bAlpha) HRESULT CLUI::CreateCLC()
{
- INIT < CLISTFrame> Frame;
-
+ CLISTFrame Frame = { sizeof(Frame) };
Frame.hWnd = ClcWnd();
Frame.align = alClient;
Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME);
@@ -2047,9 +2046,9 @@ LRESULT CLUI::OnSetAllExtraIcons(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lPara LRESULT CLUI::OnCreateClc(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ )
{
CreateCLC();
- if ( db_get_b( NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT ))
- cliShowHide((WPARAM) m_hWnd, TRUE );
- PostMessage( pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0 );
+ if (db_get_b(NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT))
+ cliShowHide((WPARAM)m_hWnd, TRUE);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
return FALSE;
}
@@ -2383,16 +2382,16 @@ LRESULT CLUI::OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam) }
DefWindowProc(m_hWnd, msg, wParam, lParam);
- if ( db_get_b(NULL,"CList","OnDesktop",SETTING_ONDESKTOP_DEFAULT))
- Sync( CLUIFrames_ActivateSubContainers, TRUE );
+ if (db_get_b(NULL, "CList", "OnDesktop", SETTING_ONDESKTOP_DEFAULT))
+ Sync(CLUIFrames_ActivateSubContainers, TRUE);
return FALSE;
}
LRESULT CLUI::OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam)
{
if (wParam == VK_F5)
- SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0);
- return DefCluiWndProc( msg, wParam, lParam);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
+ return DefCluiWndProc(msg, wParam, lParam);
}
LRESULT CLUI::OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam)
@@ -2409,9 +2408,8 @@ LRESULT CLUI::OnMoving(UINT msg, WPARAM wParam, LPARAM lParam) {
CallWindowProc( DefWindowProc, m_hWnd, msg, wParam, lParam);
if ( FALSE ) //showcontents is turned on
- {
Sync(CLUIFrames_OnMoving,m_hWnd,(RECT*)lParam);
- }
+
return TRUE;
}
@@ -2472,24 +2470,21 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) }
if (nRequiredHeight == 1)
return FALSE;
+
nRequiredHeight = 1;
- if (mutex_bDuringSizing)
- {
+ if (mutex_bDuringSizing) {
bNeedFixSizingRect = 1;
rcSizingRect.top = rcWindow.top;
rcSizingRect.bottom = rcWindow.bottom;
rcCorrectSizeRect = rcSizingRect;
}
- else
- {
- bNeedFixSizingRect = 0;
- }
+ else bNeedFixSizingRect = 0;
+
if (!mutex_bDuringSizing)
SetWindowPos(m_hWnd, 0, rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE);
else
- {
SetWindowPos(m_hWnd, 0, rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE);
- }
+
nRequiredHeight = 0;
return FALSE;
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 82f50a24bc..e4f0d89bc2 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -722,12 +722,12 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP int index = 0;
if (g_CluiData.current_viewmode[0] != '\0') {
- TCHAR *temp = mir_utf8decodeW( g_CluiData.current_viewmode );
+ TCHAR *temp = mir_utf8decodeW(g_CluiData.current_viewmode);
if (temp) {
- index = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_FINDSTRING, -1, (LPARAM)temp );
+ index = SendDlgItemMessage(hwndDlg, IDC_VIEWMODES, LB_FINDSTRING, -1, (LPARAM)temp);
mir_free(temp);
}
- if ( index == -1 )
+ if (index == -1)
index = 0;
}
@@ -738,8 +738,8 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP else
clvm_curItem = -1;
g_ViewModeOptDlg = TRUE;
- i=0;
- while(_page2Controls[i] != 0)
+ i = 0;
+ while (_page2Controls[i] != 0)
ShowWindow(GetDlgItem(hwndDlg, _page2Controls[i++]), SW_HIDE);
ShowWindow(hwndDlg, SW_SHOWNORMAL);
EnableWindow(GetDlgItem(hwndDlg, IDC_APPLY), FALSE);
@@ -1032,23 +1032,16 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM }
}
- if (g_CluiData.bFilterEffective) {
- TCHAR * temp;
- //temp = alloca((strlen(szSetting)+1)*sizeof(TCHAR));
- mir_utf8decode(g_CluiData.current_viewmode,&temp);
- if (temp) {
- SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), temp );
- mir_free(temp);
- }
- }
- else SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), TranslateT("All contacts"));
+ if (g_CluiData.bFilterEffective)
+ SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), ptrT(mir_utf8decodeT(g_CluiData.current_viewmode)));
+ else
+ SetWindowText(GetDlgItem(hwnd, IDC_SELECTMODE), TranslateT("All contacts"));
break;
case WM_ERASEBKGND:
if (g_CluiData.fDisableSkinEngine)
return sttDrawViewModeBackground(hwnd, (HDC)wParam, NULL);
- else
- return 0;
+ return 0;
case WM_NCPAINT:
case WM_PAINT:
@@ -1056,63 +1049,61 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ValidateRect(hwnd,NULL);
else if (GetParent(hwnd) != pcli->hwndContactList || !g_CluiData.fLayered) {
- HDC hdc, hdc2;
- HBITMAP hbmp,hbmpo;
- RECT rc = {0};
- GetClientRect(hwnd,&rc);
+ RECT rc = { 0 };
+ GetClientRect(hwnd, &rc);
rc.right++;
rc.bottom++;
- hdc = GetDC(hwnd);
- hdc2 = CreateCompatibleDC(hdc);
- hbmp = ske_CreateDIB32(rc.right,rc.bottom);
- hbmpo = (HBITMAP)SelectObject(hdc2,hbmp);
+ HDC hdc = GetDC(hwnd);
+ HDC hdc2 = CreateCompatibleDC(hdc);
+ HBITMAP hbmp = ske_CreateDIB32(rc.right, rc.bottom);
+ HBITMAP hbmpo = (HBITMAP)SelectObject(hdc2, hbmp);
- if ( g_CluiData.fDisableSkinEngine )
- sttDrawViewModeBackground( hwnd, hdc2, &rc );
+ if (g_CluiData.fDisableSkinEngine)
+ sttDrawViewModeBackground(hwnd, hdc2, &rc);
else {
if (GetParent(hwnd) != pcli->hwndContactList) {
HBRUSH br = GetSysColorBrush(COLOR_3DFACE);
- FillRect(hdc2,&rc,br);
+ FillRect(hdc2, &rc, br);
}
- else ske_BltBackImage(hwnd,hdc2,&rc);
+ else ske_BltBackImage(hwnd, hdc2, &rc);
- DrawViewModeBar(hwnd,hdc2);
+ DrawViewModeBar(hwnd, hdc2);
}
- for (int i=0; _buttons[i] != 0; i++) {
+ for (int i = 0; _buttons[i] != 0; i++) {
RECT childRect;
RECT MyRect;
POINT Offset;
- GetWindowRect(hwnd,&MyRect);
- GetWindowRect(GetDlgItem(hwnd, _buttons[i]),&childRect);
- Offset.x = childRect.left-MyRect.left;
- Offset.y = childRect.top-MyRect.top;
- SendMessage(GetDlgItem(hwnd, _buttons[i]),BUTTONDRAWINPARENT,(WPARAM)hdc2,(LPARAM)&Offset);
+ GetWindowRect(hwnd, &MyRect);
+ GetWindowRect(GetDlgItem(hwnd, _buttons[i]), &childRect);
+ Offset.x = childRect.left - MyRect.left;
+ Offset.y = childRect.top - MyRect.top;
+ SendMessage(GetDlgItem(hwnd, _buttons[i]), BUTTONDRAWINPARENT, (WPARAM)hdc2, (LPARAM)&Offset);
}
- BitBlt(hdc,rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top,hdc2,rc.left,rc.top,SRCCOPY);
- SelectObject(hdc2,hbmpo);
+ BitBlt(hdc, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, hdc2, rc.left, rc.top, SRCCOPY);
+ SelectObject(hdc2, hbmpo);
DeleteObject(hbmp);
DeleteDC(hdc2);
- SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
+ SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT));
- ReleaseDC(hwnd,hdc);
- ValidateRect(hwnd,NULL);
+ ReleaseDC(hwnd, hdc);
+ ValidateRect(hwnd, NULL);
}
return 0;
case WM_NOTIFY:
- if (((LPNMHDR) lParam)->code == BUTTONNEEDREDRAW)
+ if (((LPNMHDR)lParam)->code == BUTTONNEEDREDRAW)
pcli->pfnInvalidateRect(hwnd, NULL, FALSE);
return 0;
case WM_TIMER:
if (wParam == TIMERID_VIEWMODEEXPIRE) {
- POINT pt;
RECT rcCLUI;
-
GetWindowRect(pcli->hwndContactList, &rcCLUI);
+
+ POINT pt;
GetCursorPos(&pt);
if (PtInRect(&rcCLUI, pt))
break;
@@ -1128,40 +1119,31 @@ LRESULT CALLBACK ViewModeFrameWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_SELECTMODE:
+ BuildViewModeMenu();
{
RECT rc;
- POINT pt;
- int selection;
- MENUITEMINFO mii = {0};
- TCHAR szTemp[256];
-
- BuildViewModeMenu();
GetWindowRect((HWND)lParam, &rc);
- pt.x = rc.left;
- pt.y = rc.bottom;
- selection = TrackPopupMenu(hViewModeMenu,TPM_RETURNCMD|TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0, GetParent(hwnd), NULL);
+ POINT pt = { rc.left, rc.bottom };
+ int selection = TrackPopupMenu(hViewModeMenu, TPM_RETURNCMD | TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, GetParent(hwnd), NULL);
PostMessage(hwnd, WM_NULL, 0, 0);
- if (selection)
- {
-
+ if (selection) {
if (selection == 10001)
goto clvm_config_command;
- else if (selection == 10002)
+ if (selection == 10002)
goto clvm_reset_command;
- mii.cbSize = sizeof(mii);
+ TCHAR szTemp[256];
+ MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_STRING;
mii.dwTypeData = szTemp;
mii.cch = 256;
GetMenuItemInfo(hViewModeMenu, selection, FALSE, &mii);
- char * temp = mir_utf8encodeT(szTemp);
- ApplyViewMode(temp);
- if (temp)
- mir_free(temp);
+ ApplyViewMode(ptrA(mir_utf8encodeT(szTemp)));
}
- break;
}
+ break;
+
case IDC_RESETMODES:
clvm_reset_command:
ApplyViewMode("");
@@ -1203,23 +1185,19 @@ static view_mode_t view_mode; static BOOL sttDrawViewModeBackground(HWND hwnd, HDC hdc, RECT *rect)
{
BOOL bFloat = (GetParent(hwnd) != pcli->hwndContactList);
- if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat)
- {
+ if (g_CluiData.fDisableSkinEngine || !g_CluiData.fLayered || bFloat) {
RECT rc;
+ if (rect)
+ rc = *rect;
+ else
+ GetClientRect(hwnd, &rc);
- if (rect) rc = *rect;
- else GetClientRect(hwnd,&rc);
-
- if (!view_mode.hBmpBackground && !view_mode.useWinColors)
- {
+ if (!view_mode.hBmpBackground && !view_mode.useWinColors) {
HBRUSH hbr = CreateSolidBrush(view_mode.bkColour);
FillRect(hdc, &rc, hbr);
DeleteObject(hbr);
}
- else
- {
- DrawBackGround(hwnd,hdc,view_mode.hBmpBackground,view_mode.bkColour,view_mode.backgroundBmpUse);
- }
+ else DrawBackGround(hwnd, hdc, view_mode.hBmpBackground, view_mode.bkColour, view_mode.backgroundBmpUse);
}
return TRUE;
}
@@ -1228,17 +1206,16 @@ COLORREF sttGetColor(char * module, char * color, COLORREF defColor); //clcutils static int ehhViewModeBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam)
{
- if (view_mode.hBmpBackground)
- {
+ if (view_mode.hBmpBackground) {
DeleteObject(view_mode.hBmpBackground);
view_mode.hBmpBackground = NULL;
}
- if (g_CluiData.fDisableSkinEngine)
- {
+
+ if (g_CluiData.fDisableSkinEngine) {
DBVARIANT dbv;
- view_mode.bkColour = sttGetColor("ViewMode","BkColour",CLCDEFAULT_BKCOLOUR);
- if ( db_get_b(NULL,"ViewMode","UseBitmap",CLCDEFAULT_USEBITMAP)) {
- if (!db_get_s(NULL,"ViewMode","BkBitmap",&dbv)) {
+ view_mode.bkColour = sttGetColor("ViewMode", "BkColour", CLCDEFAULT_BKCOLOUR);
+ if (db_get_b(NULL, "ViewMode", "UseBitmap", CLCDEFAULT_USEBITMAP)) {
+ if (!db_get_s(NULL, "ViewMode", "BkBitmap", &dbv)) {
view_mode.hBmpBackground = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)dbv.pszVal);
db_free(&dbv);
}
@@ -1246,7 +1223,7 @@ static int ehhViewModeBackgroundSettingsChanged(WPARAM wParam, LPARAM lParam) view_mode.useWinColors = db_get_b(NULL, "ViewMode", "UseWinColours", CLCDEFAULT_USEWINDOWSCOLOURS);
view_mode.backgroundBmpUse = db_get_w(NULL, "ViewMode", "BkBmpUse", CLCDEFAULT_BKBMPUSE);
}
- PostMessage(pcli->hwndContactList,WM_SIZE, 0, 0);
+ PostMessage(pcli->hwndContactList, WM_SIZE, 0, 0);
return 0;
}
@@ -1256,33 +1233,31 @@ void CreateViewModeFrame() HookEvent(ME_BACKGROUNDCONFIG_CHANGED,ehhViewModeBackgroundSettingsChanged);
ehhViewModeBackgroundSettingsChanged(0, 0);
- CLISTFrame frame = {0};
- WNDCLASS wndclass = {0};
-
+ WNDCLASS wndclass = { 0 };
wndclass.style = 0;
wndclass.lpfnWndProc = ViewModeFrameWndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = g_hInst;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.hbrBackground = (HBRUSH) GetSysColorBrush(COLOR_3DFACE);
+ wndclass.hbrBackground = (HBRUSH)GetSysColorBrush(COLOR_3DFACE);
wndclass.lpszMenuName = 0;
wndclass.lpszClassName = _T("CLVMFrameWindow");
-
RegisterClass(&wndclass);
- ZeroMemory(&frame, sizeof(frame));
+ CLISTFrame frame = { 0 };
frame.cbSize = sizeof(frame);
frame.tname = _T("View modes");
frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME);
frame.height = 18;
frame.TBtname = TranslateT("View Modes");
- frame.Flags = F_VISIBLE|F_SHOWTBTIP|F_NOBORDER|F_NO_SUBCONTAINER|F_TCHAR;
+ frame.Flags = F_VISIBLE | F_SHOWTBTIP | F_NOBORDER | F_NO_SUBCONTAINER | F_TCHAR;
frame.align = alBottom;
- frame.hWnd = CreateWindowEx(0, _T("CLVMFrameWindow"), _T(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU) 0, g_hInst, NULL);
+ frame.hWnd = CreateWindowEx(0, _T("CLVMFrameWindow"), _T(CLVM_MODULE), WS_VISIBLE | WS_CHILD | WS_TABSTOP | WS_CLIPCHILDREN, 0, 0, 20, 20, pcli->hwndContactList, (HMENU)0, g_hInst, NULL);
g_hwndViewModeFrame = frame.hWnd;
- hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&frame,0);
+ hCLVMFrame = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&frame, 0);
CallService(MS_CLIST_FRAMES_UPDATEFRAME, (WPARAM)hCLVMFrame, FU_FMPOS);
+
CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)frame.hWnd,(LPARAM)ViewModePaintCallbackProc); //$$$$$ register sub for frame
ApplyViewMode(NULL); //Apply last selected view mode
@@ -1293,7 +1268,6 @@ const char *MakeVariablesString(const char *src, const char *UIN); void ApplyViewMode(const char *Name, bool onlySelector )
{
char szSetting[256];
- char * name = (char*)Name;
DBVARIANT dbv = {0};
BOOL wasNotViewMode = ( Name != NULL && g_CluiData.current_viewmode[0] == '\0' );
@@ -1302,98 +1276,87 @@ void ApplyViewMode(const char *Name, bool onlySelector ) mir_snprintf(szSetting, 256, "%c_LastMode", 246);
- if (!name) // Name is null - apply last stored view mode
- {
- if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv))
- {
- name = (char*)_alloca(strlen(dbv.pszVal)+1);
- strcpy(name,dbv.pszVal);
- mir_free(dbv.pszVal);
+ if (!Name) { // Name is null - apply last stored view mode
+ if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
+ Name = NEWSTR_ALLOCA(dbv.pszVal);
+ db_free(&dbv);
}
else return;
}
- if ( name[0] == '\0' )
- {
+ if (Name[0] == '\0') {
// Reset View Mode
g_CluiData.bFilterEffective = 0;
- { // remove last applied view mode
- char szSetting[256];
- mir_snprintf(szSetting, 256, "%c_LastMode", 246);
- db_unset(NULL,CLVM_MODULE,szSetting);
- }
- if ( g_CluiData.bOldUseGroups != (BYTE) -1 )
- CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0 );
+ // remove last applied view mode
+ mir_snprintf(szSetting, 256, "%c_LastMode", 246);
+ db_unset(NULL, CLVM_MODULE, szSetting);
+
+ if (g_CluiData.bOldUseGroups != (BYTE)-1)
+ CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0);
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
SetWindowText(GetDlgItem(g_hwndViewModeFrame, IDC_SELECTMODE), TranslateT("All contacts"));
- if (g_CluiData.boldHideOffline != (BYTE)-1) CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)g_CluiData.boldHideOffline, 0);
- if (g_CluiData.bOldUseGroups != (BYTE)-1) CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0);
+ if (g_CluiData.boldHideOffline != (BYTE)-1)
+ CallService(MS_CLIST_SETHIDEOFFLINE, (WPARAM)g_CluiData.boldHideOffline, 0);
+ if (g_CluiData.bOldUseGroups != (BYTE)-1)
+ CallService(MS_CLIST_SETUSEGROUPS, (WPARAM)g_CluiData.bOldUseGroups, 0);
g_CluiData.boldHideOffline = (BYTE)-1;
- g_CluiData.bOldUseGroups = (BYTE) -1;
+ g_CluiData.bOldUseGroups = (BYTE)-1;
g_CluiData.current_viewmode[0] = 0;
g_CluiData.old_viewmode[0] = 0;
return;
}
- if (!onlySelector )
- {
- mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
+ if (!onlySelector) {
+ mir_snprintf(szSetting, 256, "%c%s_PF", 246, Name);
if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlenA(dbv.pszVal) >= 2)
- {
+ if (lstrlenA(dbv.pszVal) >= 2) {
strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
g_CluiData.protoFilter[SIZEOF(g_CluiData.protoFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_PROTOS;
}
mir_free(dbv.pszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
- if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv))
- {
- if (lstrlen(dbv.ptszVal) >= 2)
- {
+ mir_snprintf(szSetting, 256, "%c%s_GF", 246, Name);
+ if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv)) {
+ if (lstrlen(dbv.ptszVal) >= 2) {
_tcsncpy(g_CluiData.groupFilter, dbv.ptszVal, SIZEOF(g_CluiData.groupFilter));
g_CluiData.groupFilter[SIZEOF(g_CluiData.groupFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_GROUPS;
}
mir_free(dbv.ptszVal);
}
- mir_snprintf(szSetting, 256, "%c%s_SM", 246, name);
+ mir_snprintf(szSetting, 256, "%c%s_SM", 246, Name);
g_CluiData.statusMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
if (g_CluiData.statusMaskFilter >= 1)
g_CluiData.bFilterEffective |= CLVM_FILTER_STATUS;
- mir_snprintf(szSetting, 256, "%c%s_SSM", 246, name);
+ mir_snprintf(szSetting, 256, "%c%s_SSM", 246, Name);
g_CluiData.stickyMaskFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, -1);
if (g_CluiData.stickyMaskFilter != -1)
g_CluiData.bFilterEffective |= CLVM_FILTER_STICKYSTATUS;
- g_CluiData.filterFlags = db_get_dw(NULL, CLVM_MODULE, name, 0);
+ g_CluiData.filterFlags = db_get_dw(NULL, CLVM_MODULE, Name, 0);
KillTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE);
- if (g_CluiData.filterFlags & CLVM_AUTOCLEAR)
- {
- DWORD timerexpire;
- mir_snprintf(szSetting, 256, "%c%s_OPT", 246, name);
- timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
+ if (g_CluiData.filterFlags & CLVM_AUTOCLEAR) {
+ mir_snprintf(szSetting, 256, "%c%s_OPT", 246, Name);
+ DWORD timerexpire = LOWORD(db_get_dw(NULL, CLVM_MODULE, szSetting, 0));
strncpy(g_CluiData.old_viewmode, g_CluiData.current_viewmode, 256);
g_CluiData.old_viewmode[255] = 0;
CLUI_SafeSetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
}
- else //store last selected view mode only if it is not autoclear
- {
+ else { //store last selected view mode only if it is not autoclear
mir_snprintf(szSetting, 256, "%c_LastMode", 246);
- db_set_s(NULL, CLVM_MODULE, szSetting, name);
+ db_set_s(NULL, CLVM_MODULE, szSetting, Name);
}
- strncpy(g_CluiData.current_viewmode, name, 256);
+ strncpy(g_CluiData.current_viewmode, Name, 256);
g_CluiData.current_viewmode[255] = 0;
- if (g_CluiData.filterFlags & CLVM_USELASTMSG)
- {
+ if (g_CluiData.filterFlags & CLVM_USELASTMSG) {
BYTE bSaved = g_CluiData.bSortByOrder[0];
g_CluiData.bSortByOrder[0] = SORTBY_LASTMSG;
@@ -1404,7 +1367,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) g_CluiData.bSortByOrder[0] = bSaved;
g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG;
- mir_snprintf(szSetting, 256, "%c%s_LM", 246, name);
+ mir_snprintf(szSetting, 256, "%c%s_LM", 246, Name);
g_CluiData.lastMsgFilter = db_get_dw(NULL, CLVM_MODULE, szSetting, 0);
if (LOBYTE(HIWORD(g_CluiData.lastMsgFilter)))
g_CluiData.bFilterEffective |= CLVM_FILTER_LASTMSG_NEWERTHAN;
@@ -1449,39 +1412,29 @@ void ApplyViewMode(const char *Name, bool onlySelector ) else if (g_CluiData.filterFlags & CLVM_DONOTUSEGROUPS)
bUseGroups = 0;
- if (bUseGroups != -1)
- {
+ if (bUseGroups != -1) {
if (g_CluiData.bOldUseGroups == (BYTE)-1)
g_CluiData.bOldUseGroups = db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT);
CallService(MS_CLIST_SETUSEGROUPS, bUseGroups, 0);
}
- else if (g_CluiData.bOldUseGroups != (BYTE)-1)
- {
+ else if (g_CluiData.bOldUseGroups != (BYTE)-1) {
CallService(MS_CLIST_SETUSEGROUPS, g_CluiData.bOldUseGroups, 0);
g_CluiData.bOldUseGroups = -1;
}
}
- TCHAR * temp = mir_utf8decodeW(( name[0] == (char)13 ) ? name + 1 : name );
- SetWindowText(hwndSelector, temp);
- mir_free(temp);
+ SetWindowText(hwndSelector, ptrT(mir_utf8decodeW((Name[0] == (char)13) ? Name + 1 : Name)));
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
CLUI__cliInvalidateRect(pcli->hwndStatus, NULL, FALSE);
- //SetButtonStates(pcli->hwndContactList);
}
static int SkinSetViewMode(WPARAM wParam /*char * name*/, LPARAM lParam /*int index*/)
{
if (wParam == 0 && lParam == 0)
- {
ApplyViewMode( NULL );
- }
- else
- {
- if (wParam && !IsBadStringPtrA((const char*)wParam, -1))
- ApplyViewMode((const char*)wParam);
- }
+ else if (wParam && !IsBadStringPtrA((const char*)wParam, -1))
+ ApplyViewMode((const char*)wParam);
return 0;
}
diff --git a/plugins/Clist_mw/src/clistopts.cpp b/plugins/Clist_mw/src/clistopts.cpp index 256536acc6..490e184230 100644 --- a/plugins/Clist_mw/src/clistopts.cpp +++ b/plugins/Clist_mw/src/clistopts.cpp @@ -226,7 +226,7 @@ static INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP }
pcli->pfnTrayIconIconsChanged();
LoadContactTree(); /* this won't do job properly since it only really works when changes happen */
- SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0); /* force reshuffle */
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree); /* force reshuffle */
return TRUE;
}
break;
diff --git a/plugins/Clist_mw/src/clistsettings.cpp b/plugins/Clist_mw/src/clistsettings.cpp index 0bf9e3711a..0fab2e10bd 100644 --- a/plugins/Clist_mw/src/clistsettings.cpp +++ b/plugins/Clist_mw/src/clistsettings.cpp @@ -295,7 +295,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) }
}
else if ( !strcmp(cws->szModule,"MetaContacts")) {
- PostMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
return 0;
}
else return 0;
diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index ca39b38253..139ebc1d49 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -555,20 +555,21 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l break;
case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if ( dis->hwndItem == pcli->hwndStatus ) {
- DrawDataForStatusBar(dis);
- return 0;
+ {
+ LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
+ if (dis->hwndItem == pcli->hwndStatus) {
+ DrawDataForStatusBar(dis);
+ return 0;
+ }
+ if (dis->CtlType != ODT_MENU)
+ return 0;
}
- if ( dis->CtlType != ODT_MENU )
- return 0;
break;
- }
+
case WM_KEYDOWN:
- CallService(MS_CLIST_MENUPROCESSHOTKEY,wParam,MPCF_MAINMENU|MPCF_CONTACTMENU);
+ CallService(MS_CLIST_MENUPROCESSHOTKEY, wParam, MPCF_MAINMENU | MPCF_CONTACTMENU);
if (wParam == VK_F5)
- SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0);
+ pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
return TRUE;
case WM_GETMINMAXINFO:
diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 2b19c96016..10a8546a3b 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -404,7 +404,7 @@ LBL_Def: if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
if (lParam == 0)
- SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0);
+ pcli->pfnInitAutoRebuild(hwnd);
goto LBL_Def;
case INTM_NAMECHANGED:
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 25620c7c93..eef03b12d3 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -1532,7 +1532,7 @@ buttons_done: break;
case POPUP_SHOWMETAICONS:
cfg::dat.dwFlags ^= CLUI_USEMETAICONS;
- SendMessage(pcli->hwndContactTree, CLM_AUTOREBUILD, 0, 0);
+ pcli->pfnInitAutoRebuild(hwnd);
break;
case POPUP_FRAME:
cfg::dat.dwFlags ^= CLUI_FRAME_CLISTSUNKEN;
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;
}
|