From 862116c0d40a7304c458f68c4c725e8a95960588 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 Feb 2014 13:18:53 +0000 Subject: valid first parameter's name of ME_DB_CONTACT_SETTINGCHANGED handlers git-svn-id: http://svn.miranda-ng.org/main/trunk@8255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_database.h | 18 +- plugins/AVS/src/main.cpp | 8 +- plugins/CSList/src/cslist.cpp | 3 +- plugins/Clist_modern/src/modern_clc.cpp | 1150 ++++++++++++------------ plugins/Clist_modern/src/modern_clui.cpp | 6 +- plugins/Clist_modern/src/modern_skineditor.cpp | 2 +- plugins/Clist_modern/src/modern_skinopt.cpp | 8 +- plugins/Clist_modern/src/modern_toolbar.cpp | 4 +- plugins/Clist_mw/src/clc.cpp | 10 +- plugins/Clist_mw/src/clui.cpp | 8 +- plugins/Clist_nicer/src/clc.cpp | 58 +- plugins/ContactsPlus/src/main.cpp | 8 +- plugins/CountryFlags/src/extraimg.cpp | 6 +- plugins/FileAsMessage/src/main.cpp | 7 +- plugins/FloatingContacts/src/main.cpp | 12 +- plugins/ListeningTo/src/listeningto.cpp | 3 +- plugins/Rate/src/main.cpp | 6 +- plugins/RecentContacts/src/RecentContacts.cpp | 4 +- plugins/Scriver/src/msgs.cpp | 11 +- plugins/SeenPlugin/src/utils.cpp | 6 +- plugins/StopSpamPlus/src/events.cpp | 3 +- plugins/TabSRMM/src/globals.cpp | 33 +- plugins/TipperYM/src/tipper.cpp | 2 +- plugins/TopToolBar/src/InternalButtons.cpp | 4 +- plugins/UserInfoEx/src/Flags/svc_flags.cpp | 10 +- plugins/UserInfoEx/src/svc_contactinfo.cpp | 4 +- plugins/WhenWasIt/src/hooked_events.cpp | 4 +- plugins/ZeroNotification/src/main.cpp | 5 +- protocols/IcqOscarJ/src/icq_servlist.cpp | 27 +- protocols/Yahoo/src/util.cpp | 10 +- src/modules/clist/clc.cpp | 28 +- 31 files changed, 709 insertions(+), 759 deletions(-) diff --git a/include/m_database.h b/include/m_database.h index 4e30e42885..4099c7ef6e 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -152,7 +152,7 @@ typedef struct { /* db/contact/enumsettings v0.1.0.1+ Lists all the settings a specific modules has stored in the database for a specific contact. -wParam = (WPARAM)(MCONTACT)hContact +wParam = (MCONTACT)hContact lParam = (LPARAM)(DBCONTACTENUMSETTINGS*)&dbces Returns the return value of the last call to pfnEnumProc, or -1 if there are no settings for that module/contact pair @@ -183,7 +183,7 @@ and contact/findnext /* DB/Contact/Delete Deletes the contact hContact from the database and all events and settings associated with it. - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = 0 Returns 0 on success or nonzero if hContact was invalid Please don't try to delete the user contact (hContact = NULL) @@ -438,7 +438,7 @@ lParam = (LPARAM)(char*)szModuleName - the module name to be deleted /* DB/Event/Added event Called when a new event has been added to the event chain for a contact - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = (LPARAM)(HANDLE)hDbEvent hDbEvent is a valid handle to the event. hContact is a valid handle to the contact to which hDbEvent refers. @@ -456,7 +456,7 @@ passed to db_event_add. The point of this hook is to stop any unwanted database events, to stop an event being added, return 1, to allow the event to pass through return 0. - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = (LPARAM)&DBEVENTINFO Any changed made to the said DBEVENTINFO are also passed along to the database, @@ -466,7 +466,7 @@ therefore it is possible to shape the data, however DO NOT DO THIS. /* DB/Event/Marked/Read event Called when an event is marked read -wParam = (WPARAM)(MCONTACT)hContact +wParam = (MCONTACT)hContact lParam = (LPARAM)(HANDLE)hDbEvent hDbEvent is a valid handle to the event. hContact is a valid handle to the contact to which hDbEvent refers, and will @@ -476,7 +476,7 @@ remain valid. /* DB/Event/Deleted event Called when an event is about to be deleted from the event chain for a contact - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = (LPARAM)(HANDLE)hDbEvent hDbEvent is a valid handle to the event which is about to be deleted, but it won't be once your hook has returned. @@ -489,7 +489,7 @@ usual, stop other hooks from being called. /* DB/Contact/Added event Called when a new contact has been added to the database - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = 0 hContact is a valid handle to the new contact. Contacts are initially created without any settings, so if you hook this event @@ -499,7 +499,7 @@ you will almost certainly also want to hook db/contact/settingchanged as well. /* DB/Contact/Deleted event Called when an contact is about to be deleted - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = 0 hContact is a valid handle to the contact which is about to be deleted, but it won't be once your hook has returned. @@ -511,7 +511,7 @@ Deleting a contact invalidates all events in its chain. /* DB/Contact/SettingChanged event Called when a contact has had one of its settings changed - wParam = (WPARAM)(MCONTACT)hContact + wParam = (MCONTACT)hContact lParam = (LPARAM)(DBCONTACTWRITESETTING*)&dbcws hContact is a valid handle to the contact that has changed. This event will be triggered many times rapidly when a whole bunch of values diff --git a/plugins/AVS/src/main.cpp b/plugins/AVS/src/main.cpp index aa6531e167..7270485770 100644 --- a/plugins/AVS/src/main.cpp +++ b/plugins/AVS/src/main.cpp @@ -220,21 +220,21 @@ static int OnAccChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int ContactSettingChanged(WPARAM wParam, LPARAM lParam) +static int ContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; if (cws == NULL || g_shutDown) return 0; - if (wParam == 0) { + if (hContact == 0) { if (!strcmp(cws->szSetting, "AvatarFile") || !strcmp(cws->szSetting, "PictObject") || !strcmp(cws->szSetting, "AvatarHash") || !strcmp(cws->szSetting, "AvatarSaved")) - ReportMyAvatarChanged((WPARAM) cws->szModule, 0); + ReportMyAvatarChanged((WPARAM)cws->szModule, 0); return 0; } if (g_MetaAvail && !strcmp(cws->szModule, g_szMetaName)) { if (lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 5)) - MetaChanged(wParam, 0); + MetaChanged(hContact, 0); } return 0; } diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index b6d0bc1eb3..645850d5e6 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -65,9 +65,8 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) // ====[ LOADER ]============================================================= -static int OnDbChanged(WPARAM wparam, LPARAM lparam) +static int OnDbChanged(WPARAM hContact, LPARAM lparam) { - MCONTACT hContact = (MCONTACT)wparam; DBCONTACTWRITESETTING *cws = ( DBCONTACTWRITESETTING* )lparam; // if user changes his UIN or JID on any account diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 091741963a..882743d19d 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -78,14 +78,13 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_MODERNOPT_INITIALIZE, ModernOptInit); HookEvent(ME_MODERNOPT_INITIALIZE, ModernSkinOptInit); - HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder); hSkinFolder = FoldersRegisterCustomPathT(LPGEN("Skins"), LPGEN("Modern contact list"), MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER)); FoldersGetCustomPathT(hSkinFolder, SkinsFolder, SIZEOF(SkinsFolder), _T(DEFAULT_SKIN_FOLDER)); - if ( ServiceExists(MS_MC_DISABLEHIDDENGROUP)) + if (ServiceExists(MS_MC_DISABLEHIDDENGROUP)) CallService(MS_MC_DISABLEHIDDENGROUP, TRUE, 0); - if ( ServiceExists(MS_MC_GETPROTOCOLNAME)) + if (ServiceExists(MS_MC_GETPROTOCOLNAME)) g_szMetaModuleName = (char *)CallService(MS_MC_GETPROTOCOLNAME, 0, 0); // Get icons @@ -102,22 +101,22 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) sid.pszSection = LPGEN("Contact List"); sid.pszDescription = LPGEN("Listening to"); sid.pszName = "LISTENING_TO_ICON"; - sid.iDefaultIndex = - IDI_LISTENING_TO; + sid.iDefaultIndex = -IDI_LISTENING_TO; Skin_AddIcon(&sid); sid.pszSection = LPGEN("Contact List") "/" LPGEN("Avatar Overlay"); - for (i=0; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) { + for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { sid.pszDescription = g_pAvatarOverlayIcons[i].description; sid.pszName = g_pAvatarOverlayIcons[i].name; - sid.iDefaultIndex = - g_pAvatarOverlayIcons[i].id; + sid.iDefaultIndex = -g_pAvatarOverlayIcons[i].id; Skin_AddIcon(&sid); } sid.pszSection = LPGEN("Contact List") "/" LPGEN("Status Overlay"); - for (i=0; i < SIZEOF(g_pStatusOverlayIcons); i++) { + for (i = 0; i < SIZEOF(g_pStatusOverlayIcons); i++) { sid.pszDescription = g_pStatusOverlayIcons[i].description; sid.pszName = g_pStatusOverlayIcons[i].name; - sid.iDefaultIndex = - g_pStatusOverlayIcons[i].id; + sid.iDefaultIndex = -g_pStatusOverlayIcons[i].id; Skin_AddIcon(&sid); } @@ -126,7 +125,7 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) hIconChangedHook = HookEvent(ME_SKIN2_ICONSCHANGED, clcHookIconsChanged); // Register smiley category - if ( ServiceExists(MS_SMILEYADD_REGISTERCATEGORY)) { + if (ServiceExists(MS_SMILEYADD_REGISTERCATEGORY)) { SMADD_REGCAT rc; rc.cbSize = sizeof(rc); @@ -135,17 +134,17 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) CallService(MS_SMILEYADD_REGISTERCATEGORY, 0, (LPARAM)&rc); - hSmileyAddOptionsChangedHook = HookEvent(ME_SMILEYADD_OPTIONSCHANGED,clcHookSmileyAddOptionsChanged); + hSmileyAddOptionsChangedHook = HookEvent(ME_SMILEYADD_OPTIONSCHANGED, clcHookSmileyAddOptionsChanged); } - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("List background")"/CLC"),0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Menu background")"/Menu"),0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Status bar background")"/StatusBar"),0); - CallService(MS_BACKGROUNDCONFIG_REGISTER,(WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"),0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("List background")"/CLC"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Menu background")"/Menu"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Status bar background")"/StatusBar"), 0); + CallService(MS_BACKGROUNDCONFIG_REGISTER, (WPARAM)(LPGEN("Frames title bar background")"/FrameTitleBar"), 0); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,clcHookBkgndConfigChanged); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,BgStatusBarChange); - HookEvent(ME_BACKGROUNDCONFIG_CHANGED,OnFrameTitleBarBackgroundChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, clcHookBkgndConfigChanged); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, BgStatusBarChange); + HookEvent(ME_BACKGROUNDCONFIG_CHANGED, OnFrameTitleBarBackgroundChange); HookEvent(ME_COLOUR_RELOAD, OnFrameTitleBarBackgroundChange); AniAva_UpdateOptions(); @@ -155,8 +154,8 @@ static int clcHookModulesLoaded(WPARAM wParam, LPARAM lParam) static int clcHookSmileyAddOptionsChanged(WPARAM wParam, LPARAM lParam) { if (MirandaExiting()) return 0; - pcli->pfnClcBroadcast( CLM_AUTOREBUILD, 0, 0); - pcli->pfnClcBroadcast( INTM_INVALIDATE, 0, 0); + pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); + pcli->pfnClcBroadcast(INTM_INVALIDATE, 0, 0); return 0; } @@ -169,113 +168,98 @@ static int clcHookIconsChanged(WPARAM wParam, LPARAM lParam) { int i; if (MirandaExiting()) return 0; - for (i=0 ; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) - { + for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { g_pAvatarOverlayIcons[i].listID = -1; g_pStatusOverlayIcons[i].listID = -1; } - if (hAvatarOverlays) ImageList_Destroy(hAvatarOverlays); - hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, SIZEOF(g_pAvatarOverlayIcons)*2, 1); - for (i=0 ; i < SIZEOF(g_pAvatarOverlayIcons) ; i++) - { + + if (hAvatarOverlays) + ImageList_Destroy(hAvatarOverlays); + hAvatarOverlays = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, SIZEOF(g_pAvatarOverlayIcons) * 2, 1); + + for (i = 0; i < SIZEOF(g_pAvatarOverlayIcons); i++) { HICON hIcon = Skin_GetIcon(g_pAvatarOverlayIcons[i].name); - g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays,hIcon); + g_pAvatarOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon); Skin_ReleaseIcon(g_pAvatarOverlayIcons[i].name); hIcon = Skin_GetIcon(g_pStatusOverlayIcons[i].name); - g_pStatusOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays,hIcon); + g_pStatusOverlayIcons[i].listID = ImageList_AddIcon(hAvatarOverlays, hIcon); Skin_ReleaseIcon(g_pStatusOverlayIcons[i].name); } g_hListeningToIcon = Skin_GetIcon("LISTENING_TO_ICON"); - pcli->pfnClcBroadcast( INTM_INVALIDATE, 0, 0); + pcli->pfnClcBroadcast(INTM_INVALIDATE, 0, 0); AniAva_UpdateOptions(); return 0; } -static int clcHookSettingChanged(WPARAM wParam, LPARAM lParam) +static int clcHookSettingChanged(WPARAM hContact, LPARAM lParam) { if (MirandaExiting()) return 0; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if ((HANDLE)wParam == NULL) { - if (g_szMetaModuleName && !mir_strcmp(cws->szModule, g_szMetaModuleName)) - { + if (hContact == NULL) { + if (g_szMetaModuleName && !mir_strcmp(cws->szModule, g_szMetaModuleName)) { if (!mir_strcmp(cws->szSetting, "Enabled")) - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, wParam, lParam); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, hContact, lParam); } else if (!mir_strcmp(cws->szModule, "CListGroups")) - { - pcli->pfnClcBroadcast( INTM_GROUPSCHANGED,wParam,lParam); - } - else if (!strcmp(cws->szSetting,"XStatusId") || !strcmp(cws->szSetting,"XStatusName")) - { + pcli->pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam); + else if (!strcmp(cws->szSetting, "XStatusId") || !strcmp(cws->szSetting, "XStatusName")) cliCluiProtocolStatusChanged(0, cws->szModule); - } } - else // (HANDLE)wParam != NULL + else // hContact != NULL { - if (!strcmp(cws->szSetting,"TickTS")) - { - pcli->pfnClcBroadcast( INTM_STATUSCHANGED,wParam,0); + if (!strcmp(cws->szSetting, "TickTS")) + pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); + else if (g_szMetaModuleName && !strcmp(cws->szModule, g_szMetaModuleName)) { + if (!strcmp(cws->szSetting, "Handle")) + pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); + else if (!strcmp(cws->szSetting, "Default")) + pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); } - else if (g_szMetaModuleName && !strcmp(cws->szModule,g_szMetaModuleName)) - { - if (!strcmp(cws->szSetting,"Handle")) - { - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0); - } - else if (!strcmp(cws->szSetting,"Default")) - { - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0); - } - } - else if (!strcmp(cws->szModule,"UserInfo")) - { - if (!strcmp(cws->szSetting,"Timezone")) - pcli->pfnClcBroadcast( INTM_TIMEZONECHANGED,wParam,0); + else if (!strcmp(cws->szModule, "UserInfo")) { + if (!strcmp(cws->szSetting, "Timezone")) + pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0); } - else if (!strcmp(cws->szModule,"CList")) - { - if (!strcmp(cws->szSetting,"StatusMsg")) - pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,wParam,0); + else if (!strcmp(cws->szModule, "CList")) { + if (!strcmp(cws->szSetting, "StatusMsg")) + pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); } - else if (!strcmp(cws->szModule,"ContactPhoto")) - { - if (!strcmp(cws->szSetting,"File")) - pcli->pfnClcBroadcast( INTM_AVATARCHANGED,wParam,0); + else if (!strcmp(cws->szModule, "ContactPhoto")) { + if (!strcmp(cws->szSetting, "File")) + pcli->pfnClcBroadcast(INTM_AVATARCHANGED, hContact, 0); } - else - { - if ((!strcmp(cws->szSetting,"XStatusName") || !strcmp(cws->szSetting,"XStatusMsg"))) - pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,wParam,0); - else if (!strcmp(cws->szSetting,"XStatusId")) - pcli->pfnClcBroadcast( INTM_STATUSCHANGED,wParam,0); - else if (!strcmp(cws->szSetting,"Timezone")) - pcli->pfnClcBroadcast( INTM_TIMEZONECHANGED,wParam,0); - else if (!strcmp(cws->szSetting,"ListeningTo")) - pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,wParam,0); - else if (!strcmp(cws->szSetting,"Transport") || !strcmp(cws->szSetting,"IsTransported")) { - pcli->pfnInvalidateDisplayNameCacheEntry(wParam); - pcli->pfnClcBroadcast( CLM_AUTOREBUILD,wParam,0); + else { + if ((!strcmp(cws->szSetting, "XStatusName") || !strcmp(cws->szSetting, "XStatusMsg"))) + pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); + else if (!strcmp(cws->szSetting, "XStatusId")) + pcli->pfnClcBroadcast(INTM_STATUSCHANGED, hContact, 0); + else if (!strcmp(cws->szSetting, "Timezone")) + pcli->pfnClcBroadcast(INTM_TIMEZONECHANGED, hContact, 0); + else if (!strcmp(cws->szSetting, "ListeningTo")) + pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, 0); + else if (!strcmp(cws->szSetting, "Transport") || !strcmp(cws->szSetting, "IsTransported")) { + pcli->pfnInvalidateDisplayNameCacheEntry(hContact); + pcli->pfnClcBroadcast(CLM_AUTOREBUILD, hContact, 0); } } } return 0; } -static int clcHookDbEventAdded(WPARAM wParam, LPARAM lParam) +static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam) { g_CluiData.t_now = time(NULL); - if (wParam && lParam) { + if (hContact && lParam) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(wParam); - db_set_dw(wParam, "CList", "mf_lastmsg", dbei.timestamp); + ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + db_set_dw(hContact, "CList", "mf_lastmsg", dbei.timestamp); if (pdnce) pdnce->dwLastMsgTime = dbei.timestamp; } @@ -283,7 +267,7 @@ static int clcHookDbEventAdded(WPARAM wParam, LPARAM lParam) return 0; } -static int clcHookBkgndConfigChanged(WPARAM wParam, LPARAM lParam) +static int clcHookBkgndConfigChanged(WPARAM, LPARAM) { pcli->pfnClcOptionsChanged(); return 0; @@ -306,14 +290,14 @@ static int clcExitDragToScroll() static int clcProceedDragToScroll(HWND hwnd, int Y) { - int pos,dy; + int pos, dy; if (!IsDragToScrollMode) return 0; if (GetCapture() != hwnd) clcExitDragToScroll(); - dy = StartDragPos-Y; - pos = StartScrollPos+dy; + dy = StartDragPos - Y; + pos = StartScrollPos + dy; if (pos < 0) pos = 0; - SendMessage(hwnd, WM_VSCROLL,MAKEWPARAM(SB_THUMBTRACK,pos),0); + SendMessage(hwnd, WM_VSCROLL, MAKEWPARAM(SB_THUMBTRACK, pos), 0); return 1; } @@ -327,26 +311,25 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR int nLastFound = -1; if (index == -1) fReturnAsFound = TRUE; group->scanIndex = 0; - for (;;) - { - if (group->scanIndex == group->cl.count) - { + for (;;) { + if (group->scanIndex == group->cl.count) { group = group->parent; if (group == NULL) break; group->scanIndex++; continue; } - if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) - { + if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) { bool found; if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { found = true; - } else if (dat->filterSearch) { + } + else if (dat->filterSearch) { TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(group->cl.items[group->scanIndex]->szText)); TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch)); found = _tcsstr(lowered_szText, lowered_search) != NULL; - } else { + } + else { found = ((prefixOk && CSTR_EQUAL == CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, text, -1, group->cl.items[group->scanIndex]->szText, testlen)) || (!prefixOk && !lstrcmpi(text, group->cl.items[group->scanIndex]->szText))); } if (found) { @@ -367,10 +350,8 @@ static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR group = contactGroup; group->scanIndex = contactScanIndex; } - if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) - { - if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) - { + if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) { + if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || group->cl.items[group->scanIndex]->group->expanded) { group = group->cl.items[group->scanIndex]->group; group->scanIndex = 0; continue; @@ -416,27 +397,27 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA RowHeights_Initialize(dat); dat->needsResort = 1; - dat->MetaIgnoreEmptyExtra = db_get_b(NULL,"CLC","MetaIgnoreEmptyExtra",SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); - - dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd,GWL_STYLE)&CLS_MANUALUPDATE)) && - g_szMetaModuleName && db_get_b(NULL,g_szMetaModuleName,"Enabled",1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); - - dat->expandMeta = db_get_b(NULL,"CLC","MetaExpanding",SETTING_METAEXPANDING_DEFAULT); - dat->useMetaIcon = db_get_b(NULL,"CLC","Meta",SETTING_USEMETAICON_DEFAULT); - dat->drawOverlayedStatus = db_get_b(NULL,"CLC","DrawOverlayedStatus",SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); - g_CluiData.bSortByOrder[0] = db_get_b(NULL,"CList","SortBy1",SETTING_SORTBY1_DEFAULT); - g_CluiData.bSortByOrder[1] = db_get_b(NULL,"CList","SortBy2",SETTING_SORTBY2_DEFAULT); - g_CluiData.bSortByOrder[2] = db_get_b(NULL,"CList","SortBy3",SETTING_SORTBY3_DEFAULT); - g_CluiData.fSortNoOfflineBottom = db_get_b(NULL,"CList","NoOfflineBottom",SETTING_NOOFFLINEBOTTOM_DEFAULT); + dat->MetaIgnoreEmptyExtra = db_get_b(NULL, "CLC", "MetaIgnoreEmptyExtra", SETTING_METAIGNOREEMPTYEXTRA_DEFAULT); + + dat->IsMetaContactsEnabled = (!(GetWindowLongPtr(hwnd, GWL_STYLE)&CLS_MANUALUPDATE)) && + g_szMetaModuleName && db_get_b(NULL, g_szMetaModuleName, "Enabled", 1) && ServiceExists(MS_MC_GETDEFAULTCONTACT); + + dat->expandMeta = db_get_b(NULL, "CLC", "MetaExpanding", SETTING_METAEXPANDING_DEFAULT); + dat->useMetaIcon = db_get_b(NULL, "CLC", "Meta", SETTING_USEMETAICON_DEFAULT); + dat->drawOverlayedStatus = db_get_b(NULL, "CLC", "DrawOverlayedStatus", SETTING_DRAWOVERLAYEDSTATUS_DEFAULT); + g_CluiData.bSortByOrder[0] = db_get_b(NULL, "CList", "SortBy1", SETTING_SORTBY1_DEFAULT); + g_CluiData.bSortByOrder[1] = db_get_b(NULL, "CList", "SortBy2", SETTING_SORTBY2_DEFAULT); + g_CluiData.bSortByOrder[2] = db_get_b(NULL, "CList", "SortBy3", SETTING_SORTBY3_DEFAULT); + g_CluiData.fSortNoOfflineBottom = db_get_b(NULL, "CList", "NoOfflineBottom", SETTING_NOOFFLINEBOTTOM_DEFAULT); dat->menuOwnerID = -1; dat->menuOwnerType = CLCIT_INVALID; corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - LoadCLCOptions(hwnd,dat); - if ( dat->contact_time_show || dat->second_line_type == TEXT_CONTACT_TIME || dat->third_line_type == TEXT_CONTACT_TIME ) - CLUI_SafeSetTimer( hwnd, TIMERID_INVALIDATE, 5000, NULL ); + LoadCLCOptions(hwnd, dat); + if (dat->contact_time_show || dat->second_line_type == TEXT_CONTACT_TIME || dat->third_line_type == TEXT_CONTACT_TIME) + CLUI_SafeSetTimer(hwnd, TIMERID_INVALIDATE, 5000, NULL); else - KillTimer( hwnd, TIMERID_INVALIDATE ); + KillTimer(hwnd, TIMERID_INVALIDATE); TRACE("Create New ClistControl TO END\r\n"); return 0; @@ -444,7 +425,7 @@ static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPA static LRESULT clcOnHitTest(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - return DefWindowProc(hwnd,WM_NCHITTEST,wParam,lParam); + return DefWindowProc(hwnd, WM_NCHITTEST, wParam, lParam); } static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -452,7 +433,7 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP ClcContact *contact; int hit = pcli->pfnGetRowByIndex(dat, dat->selection, &contact, NULL); if (hit == -1) return 0; - if ( contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) contact->hContact)) return 0; + if (contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)contact->hContact)) return 0; switch (LOWORD(wParam)) { case POPUP_NEWSUBGROUP: @@ -474,14 +455,14 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP if (contact->type != CLCIT_GROUP) return 0; CallService(MS_CLIST_GROUPSETFLAGS, contact->groupId, - MAKELPARAM(CLCItems_IsShowOfflineGroup(contact->group) ? 0 : GROUPF_SHOWOFFLINE, GROUPF_SHOWOFFLINE)); + 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)); + MAKELPARAM(contact->group->hideOffline ? 0 : GROUPF_HIDEOFFLINE, GROUPF_HIDEOFFLINE)); return 0; } @@ -494,17 +475,17 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - pcli->pfnEndRename(hwnd,dat,1); - KillTimer(hwnd,TIMERID_INFOTIP); - KillTimer(hwnd,TIMERID_RENAME); - cliRecalcScrollBar(hwnd,dat); - if ( g_CluiData.fDisableSkinEngine || dat->force_in_dialog ) { - RECT rc = {0}; + pcli->pfnEndRename(hwnd, dat, 1); + KillTimer(hwnd, TIMERID_INFOTIP); + KillTimer(hwnd, TIMERID_RENAME); + cliRecalcScrollBar(hwnd, dat); + if (g_CluiData.fDisableSkinEngine || dat->force_in_dialog) { + RECT rc = { 0 }; GetClientRect(hwnd, &rc); if (rc.right == 0) - return corecli.pfnContactListControlWndProc(hwnd,msg,wParam,lParam); + return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - rc.bottom = max (dat->row_min_heigh, 1); + rc.bottom = max(dat->row_min_heigh, 1); HDC hdc = GetDC(hwnd); int depth = GetDeviceCaps(hdc, BITSPIXEL); @@ -513,8 +494,8 @@ static LRESULT clcOnSize(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA HBITMAP hBmp = CreateBitmap(rc.right, rc.bottom, 1, depth, NULL); HBITMAP hBmpMask = CreateBitmap(rc.right, rc.bottom, 1, 1, NULL); HDC hdcMem = CreateCompatibleDC(hdc); - HBITMAP hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp); - HBRUSH hBrush = CreateSolidBrush(( dat->useWindowsColours || dat->force_in_dialog ) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour); + HBITMAP hoBmp = (HBITMAP)SelectObject(hdcMem, hBmp); + HBRUSH hBrush = CreateSolidBrush((dat->useWindowsColours || dat->force_in_dialog) ? GetSysColor(COLOR_HIGHLIGHT) : dat->selBkColour); FillRect(hdcMem, &rc, hBrush); DeleteObject(hBrush); @@ -544,18 +525,18 @@ static LRESULT clcOnChar(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARA // minimize clist CListMod_HideWindow(pcli->hwndContactList, SW_HIDE); } - return corecli.pfnContactListControlWndProc(hwnd,msg,wParam,lParam); + return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } static LRESULT clcOnPaint(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - if ( IsWindowVisible(hwnd)) { + if (IsWindowVisible(hwnd)) { if (!g_CluiData.fLayered || GetParent(hwnd) != pcli->hwndContactList) { PAINTSTRUCT ps; - HDC hdc = BeginPaint(hwnd,&ps); - g_clcPainter.cliPaintClc(hwnd,dat,hdc,&ps.rcPaint); - EndPaint(hwnd,&ps); + HDC hdc = BeginPaint(hwnd, &ps); + g_clcPainter.cliPaintClc(hwnd, dat, hdc, &ps.rcPaint); + EndPaint(hwnd, &ps); } - else CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE,(WPARAM)hwnd,0); + else CallService(MS_SKINENG_INVALIDATEFRAMEIMAGE, (WPARAM)hwnd, 0); } return DefWindowProc(hwnd, msg, wParam, lParam); } @@ -570,25 +551,25 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP if (wParam == VK_CONTROL) return 0; - pcli->pfnHideInfoTip(hwnd,dat); - KillTimer(hwnd,TIMERID_INFOTIP); - KillTimer(hwnd,TIMERID_RENAME); + pcli->pfnHideInfoTip(hwnd, dat); + KillTimer(hwnd, TIMERID_INFOTIP); + KillTimer(hwnd, TIMERID_RENAME); if (CallService(MS_CLIST_MENUPROCESSHOTKEY, wParam, MPCF_CONTACTMENU)) return 0; RECT clRect; - GetClientRect(hwnd,&clRect); - int pageSize = (dat->rowHeight) ? clRect.bottom/dat->rowHeight : 0; + GetClientRect(hwnd, &clRect); + int pageSize = (dat->rowHeight) ? clRect.bottom / dat->rowHeight : 0; int selMoved = 0; int changeGroupExpand = 0; - switch(wParam) { + switch (wParam) { case VK_DOWN: case VK_UP: if (dat->szQuickSearch[0] != '\0' && dat->selection != -1) { //get next contact //get next contact - int index = clcSearchNextContact(hwnd,dat,dat->selection,dat->szQuickSearch,1,(wParam == VK_UP)); + int index = clcSearchNextContact(hwnd, dat, dat->selection, dat->szQuickSearch, 1, (wParam == VK_UP)); if (index == -1) { MessageBeep(MB_OK); return 0; @@ -608,19 +589,19 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP case VK_PRIOR: dat->selection -= pageSize; selMoved = 1; break; case VK_NEXT: dat->selection += pageSize; selMoved = 1; break; case VK_HOME: dat->selection = 0; selMoved = 1; break; - case VK_END: dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1; selMoved = 1; break; + case VK_END: dat->selection = pcli->pfnGetGroupContentsCount(&dat->list, 1) - 1; selMoved = 1; break; case VK_LEFT: changeGroupExpand = 1; break; case VK_RIGHT: changeGroupExpand = 2; break; case VK_RETURN: - pcli->pfnDoSelectionDefaultAction(hwnd,dat); + pcli->pfnDoSelectionDefaultAction(hwnd, dat); SetCapture(hwnd); dat->szQuickSearch[0] = 0; if (dat->filterSearch) pcli->pfnSaveStateAndRebuildList(hwnd, dat); return 0; - case VK_F2: cliBeginRenameSelection(hwnd,dat); /*SetCapture(hwnd);*/ return 0; - case VK_DELETE: pcli->pfnDeleteFromContactList(hwnd,dat); SetCapture(hwnd);return 0; + case VK_F2: cliBeginRenameSelection(hwnd, dat); /*SetCapture(hwnd);*/ return 0; + case VK_DELETE: pcli->pfnDeleteFromContactList(hwnd, dat); SetCapture(hwnd); return 0; case VK_ESCAPE: if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { dat->iDragItem = -1; @@ -631,46 +612,46 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP return 0; default: - { - NMKEY nmkey; - nmkey.hdr.hwndFrom = hwnd; - nmkey.hdr.idFrom = GetDlgCtrlID(hwnd); - nmkey.hdr.code = NM_KEYDOWN; - nmkey.nVKey = wParam; - nmkey.uFlags = HIWORD(lParam); - - if (SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nmkey)) { - SetCapture(hwnd); - return 0; - } + { + NMKEY nmkey; + nmkey.hdr.hwndFrom = hwnd; + nmkey.hdr.idFrom = GetDlgCtrlID(hwnd); + nmkey.hdr.code = NM_KEYDOWN; + nmkey.nVKey = wParam; + nmkey.uFlags = HIWORD(lParam); + + if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nmkey)) { + SetCapture(hwnd); + return 0; } } + } if (changeGroupExpand) { ClcContact *contact; ClcGroup *group; - int hit = cliGetRowByIndex(dat,dat->selection,&contact,&group); + int hit = cliGetRowByIndex(dat, dat->selection, &contact, &group); if (hit != -1) { - if (contact->type == CLCIT_CONTACT && (contact->isSubcontact || contact->SubAllocated > 0)) { + if (contact->type == CLCIT_CONTACT && (contact->isSubcontact || contact->SubAllocated > 0)) { if (contact->isSubcontact && changeGroupExpand == 1) { dat->selection -= contact->isSubcontact; selMoved = 1; } else if (!contact->isSubcontact && contact->SubAllocated > 0) { if (changeGroupExpand == 1 && !contact->SubExpanded) { - dat->selection = cliGetRowsPriorTo(&dat->list,group,-1); + dat->selection = cliGetRowsPriorTo(&dat->list, group, -1); selMoved = 1; } else if (changeGroupExpand == 1 && contact->SubExpanded) { //Contract ClcContact *ht = NULL; - KillTimer(hwnd,TIMERID_SUBEXPAND); + KillTimer(hwnd, TIMERID_SUBEXPAND); contact->SubExpanded = 0; - db_set_b(contact->hContact,"CList","Expanded",0); + db_set_b(contact->hContact, "CList", "Expanded", 0); ht = contact; dat->needsResort = 1; - pcli->pfnSortCLC(hwnd,dat,1); - cliRecalcScrollBar(hwnd,dat); + pcli->pfnSortCLC(hwnd, dat, 1); + cliRecalcScrollBar(hwnd, dat); hitcontact = NULL; } else if (changeGroupExpand == 2 && contact->SubExpanded) { @@ -679,19 +660,19 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP } else if (changeGroupExpand == 2 && !contact->SubExpanded && dat->expandMeta) { ClcContact *ht = NULL; - KillTimer(hwnd,TIMERID_SUBEXPAND); + KillTimer(hwnd, TIMERID_SUBEXPAND); contact->SubExpanded = 1; - db_set_b(contact->hContact,"CList","Expanded",1); + db_set_b(contact->hContact, "CList", "Expanded", 1); ht = contact; dat->needsResort = 1; - pcli->pfnSortCLC(hwnd,dat,1); - cliRecalcScrollBar(hwnd,dat); + pcli->pfnSortCLC(hwnd, dat, 1); + cliRecalcScrollBar(hwnd, dat); if (ht) { ClcContact *contact2; ClcGroup *group2; - if ( FindItem(hwnd,dat,contact->hContact,&contact2,&group2,NULL,FALSE)) { - int i = cliGetRowsPriorTo(&dat->list,group2,GetContactIndex(group2,contact2)); - pcli->pfnEnsureVisible(hwnd,dat,i+contact->SubAllocated,0); + if (FindItem(hwnd, dat, contact->hContact, &contact2, &group2, NULL, FALSE)) { + int i = cliGetRowsPriorTo(&dat->list, group2, GetContactIndex(group2, contact2)); + pcli->pfnEnsureVisible(hwnd, dat, i + contact->SubAllocated, 0); } } hitcontact = NULL; @@ -700,8 +681,8 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP } else { if (changeGroupExpand == 1 && contact->type == CLCIT_CONTACT) { - if (group == &dat->list) {SetCapture(hwnd); return 0;} - dat->selection = cliGetRowsPriorTo(&dat->list,group,-1); + if (group == &dat->list) { SetCapture(hwnd); return 0; } + dat->selection = cliGetRowsPriorTo(&dat->list, group, -1); selMoved = 1; } else { @@ -711,14 +692,14 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP dat->selection--; selMoved = 1; } - else pcli->pfnSetGroupExpand(hwnd,dat,contact->group,0); + else pcli->pfnSetGroupExpand(hwnd, dat, contact->group, 0); } else if (changeGroupExpand == 2) { - pcli->pfnSetGroupExpand(hwnd,dat,contact->group,1); + pcli->pfnSetGroupExpand(hwnd, dat, contact->group, 1); dat->selection++; selMoved = 1; } - else {SetCapture(hwnd);return 0;} + else { SetCapture(hwnd); return 0; } } } } @@ -729,13 +710,13 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP } } if (selMoved) { - if (dat->selection >= pcli->pfnGetGroupContentsCount(&dat->list,1)) - dat->selection = pcli->pfnGetGroupContentsCount(&dat->list,1)-1; + if (dat->selection >= pcli->pfnGetGroupContentsCount(&dat->list, 1)) + dat->selection = pcli->pfnGetGroupContentsCount(&dat->list, 1) - 1; if (dat->selection < 0) dat->selection = 0; if (dat->bCompactMode) - SendMessage(hwnd,WM_SIZE, 0, 0); - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - pcli->pfnEnsureVisible(hwnd,dat,dat->selection,0); + SendMessage(hwnd, WM_SIZE, 0, 0); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + pcli->pfnEnsureVisible(hwnd, dat, dat->selection, 0); UpdateWindow(hwnd); SetCapture(hwnd); return 0; @@ -744,77 +725,76 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP return 0; } -void clcSetDelayTimer( UINT_PTR uIDEvent, HWND hwnd, int nDelay) +void clcSetDelayTimer(UINT_PTR uIDEvent, HWND hwnd, int nDelay) { - KillTimer( hwnd, uIDEvent ); + KillTimer(hwnd, uIDEvent); int delay = nDelay; if (delay == -1) { - switch ( uIDEvent ) { - case TIMERID_DELAYEDRESORTCLC: delay = 10; break; - case TIMERID_RECALCSCROLLBAR: delay = 10; break; - case TIMERID_REBUILDAFTER: delay = 50; break; - default: delay = 100; break; + switch (uIDEvent) { + case TIMERID_DELAYEDRESORTCLC: delay = 10; break; + case TIMERID_RECALCSCROLLBAR: delay = 10; break; + case TIMERID_REBUILDAFTER: delay = 50; break; + default: delay = 100; break; } } - CLUI_SafeSetTimer( hwnd, uIDEvent, delay, NULL ); + CLUI_SafeSetTimer(hwnd, uIDEvent, delay, NULL); } static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(wParam) { + switch (wParam) { case TIMERID_INVALIDATE_FULL: - KillTimer(hwnd,TIMERID_INVALIDATE_FULL); - pcli->pfnRecalcScrollBar(hwnd,dat); - pcli->pfnInvalidateRect(hwnd,NULL,0); + KillTimer(hwnd, TIMERID_INVALIDATE_FULL); + pcli->pfnRecalcScrollBar(hwnd, dat); + pcli->pfnInvalidateRect(hwnd, NULL, 0); return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); case TIMERID_INVALIDATE: - { - time_t cur_time = (time(NULL)/60); - if (cur_time != dat->last_tick_time) - { - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - dat->last_tick_time = cur_time; - } - return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); + { + time_t cur_time = (time(NULL) / 60); + if (cur_time != dat->last_tick_time) { + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + dat->last_tick_time = cur_time; } + return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); + } case TIMERID_SUBEXPAND: - { - ClcContact *ht = NULL; - KillTimer(hwnd,TIMERID_SUBEXPAND); - if (hitcontact && dat->expandMeta) { - if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; - db_set_b(hitcontact->hContact,"CList","Expanded",hitcontact->SubExpanded); - if (hitcontact->SubExpanded) - ht = &(hitcontact->subcontacts[hitcontact->SubAllocated-1]); - } + { + ClcContact *ht = NULL; + KillTimer(hwnd, TIMERID_SUBEXPAND); + if (hitcontact && dat->expandMeta) { + if (hitcontact->SubExpanded) hitcontact->SubExpanded = 0; else hitcontact->SubExpanded = 1; + db_set_b(hitcontact->hContact, "CList", "Expanded", hitcontact->SubExpanded); + if (hitcontact->SubExpanded) + ht = &(hitcontact->subcontacts[hitcontact->SubAllocated - 1]); + } - dat->needsResort = 1; - pcli->pfnSortCLC(hwnd,dat,1); - cliRecalcScrollBar(hwnd,dat); - if (ht) { - int i=0; - ClcContact *contact; - ClcGroup *group; - if ( FindItem(hwnd, dat, hitcontact->hContact, &contact, &group, NULL, FALSE)) { - i = cliGetRowsPriorTo(&dat->list,group,GetContactIndex(group,contact)); - pcli->pfnEnsureVisible(hwnd, dat, i+hitcontact->SubAllocated, 0); - } + dat->needsResort = 1; + pcli->pfnSortCLC(hwnd, dat, 1); + cliRecalcScrollBar(hwnd, dat); + if (ht) { + int i = 0; + ClcContact *contact; + ClcGroup *group; + if (FindItem(hwnd, dat, hitcontact->hContact, &contact, &group, NULL, FALSE)) { + i = cliGetRowsPriorTo(&dat->list, group, GetContactIndex(group, contact)); + pcli->pfnEnsureVisible(hwnd, dat, i + hitcontact->SubAllocated, 0); } - hitcontact = NULL; } + hitcontact = NULL; + } return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); case TIMERID_DELAYEDRESORTCLC: TRACE("Do sort on Timer\n"); - KillTimer(hwnd,TIMERID_DELAYEDRESORTCLC); - pcli->pfnSortCLC(hwnd,dat,1); - pcli->pfnInvalidateRect(hwnd,NULL,FALSE); + KillTimer(hwnd, TIMERID_DELAYEDRESORTCLC); + pcli->pfnSortCLC(hwnd, dat, 1); + pcli->pfnInvalidateRect(hwnd, NULL, FALSE); return 0; case TIMERID_RECALCSCROLLBAR: - KillTimer(hwnd,TIMERID_RECALCSCROLLBAR); - pcli->pfnRecalcScrollBar(hwnd,dat); + KillTimer(hwnd, TIMERID_RECALCSCROLLBAR); + pcli->pfnRecalcScrollBar(hwnd, dat); return 0; default: @@ -826,11 +806,11 @@ static LRESULT clcOnTimer(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPAR static LRESULT clcOnActivate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - TRACE ("clcOnActivate\n"); + TRACE("clcOnActivate\n"); if (dat->bCompactMode) { - cliRecalcScrollBar(hwnd,dat); - if ( dat->hwndRenameEdit == NULL ) - PostMessage( hwnd, WM_SIZE, 0, 0); + cliRecalcScrollBar(hwnd, dat); + if (dat->hwndRenameEdit == NULL) + PostMessage(hwnd, WM_SIZE, 0, 0); } dat->dragStage |= DRAGSTAGEF_SKIPRENAME; return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); @@ -841,7 +821,7 @@ static LRESULT clcOnSetCursor(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (!CLUI_IsInMainWindow(hwnd)) return DefWindowProc(hwnd, msg, wParam, lParam); - if (g_CluiData.nBehindEdgeState>0) + if (g_CluiData.nBehindEdgeState > 0) CLUI_ShowFromBehindEdge(); if (g_CluiData.bBehindEdgeSettings) @@ -855,40 +835,40 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam { POINT pt = { LOWORD(lParam), HIWORD(lParam) }; ClientToScreen(hwnd, &pt); - int k = CLUI_SizingOnBorder(pt,0); + int k = CLUI_SizingOnBorder(pt, 0); if (k) { int io = dat->iHotTrack; dat->iHotTrack = 0; if (dat->exStyle & CLS_EX_TRACKSELECT) - pcli->pfnInvalidateItem(hwnd,dat,io); + pcli->pfnInvalidateItem(hwnd, dat, io); if (k && GetCapture() == hwnd) - SendMessage(GetParent(hwnd),WM_PARENTNOTIFY,WM_LBUTTONDOWN,lParam); + SendMessage(GetParent(hwnd), WM_PARENTNOTIFY, WM_LBUTTONDOWN, lParam); return FALSE; } fMouseUpped = FALSE; - pcli->pfnHideInfoTip(hwnd,dat); - KillTimer(hwnd,TIMERID_INFOTIP); - KillTimer(hwnd,TIMERID_RENAME); - KillTimer(hwnd,TIMERID_SUBEXPAND); + pcli->pfnHideInfoTip(hwnd, dat); + KillTimer(hwnd, TIMERID_INFOTIP); + KillTimer(hwnd, TIMERID_RENAME); + KillTimer(hwnd, TIMERID_SUBEXPAND); - pcli->pfnEndRename(hwnd,dat,1); + pcli->pfnEndRename(hwnd, dat, 1); dat->ptDragStart.x = (short)LOWORD(lParam); dat->ptDragStart.y = (short)HIWORD(lParam); ClcContact *contact; ClcGroup *group; DWORD hitFlags; - int hit = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),&contact,&group,&hitFlags); + int hit = cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), &contact, &group, &hitFlags); if (GetFocus() != hwnd) SetFocus(hwnd); if (hit != -1 && !(hitFlags & CLCHT_NOWHERE)) { - if ( hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) { + if (hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) { if (!(dat->dragStage & DRAGSTAGEF_SKIPRENAME)) { SetCapture(hwnd); dat->iDragItem = dat->selection; - dat->dragStage = DRAGSTAGE_NOTMOVED|DRAGSTAGEF_MAYBERENAME; + dat->dragStage = DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME; dat->dragAutoScrolling = 0; return TRUE; } @@ -900,92 +880,90 @@ static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam } if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->SubAllocated && !contact->isSubcontact) - if (hitFlags&CLCHT_ONITEMICON && dat->expandMeta) - { - BYTE doubleClickExpand = db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT); + if (hitFlags&CLCHT_ONITEMICON && dat->expandMeta) { + BYTE doubleClickExpand = db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); - hitcontact = contact; - HitPoint.x = (short)LOWORD(lParam); - HitPoint.y = (short)HIWORD(lParam); - fMouseUpped = FALSE; - if ((GetKeyState(VK_SHIFT)&0x8000) || (GetKeyState(VK_CONTROL)&0x8000) || (GetKeyState(VK_MENU)&0x8000)) - { - fMouseUpped = TRUE; hitcontact = contact; - KillTimer(hwnd,TIMERID_SUBEXPAND); - CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND, 0, NULL); - } - } - else hitcontact = NULL; - - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP) - if (hitFlags & CLCHT_ONITEMICON) { - ClcGroup *selgroup; - ClcContact *selcontact; - dat->selection = cliGetRowByIndex(dat,dat->selection,&selcontact,&selgroup); - pcli->pfnSetGroupExpand(hwnd,dat,contact->group,-1); - if (dat->selection != -1) { - dat->selection = cliGetRowsPriorTo(&dat->list,selgroup,GetContactIndex(selgroup,selcontact)); - if (dat->selection == -1) dat->selection = cliGetRowsPriorTo(&dat->list,contact->group,-1); + HitPoint.x = (short)LOWORD(lParam); + HitPoint.y = (short)HIWORD(lParam); + fMouseUpped = FALSE; + if ((GetKeyState(VK_SHIFT) & 0x8000) || (GetKeyState(VK_CONTROL) & 0x8000) || (GetKeyState(VK_MENU) & 0x8000)) { + fMouseUpped = TRUE; + hitcontact = contact; + KillTimer(hwnd, TIMERID_SUBEXPAND); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, NULL); + } } + else hitcontact = NULL; + + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP) + if (hitFlags & CLCHT_ONITEMICON) { + ClcGroup *selgroup; + ClcContact *selcontact; + dat->selection = cliGetRowByIndex(dat, dat->selection, &selcontact, &selgroup); + pcli->pfnSetGroupExpand(hwnd, dat, contact->group, -1); + if (dat->selection != -1) { + dat->selection = cliGetRowsPriorTo(&dat->list, selgroup, GetContactIndex(selgroup, selcontact)); + if (dat->selection == -1) dat->selection = cliGetRowsPriorTo(&dat->list, contact->group, -1); + } - if (dat->bCompactMode) - SendMessage(hwnd,WM_SIZE, 0, 0); - else { - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - UpdateWindow(hwnd); - } - return TRUE; - } + if (dat->bCompactMode) + SendMessage(hwnd, WM_SIZE, 0, 0); + else { + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); + UpdateWindow(hwnd); + } + return TRUE; + } - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) { - contact->flags ^= CONTACTF_CHECKED; - if (contact->type == CLCIT_GROUP) pcli->pfnSetGroupChildCheckboxes(contact->group,contact->flags&CONTACTF_CHECKED); - pcli->pfnRecalculateGroupCheckboxes(hwnd,dat); - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) { + contact->flags ^= CONTACTF_CHECKED; + if (contact->type == CLCIT_GROUP) pcli->pfnSetGroupChildCheckboxes(contact->group, contact->flags&CONTACTF_CHECKED); + pcli->pfnRecalculateGroupCheckboxes(hwnd, dat); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); - NMCLISTCONTROL nm; - nm.hdr.code = CLN_CHECKCHANGED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = ContactToItemHandle(contact,&nm.flags); - SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); - } + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CHECKCHANGED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = ContactToItemHandle(contact, &nm.flags); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); + } - if (!(hitFlags & (CLCHT_ONITEMICON|CLCHT_ONITEMLABEL|CLCHT_ONITEMCHECK))) { - NMCLISTCONTROL nm; - nm.hdr.code = NM_CLICK; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - if (hit == -1 || hitFlags&CLCHT_NOWHERE) nm.hItem = NULL; - else nm.hItem = ContactToItemHandle(contact,&nm.flags); - nm.iColumn = hitFlags&CLCHT_ONITEMEXTRA?HIBYTE(HIWORD(hitFlags)):-1; - nm.pt = dat->ptDragStart; - SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); - } + if (!(hitFlags & (CLCHT_ONITEMICON | CLCHT_ONITEMLABEL | CLCHT_ONITEMCHECK))) { + NMCLISTCONTROL nm; + nm.hdr.code = NM_CLICK; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + if (hit == -1 || hitFlags&CLCHT_NOWHERE) nm.hItem = NULL; + else nm.hItem = ContactToItemHandle(contact, &nm.flags); + nm.iColumn = hitFlags&CLCHT_ONITEMEXTRA ? HIBYTE(HIWORD(hitFlags)) : -1; + nm.pt = dat->ptDragStart; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); + } - if (hitFlags & (CLCHT_ONITEMCHECK|CLCHT_ONITEMEXTRA)) - return FALSE; + if (hitFlags & (CLCHT_ONITEMCHECK | CLCHT_ONITEMEXTRA)) + return FALSE; - dat->selection = (hitFlags&CLCHT_NOWHERE)?-1:hit; - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + dat->selection = (hitFlags&CLCHT_NOWHERE) ? -1 : hit; + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); - UpdateWindow(hwnd); - if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA|CLCHT_ONITEMCHECK|CLCHT_NOWHERE))) { - SetCapture(hwnd); - dat->iDragItem = dat->selection; - dat->dragStage = DRAGSTAGE_NOTMOVED; - dat->dragAutoScrolling = 0; - } + UpdateWindow(hwnd); + if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA | CLCHT_ONITEMCHECK | CLCHT_NOWHERE))) { + SetCapture(hwnd); + dat->iDragItem = dat->selection; + dat->dragStage = DRAGSTAGE_NOTMOVED; + dat->dragAutoScrolling = 0; + } - if (dat->bCompactMode) - SendMessage(hwnd,WM_SIZE, 0, 0); + if (dat->bCompactMode) + SendMessage(hwnd, WM_SIZE, 0, 0); - if (dat->selection != -1) - pcli->pfnEnsureVisible(hwnd,dat,hit,0); - return TRUE; + if (dat->selection != -1) + pcli->pfnEnsureVisible(hwnd, dat, hit, 0); + return TRUE; } static LRESULT clcOnCaptureChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -995,8 +973,8 @@ static LRESULT clcOnCaptureChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa int i; i = dat->iHotTrack; dat->iHotTrack = -1; - pcli->pfnInvalidateItem(hwnd,dat,i); - pcli->pfnHideInfoTip(hwnd,dat); + pcli->pfnInvalidateItem(hwnd, dat, i); + pcli->pfnHideInfoTip(hwnd, dat); } } return 0; @@ -1005,7 +983,7 @@ static LRESULT clcOnCaptureChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wPa static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { BOOL isOutside = FALSE; - if ( CLUI_IsInMainWindow(hwnd)) { + if (CLUI_IsInMainWindow(hwnd)) { if (g_CluiData.bBehindEdgeSettings) CLUI_UpdateTimer(0); CLUI_TestCursorOnBorders(); @@ -1016,15 +994,15 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (dat->dragStage & DRAGSTAGEF_MAYBERENAME) { POINT pt = UNPACK_POINT(lParam); - if ( abs(pt.x-dat->ptDragStart.x) > GetSystemMetrics(SM_CXDOUBLECLK) || abs(pt.y-dat->ptDragStart.y) > GetSystemMetrics(SM_CYDOUBLECLK)) { - KillTimer( hwnd, TIMERID_RENAME ); + if (abs(pt.x - dat->ptDragStart.x) > GetSystemMetrics(SM_CXDOUBLECLK) || abs(pt.y - dat->ptDragStart.y) > GetSystemMetrics(SM_CYDOUBLECLK)) { + KillTimer(hwnd, TIMERID_RENAME); dat->dragStage &= (~DRAGSTAGEF_MAYBERENAME); } } if (dat->iDragItem == -1) { POINT pt = UNPACK_POINT(lParam); - ClientToScreen(hwnd,&pt); + ClientToScreen(hwnd, &pt); HWND window = WindowFromPoint(pt); if (window != hwnd) isOutside = TRUE; } @@ -1034,14 +1012,14 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, int y = (short)HIWORD(lParam); int xm = GetSystemMetrics(SM_CXDOUBLECLK); int ym = GetSystemMetrics(SM_CYDOUBLECLK); - if ( abs(HitPoint.x-x) > xm || abs(HitPoint.y-y) > ym) { + if (abs(HitPoint.x - x) > xm || abs(HitPoint.y - y) > ym) { if (fMouseUpped) { - KillTimer(hwnd,TIMERID_SUBEXPAND); - CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND, 0, NULL); + KillTimer(hwnd, TIMERID_SUBEXPAND); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, 0, NULL); fMouseUpped = FALSE; } else { - KillTimer(hwnd,TIMERID_SUBEXPAND); + KillTimer(hwnd, TIMERID_SUBEXPAND); hitcontact = NULL; fMouseUpped = FALSE; } @@ -1052,10 +1030,10 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, DWORD flag = 0; int iOldHotTrack = dat->iHotTrack; - if (dat->hwndRenameEdit != NULL || GetKeyState(VK_MENU)&0x8000 || GetKeyState(VK_F10)&0x8000) + if (dat->hwndRenameEdit != NULL || GetKeyState(VK_MENU) & 0x8000 || GetKeyState(VK_F10) & 0x8000) return 0; - dat->iHotTrack = isOutside ? -1 : cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),NULL,NULL,&flag); + dat->iHotTrack = isOutside ? -1 : cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, &flag); if (flag&CLCHT_NOWHERE) dat->iHotTrack = -1; @@ -1068,8 +1046,8 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, ReleaseCapture(); if (dat->exStyle & CLS_EX_TRACKSELECT) { - pcli->pfnInvalidateItem(hwnd,dat,iOldHotTrack); - pcli->pfnInvalidateItem(hwnd,dat,dat->iHotTrack); + pcli->pfnInvalidateItem(hwnd, dat, iOldHotTrack); + pcli->pfnInvalidateItem(hwnd, dat, dat->iHotTrack); } pcli->pfnHideInfoTip(hwnd, dat); @@ -1080,49 +1058,49 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (wParam == 0 && dat->hInfoTipItem == NULL) { dat->ptInfoTip.x = (short)LOWORD(lParam); dat->ptInfoTip.y = (short)HIWORD(lParam); - CLUI_SafeSetTimer(hwnd,TIMERID_INFOTIP,dat->infoTipTimeout,NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_INFOTIP, dat->infoTipTimeout, NULL); } return 0; } if ((dat->dragStage&DRAGSTAGEM_STAGE) == DRAGSTAGE_NOTMOVED && !(dat->exStyle&CLS_EX_DISABLEDRAGDROP)) - if (abs((short)LOWORD(lParam)-dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG) || abs((short)HIWORD(lParam)-dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG)) - dat->dragStage = (dat->dragStage&~DRAGSTAGEM_STAGE)|DRAGSTAGE_ACTIVE; + if (abs((short)LOWORD(lParam) - dat->ptDragStart.x) >= GetSystemMetrics(SM_CXDRAG) || abs((short)HIWORD(lParam) - dat->ptDragStart.y) >= GetSystemMetrics(SM_CYDRAG)) + dat->dragStage = (dat->dragStage&~DRAGSTAGEM_STAGE) | DRAGSTAGE_ACTIVE; if ((dat->dragStage&DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { RECT clRect; - GetClientRect(hwnd,&clRect); + GetClientRect(hwnd, &clRect); POINT pt = UNPACK_POINT(lParam); HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO); - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); if (dat->dragAutoScrolling) { - KillTimer(hwnd,TIMERID_DRAGAUTOSCROLL); + KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); dat->dragAutoScrolling = 0; } - int target = GetDropTargetInformation(hwnd,dat,pt); + int target = GetDropTargetInformation(hwnd, dat, pt); if (dat->dragStage&DRAGSTAGEF_OUTSIDE && target != DROPTARGET_OUTSIDE) { NMCLISTCONTROL nm; ClcContact *contact; - cliGetRowByIndex(dat,dat->iDragItem,&contact,NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contact, NULL); nm.hdr.code = CLN_DRAGSTOP; nm.hdr.hwndFrom = hwnd; nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; - nm.hItem = ContactToItemHandle(contact,&nm.flags); - SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); + nm.hItem = ContactToItemHandle(contact, &nm.flags); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); dat->dragStage &= ~DRAGSTAGEF_OUTSIDE; } - switch(target) { + switch (target) { case DROPTARGET_ONSELF: break; case DROPTARGET_ONCONTACT: - if ( ServiceExists(MS_MC_ADDTOMETA)) { + if (ServiceExists(MS_MC_ADDTOMETA)) { ClcContact *contSour; - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) { + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else @@ -1132,11 +1110,11 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONMETACONTACT: - if ( ServiceExists(MS_MC_ADDTOMETA)) { + if (ServiceExists(MS_MC_ADDTOMETA)) { ClcContact *contSour, *contDest; - cliGetRowByIndex(dat,dat->selection,&contDest,NULL); - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) { + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else if (contSour->subcontacts == contDest) @@ -1148,11 +1126,11 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONSUBCONTACT: - if ( ServiceExists(MS_MC_ADDTOMETA)) { - ClcContact *contSour,*contDest; + if (ServiceExists(MS_MC_ADDTOMETA)) { + ClcContact *contSour, *contDest; cliGetRowByIndex(dat, dat->selection, &contDest, NULL); cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); - if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) { + if (contSour->type == CLCIT_CONTACT && g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); /// Add to meta else if (contDest->subcontacts == contSour->subcontacts) @@ -1172,39 +1150,38 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_OUTSIDE: - { - ClcContact *contact; + { + ClcContact *contact; - if (pt.x >= 0 && pt.x < clRect.right && ((pt.y < 0 && pt.y>-dat->dragAutoScrollHeight) || (pt.y >= clRect.bottom && pt.y < clRect.bottom+dat->dragAutoScrollHeight))) { - if (!dat->dragAutoScrolling) { - dat->dragAutoScrolling = (pt.y < 0) ? -1 : 1; - CLUI_SafeSetTimer(hwnd,TIMERID_DRAGAUTOSCROLL,dat->scrollTime,NULL); - } - SendMessage(hwnd,WM_TIMER,TIMERID_DRAGAUTOSCROLL,0); + if (pt.x >= 0 && pt.x < clRect.right && ((pt.y < 0 && pt.y>-dat->dragAutoScrollHeight) || (pt.y >= clRect.bottom && pt.y < clRect.bottom + dat->dragAutoScrollHeight))) { + if (!dat->dragAutoScrolling) { + dat->dragAutoScrolling = (pt.y < 0) ? -1 : 1; + CLUI_SafeSetTimer(hwnd, TIMERID_DRAGAUTOSCROLL, dat->scrollTime, NULL); } - - dat->dragStage |= DRAGSTAGEF_OUTSIDE; - cliGetRowByIndex(dat,dat->iDragItem,&contact,NULL); - - NMCLISTCONTROL nm; - nm.hdr.code = CLN_DRAGGING; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = ContactToItemHandle(contact,&nm.flags); - nm.pt = pt; - if (SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm)) - return 0; + SendMessage(hwnd, WM_TIMER, TIMERID_DRAGAUTOSCROLL, 0); } + + dat->dragStage |= DRAGSTAGEF_OUTSIDE; + cliGetRowByIndex(dat, dat->iDragItem, &contact, NULL); + + NMCLISTCONTROL nm; + nm.hdr.code = CLN_DRAGGING; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = ContactToItemHandle(contact, &nm.flags); + nm.pt = pt; + if (SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm)) + return 0; + } break; default: ClcGroup *group = NULL; - cliGetRowByIndex(dat,dat->iDragItem,NULL,&group); - if (group && group->parent) - { + cliGetRowByIndex(dat, dat->iDragItem, NULL, &group); + if (group && group->parent) { ClcContact *contSour; - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); if (!contSour->isSubcontact) hNewCursor = LoadCursor(GetModuleHandle(NULL), MAKEINTRESOURCE(IDC_DROPUSER)); } @@ -1223,8 +1200,8 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, fMouseUpped = TRUE; if (hitcontact != NULL && dat->expandMeta) { - BYTE doubleClickExpand = db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT); - CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND,GetDoubleClickTime()*doubleClickExpand,NULL); + BYTE doubleClickExpand = db_get_b(NULL, "CLC", "MetaDoubleClick", SETTING_METAAVOIDDBLCLICK_DEFAULT); + CLUI_SafeSetTimer(hwnd, TIMERID_SUBEXPAND, GetDoubleClickTime()*doubleClickExpand, NULL); } else if (dat->iHotTrack == -1 && dat->iDragItem == -1) ReleaseCapture(); @@ -1232,61 +1209,61 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (dat->iDragItem == -1) return 0; - SetCursor((HCURSOR)GetClassLongPtr(hwnd,GCLP_HCURSOR)); + SetCursor((HCURSOR)GetClassLongPtr(hwnd, GCLP_HCURSOR)); if (dat->exStyle & CLS_EX_TRACKSELECT) { DWORD flags; - dat->iHotTrack = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),NULL,NULL,&flags); + dat->iHotTrack = cliHitTest(hwnd, dat, (short)LOWORD(lParam), (short)HIWORD(lParam), NULL, NULL, &flags); if (dat->iHotTrack == -1) ReleaseCapture(); } else if (hitcontact == NULL) ReleaseCapture(); - KillTimer(hwnd,TIMERID_DRAGAUTOSCROLL); + KillTimer(hwnd, TIMERID_DRAGAUTOSCROLL); if (dat->dragStage == (DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME)) - CLUI_SafeSetTimer(hwnd,TIMERID_RENAME,GetDoubleClickTime(),NULL); + CLUI_SafeSetTimer(hwnd, TIMERID_RENAME, GetDoubleClickTime(), NULL); else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { TCHAR Wording[500]; int res = 0; POINT pt = UNPACK_POINT(lParam); - int target = GetDropTargetInformation(hwnd,dat,pt); - switch(target) { + int target = GetDropTargetInformation(hwnd, dat, pt); + switch (target) { case DROPTARGET_ONSELF: break; case DROPTARGET_ONCONTACT: - if ( ServiceExists(MS_MC_ADDTOMETA)) { + if (ServiceExists(MS_MC_ADDTOMETA)) { ClcContact *contDest, *contSour; int res; MCONTACT handle, hcontact; - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); - cliGetRowByIndex(dat,dat->selection,&contDest,NULL); + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); hcontact = contSour->hContact; if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && mir_strcmp(contSour->proto,g_szMetaModuleName)) { + if (g_szMetaModuleName && mir_strcmp(contSour->proto, g_szMetaModuleName)) { if (!contSour->isSubcontact) { MCONTACT hDest = contDest->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it?"),contDest->szText, contSour->szText); - res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION); + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it?"), contDest->szText, contSour->szText); + res = MessageBox(hwnd, Wording, TranslateT("Converting to MetaContact"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) { - handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hDest,0); + handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hDest, 0); if (!handle) return 0; - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); } } else { hcontact = contSour->hContact; MCONTACT hfrom = contSour->subcontacts->hContact; MCONTACT hdest = contDest->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it (remove it from '%s')?"), contDest->szText,contSour->szText,contSour->subcontacts->szText); - res = MessageBox(hwnd,Wording,TranslateT("Converting to MetaContact (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be converted to MetaContact and '%s' be added to it (remove it from '%s')?"), contDest->szText, contSour->szText, contSour->subcontacts->szText); + res = MessageBox(hwnd, Wording, TranslateT("Converting to MetaContact (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) { - MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA,(WPARAM)hdest,0); + MCONTACT handle = (MCONTACT)CallService(MS_MC_CONVERTTOMETA, (WPARAM)hdest, 0); if (!handle) return 0; CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact); - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); } } } @@ -1295,83 +1272,83 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_ONMETACONTACT: - { - ClcContact *contDest, *contSour; - int res; - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); - cliGetRowByIndex(dat,dat->selection,&contDest,NULL); - if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) { - if (!contSour->isSubcontact) { + { + ClcContact *contDest, *contSour; + int res; + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + if (contSour->type == CLCIT_CONTACT) { + if (g_szMetaModuleName && strcmp(contSour->proto, g_szMetaModuleName)) { + if (!contSour->isSubcontact) { + MCONTACT hcontact = contSour->hContact; + MCONTACT handle = contDest->hContact; + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"), contSour->szText, contDest->szText); + res = MessageBox(hwnd, Wording, TranslateT("Adding contact to MetaContact"), MB_OKCANCEL | MB_ICONQUESTION); + if (res == 1) { + if (!handle) return 0; + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); + } + } + else { + if (contSour->subcontacts == contDest) { + MCONTACT hsour = contSour->hContact; + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be default?"), contSour->szText); + res = MessageBox(hwnd, Wording, TranslateT("Set default contact"), MB_OKCANCEL | MB_ICONQUESTION); + if (res == 1) + CallService(MS_MC_SETDEFAULTCONTACT, (WPARAM)contDest->hContact, (LPARAM)hsour); + } + else { MCONTACT hcontact = contSour->hContact; + MCONTACT hfrom = contSour->subcontacts->hContact; MCONTACT handle = contDest->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to metacontact '%s'?"),contSour->szText, contDest->szText); - res = MessageBox(hwnd,Wording,TranslateT("Adding contact to MetaContact"),MB_OKCANCEL|MB_ICONQUESTION); + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->szText); + res = MessageBox(hwnd, Wording, TranslateT("Changing MetaContacts (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); if (res == 1) { if (!handle) return 0; - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); - } - } - else { - if (contSour->subcontacts == contDest) { - MCONTACT hsour = contSour->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be default?"),contSour->szText); - res = MessageBox(hwnd,Wording,TranslateT("Set default contact"),MB_OKCANCEL|MB_ICONQUESTION); - if (res == 1) - CallService(MS_MC_SETDEFAULTCONTACT,(WPARAM)contDest->hContact,(LPARAM)hsour); - } - else { - MCONTACT hcontact = contSour->hContact; - MCONTACT hfrom = contSour->subcontacts->hContact; - MCONTACT handle = contDest->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->szText); - res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); - if (res == 1) { - if (!handle) return 0; - - CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact); - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); - } + + CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact); + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); } } } } } + } break; case DROPTARGET_ONSUBCONTACT: - { - ClcContact *contDest, *contSour; - cliGetRowByIndex(dat,dat->iDragItem,&contSour,NULL); - cliGetRowByIndex(dat,dat->selection,&contDest,NULL); - if (contSour->type == CLCIT_CONTACT) { - if (g_szMetaModuleName && strcmp(contSour->proto,g_szMetaModuleName)) { - if (!contSour->isSubcontact) { - MCONTACT hcontact = contSour->hContact; - MCONTACT handle = contDest->subcontacts->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be added to MetaContact '%s'?"), contSour->szText,contDest->subcontacts->szText); - int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); - if (res == 1) { - if (!handle) return 0; - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); - } + { + ClcContact *contDest, *contSour; + cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); + cliGetRowByIndex(dat, dat->selection, &contDest, NULL); + if (contSour->type == CLCIT_CONTACT) { + if (g_szMetaModuleName && strcmp(contSour->proto, g_szMetaModuleName)) { + if (!contSour->isSubcontact) { + MCONTACT hcontact = contSour->hContact; + MCONTACT handle = contDest->subcontacts->hContact; + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be added to MetaContact '%s'?"), contSour->szText, contDest->subcontacts->szText); + int res = MessageBox(hwnd, Wording, TranslateT("Changing MetaContacts (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); + if (res == 1) { + if (!handle) return 0; + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); } - else if (contSour->subcontacts != contDest->subcontacts) { - MCONTACT hcontact = contSour->hContact; - MCONTACT hfrom = contSour->subcontacts->hContact; - MCONTACT handle = contDest->subcontacts->hContact; - mir_sntprintf(Wording,SIZEOF(Wording),TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText,contSour->subcontacts->szText,contDest->subcontacts->szText); - int res = MessageBox(hwnd,Wording,TranslateT("Changing MetaContacts (Moving)"),MB_OKCANCEL|MB_ICONQUESTION); - if (res == 1) { - if (!handle) return 0; - - CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact); - CallService(MS_MC_ADDTOMETA,(WPARAM)hcontact,(LPARAM)handle); - } + } + else if (contSour->subcontacts != contDest->subcontacts) { + MCONTACT hcontact = contSour->hContact; + MCONTACT hfrom = contSour->subcontacts->hContact; + MCONTACT handle = contDest->subcontacts->hContact; + mir_sntprintf(Wording, SIZEOF(Wording), TranslateT("Do you want contact '%s' to be removed from MetaContact '%s' and added to '%s'?"), contSour->szText, contSour->subcontacts->szText, contDest->subcontacts->szText); + int res = MessageBox(hwnd, Wording, TranslateT("Changing MetaContacts (Moving)"), MB_OKCANCEL | MB_ICONQUESTION); + if (res == 1) { + if (!handle) return 0; + + CallService(MS_MC_REMOVEFROMMETA, 0, (LPARAM)hcontact); + CallService(MS_MC_ADDTOMETA, (WPARAM)hcontact, (LPARAM)handle); } } } } + } break; case DROPTARGET_ONGROUP: @@ -1379,38 +1356,39 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, break; case DROPTARGET_INSERTION: - { - ClcContact *contact, *destcontact; - ClcGroup *group, *destgroup; - BOOL NeedRename = FALSE; - TCHAR newName[128] = {0}; - int newIndex,i; - pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); - i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); - if (i != -1 && group->groupId != destgroup->groupId) { - TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId,0)); - TCHAR *shortGroup = NULL; - TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId,0)); - if (groupName) { - int len = (int)_tcslen(groupName); - do {len--;}while(len >= 0 && groupName[len] != '\\'); - if (len >= 0) shortGroup = groupName+len+1; - else shortGroup = groupName; - } - if (shortGroup) { - NeedRename = TRUE; - if (sourceGrName) - mir_sntprintf(newName,SIZEOF(newName),_T("%s\\%s"),sourceGrName,shortGroup); - else - mir_sntprintf(newName,SIZEOF(newName),_T("%s"),shortGroup); - } - mir_free(groupName); - mir_free(sourceGrName); + { + ClcContact *contact, *destcontact; + ClcGroup *group, *destgroup; + BOOL NeedRename = FALSE; + TCHAR newName[128] = { 0 }; + int newIndex, i; + pcli->pfnGetRowByIndex(dat, dat->iDragItem, &contact, &group); + i = pcli->pfnGetRowByIndex(dat, dat->iInsertionMark, &destcontact, &destgroup); + if (i != -1 && group->groupId != destgroup->groupId) { + TCHAR *groupName = mir_tstrdup(pcli->pfnGetGroupName(contact->groupId, 0)); + TCHAR *shortGroup = NULL; + TCHAR *sourceGrName = mir_tstrdup(pcli->pfnGetGroupName(destgroup->groupId, 0)); + if (groupName) { + int len = (int)_tcslen(groupName); + do { len--; } + while (len >= 0 && groupName[len] != '\\'); + if (len >= 0) shortGroup = groupName + len + 1; + else shortGroup = groupName; } - newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1)?destcontact->groupId:0); - newIndex = newIndex?newIndex:contact->groupId; - if (NeedRename) pcli->pfnRenameGroup(newIndex,newName); + if (shortGroup) { + NeedRename = TRUE; + if (sourceGrName) + mir_sntprintf(newName, SIZEOF(newName), _T("%s\\%s"), sourceGrName, shortGroup); + else + mir_sntprintf(newName, SIZEOF(newName), _T("%s"), shortGroup); + } + mir_free(groupName); + mir_free(sourceGrName); } + newIndex = CallService(MS_CLIST_GROUPMOVEBEFORE, contact->groupId, (destcontact && i != -1) ? destcontact->groupId : 0); + newIndex = newIndex ? newIndex : contact->groupId; + if (NeedRename) pcli->pfnRenameGroup(newIndex, newName); + } break; case DROPTARGET_OUTSIDE: @@ -1423,7 +1401,7 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } } - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); dat->iDragItem = -1; dat->iInsertionMark = -1; return 0; @@ -1431,14 +1409,14 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, static LRESULT clcOnLButtonDblClick(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - KillTimer(hwnd,TIMERID_SUBEXPAND); + KillTimer(hwnd, TIMERID_SUBEXPAND); hitcontact = NULL; return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } static LRESULT clcOnDestroy(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - for (int i=0; i <= FONTID_MODERN_MAX; i++) { + for (int i = 0; i <= FONTID_MODERN_MAX; i++) { if (dat->fontModernInfo[i].hFont) DeleteObject(dat->fontModernInfo[i].hFont); dat->fontModernInfo[i].hFont = NULL; @@ -1490,10 +1468,10 @@ static LRESULT clcOnIntmGroupChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM w nm.hdr.idFrom = GetDlgCtrlID(hwnd); nm.flags = 0; nm.hItem = (HANDLE)wParam; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) & nm); + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm); dat->needsResort = 1; } - SetTimer(hwnd,TIMERID_REBUILDAFTER,1,NULL); + SetTimer(hwnd, TIMERID_REBUILDAFTER, 1, NULL); return 0; } @@ -1503,28 +1481,24 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP ClcGroup *group = NULL; int recalcScrollBar = 0, shouldShow; BOOL needRepaint = FALSE; - WORD status; - RECT iconRect = {0}; + RECT iconRect = { 0 }; int contacticon = corecli.pfnGetContactIcon(wParam); MCONTACT hSelItem = NULL; ClcContact *selcontact = NULL; char *szProto = GetContactProto(wParam); - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = GetContactCachedStatus(wParam); + WORD status = (szProto == NULL) ? ID_STATUS_OFFLINE : GetContactCachedStatus(wParam); BOOL image_is_special = (LOWORD(contacticon) != (LOWORD(lParam))); //check only base icons int nHiddenStatus = CLVM_GetContactHiddenStatus(wParam, szProto, dat); DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - bool isVisiblebyFilter = (( ( style & CLS_SHOWHIDDEN ) && nHiddenStatus != -1 ) || !nHiddenStatus ); - bool ifVisibleByClui = !pcli->pfnIsHiddenMode( dat, status ); + bool isVisiblebyFilter = (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus); + bool ifVisibleByClui = !pcli->pfnIsHiddenMode(dat, status); bool isVisible = g_CluiData.bFilterEffective&CLVM_FILTER_STATUS ? TRUE : ifVisibleByClui; bool isIconChanged = cli_GetContactIcon(wParam) != LOWORD(lParam); - shouldShow = isVisiblebyFilter && ( isVisible || isIconChanged ) ; + shouldShow = isVisiblebyFilter && (isVisible || isIconChanged); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown @@ -1548,6 +1522,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP //item in list already if (contact->iImage == lParam) return 0; + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline) && clcItemNotHiddenOffline(dat, group, contact)) shouldShow = TRUE; @@ -1578,20 +1553,20 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP if (hSelItem) { ClcGroup *selgroup; if (pcli->pfnFindItem(hwnd, dat, hSelItem, &selcontact, &selgroup, NULL)) - dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf(( SortedList* )&selgroup->cl, selcontact)); + dat->selection = pcli->pfnGetRowsPriorTo(&dat->list, selgroup, List_IndexOf((SortedList*)&selgroup->cl, selcontact)); else dat->selection = -1; } if (dat->needsResort) { TRACE("Sort required\n"); - clcSetDelayTimer( TIMERID_DELAYEDRESORTCLC, hwnd ); + clcSetDelayTimer(TIMERID_DELAYEDRESORTCLC, hwnd); } else if (needRepaint) { if (contact && contact->pos_icon.bottom != 0 && contact->pos_icon.right != 0) - CLUI__cliInvalidateRect(hwnd,&(contact->pos_icon),FALSE); + CLUI__cliInvalidateRect(hwnd, &(contact->pos_icon), FALSE); else - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); //try only needed rectangle } @@ -1614,12 +1589,12 @@ static LRESULT clcOnIntmTimeZoneChanged(ClcData *dat, HWND hwnd, UINT msg, WPARA { ClcContact *contact; if (!FindItem(hwnd, dat, wParam, &contact, NULL, NULL, FALSE)) - return corecli.pfnContactListControlWndProc(hwnd,msg,wParam,lParam); + return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); if (contact) { - Cache_GetTimezone(dat,contact->hContact); - Cache_GetText(dat, contact,1); - cliRecalcScrollBar(hwnd,dat); + Cache_GetTimezone(dat, contact->hContact); + Cache_GetText(dat, contact, 1); + cliRecalcScrollBar(hwnd, dat); } return 0; } @@ -1636,8 +1611,8 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); if (contact) { - Cache_GetText(dat,contact,1); - cliRecalcScrollBar(hwnd,dat); + Cache_GetText(dat, contact, 1); + cliRecalcScrollBar(hwnd, dat); } dat->needsResort = 1; pcli->pfnSortContacts(); @@ -1652,16 +1627,17 @@ static LRESULT clcOnIntmApparentModeChanged(ClcData *dat, HWND hwnd, UINT msg, W static LRESULT clcOnIntmStatusMsgChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM hContact, LPARAM lParam) { - ClcContact *contact; if (hContact == NULL || IsHContactInfo(hContact) || IsHContactGroup(hContact)) return corecli.pfnContactListControlWndProc(hwnd, msg, hContact, lParam); - if (!FindItem(hwnd,dat,hContact,&contact,NULL,NULL,FALSE)) + + ClcContact *contact; + if (!FindItem(hwnd, dat, hContact, &contact, NULL, NULL, FALSE)) return corecli.pfnContactListControlWndProc(hwnd, msg, hContact, lParam); - if (contact)//!IsBadWritePtr(contact, sizeof(ClcContact))) - { - Cache_GetText(dat,contact,1); - cliRecalcScrollBar(hwnd,dat); - PostMessage(hwnd,INTM_INVALIDATE, 0, 0); + + if (contact) { + Cache_GetText(dat, contact, 1); + cliRecalcScrollBar(hwnd, dat); + PostMessage(hwnd, INTM_INVALIDATE, 0, 0); } return corecli.pfnContactListControlWndProc(hwnd, msg, hContact, lParam); } @@ -1669,8 +1645,8 @@ static LRESULT clcOnIntmStatusMsgChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; - ClcContact *contact; + ClcContact *contact; if (!FindItem(hwnd, dat, wParam, &contact, NULL, NULL, TRUE)) return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); @@ -1682,7 +1658,7 @@ static LRESULT clcOnIntmNotOnListChanged(ClcData *dat, HWND hwnd, UINT msg, WPAR else contact->flags |= CONTACTF_NOTONLIST; - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + CLUI__cliInvalidateRect(hwnd, NULL, FALSE); return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } @@ -1703,7 +1679,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM if (wParam != 0) { ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(wParam); if (pdnce && pdnce->m_cache_cszProto) { - pdnce___SetStatus( pdnce, GetStatusForContact(pdnce->hContact,pdnce->m_cache_cszProto)); + pdnce___SetStatus(pdnce, GetStatusForContact(pdnce->hContact, pdnce->m_cache_cszProto)); if (!dat->force_in_dialog && (dat->second_line_show || dat->third_line_show)) gtaRenewText(pdnce->hContact); SendMessage(hwnd, INTM_ICONCHANGED, wParam, corecli.pfnGetContactIcon(wParam)); @@ -1711,7 +1687,7 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM ClcContact *contact; if (FindItem(hwnd, dat, wParam, &contact, NULL, NULL, TRUE)) { if (contact && contact->type == CLCIT_CONTACT) { - if (!contact->image_is_special && pdnce___GetStatus( pdnce ) > ID_STATUS_OFFLINE) + if (!contact->image_is_special && pdnce___GetStatus(pdnce) > ID_STATUS_OFFLINE) contact->iImage = corecli.pfnGetContactIcon(wParam); if (contact->isSubcontact && contact->subcontacts && contact->subcontacts->type == CLCIT_CONTACT) pcli->pfnClcBroadcast(INTM_STATUSCHANGED, (WPARAM)contact->subcontacts->hContact, 0); //forward status changing to host meta contact @@ -1720,11 +1696,11 @@ 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); + if (db_get_b(NULL, "CList", "PlaceOfflineToRoot", SETTING_PLACEOOFLINETOROOT_DEFAULT)) + SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0); else { pcli->pfnSortContacts(); - PostMessage(hwnd,INTM_INVALIDATE, 0, 0); + PostMessage(hwnd, INTM_INVALIDATE, 0, 0); } return ret; } @@ -1732,10 +1708,10 @@ static LRESULT clcOnIntmStatusChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM static LRESULT clcOnIntmReloadOptions(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); - pcli->pfnLoadClcOptions(hwnd,dat); - LoadCLCOptions(hwnd,dat); - pcli->pfnSaveStateAndRebuildList(hwnd,dat); - pcli->pfnSortCLC(hwnd,dat,1); + pcli->pfnLoadClcOptions(hwnd, dat); + LoadCLCOptions(hwnd, dat); + pcli->pfnSaveStateAndRebuildList(hwnd, dat); + pcli->pfnSortCLC(hwnd, dat, 1); if (IsWindowVisible(hwnd)) pcli->pfnInvalidateRect(GetParent(hwnd), NULL, FALSE); return TRUE; @@ -1755,10 +1731,10 @@ HRESULT ClcLoadModule() int ClcUnloadModule() { - if ( g_CluiData.bOldUseGroups != (BYTE)-1 ) - db_set_b(NULL,"CList","UseGroups",(BYTE)g_CluiData.bOldUseGroups ); - if ( g_CluiData.boldHideOffline != (BYTE)-1 ) - db_set_b(NULL,"CList","HideOffline",(BYTE)g_CluiData.boldHideOffline ); + if (g_CluiData.bOldUseGroups != (BYTE)-1) + db_set_b(NULL, "CList", "UseGroups", (BYTE)g_CluiData.bOldUseGroups); + if (g_CluiData.boldHideOffline != (BYTE)-1) + db_set_b(NULL, "CList", "HideOffline", (BYTE)g_CluiData.boldHideOffline); return 0; } @@ -1768,9 +1744,9 @@ int ClcDoProtoAck(MCONTACT wParam, ACKDATA * ack) if (MirandaExiting()) return 0; if (ack->type == ACKTYPE_STATUS) { if (ack->result == ACKRESULT_SUCCESS) { - for (int i=0; i < pcli->hClcProtoCount; i++) { + for (int i = 0; i < pcli->hClcProtoCount; i++) { if (!lstrcmpA(pcli->clcProto[i].szProto, ack->szModule)) { - pcli->clcProto[i].dwStatus = (WORD) ack->lParam; + pcli->clcProto[i].dwStatus = (WORD)ack->lParam; if (pcli->clcProto[i].dwStatus >= ID_STATUS_OFFLINE) pcli->pfnTrayIconUpdateBase(pcli->clcProto[i].szProto); return 0; @@ -1782,10 +1758,10 @@ int ClcDoProtoAck(MCONTACT wParam, ACKDATA * ack) if (ack->result == ACKRESULT_SUCCESS && ack->lParam) { //Do not change DB if it is IRC protocol if (ack->szModule != NULL) - if ( db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) + if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; - db_set_ws(ack->hContact,"CList","StatusMsg",(const TCHAR *)ack->lParam); + db_set_ws(ack->hContact, "CList", "StatusMsg", (const TCHAR *)ack->lParam); gtaRenewText(ack->hContact); } else { @@ -1793,27 +1769,27 @@ int ClcDoProtoAck(MCONTACT wParam, ACKDATA * ack) //char a = '\0'; //Do not change DB if it is IRC protocol if (ack->szModule != NULL) - if ( db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) + if (db_get_b(ack->hContact, ack->szModule, "ChatRoom", 0) != 0) return 0; if (ack->hContact) { - char * val = db_get_sa(ack->hContact,"CList","StatusMsg"); + char * val = db_get_sa(ack->hContact, "CList", "StatusMsg"); if (val) { - if (!mir_bool_strcmpi(val,"")) - db_set_s(ack->hContact,"CList","StatusMsg",""); + if (!mir_bool_strcmpi(val, "")) + db_set_s(ack->hContact, "CList", "StatusMsg", ""); else gtaRenewText(ack->hContact); mir_free(val); } } - //pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED,(WPARAM)ack->hContact,&a); + //pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED,(WPARAM)ack->hContact,&a); } } else if (ack->type == ACKTYPE_AVATAR) { if (ack->result == ACKRESULT_SUCCESS) { PROTO_AVATAR_INFORMATIONT *pai = (PROTO_AVATAR_INFORMATIONT*)ack->hProcess; if (pai != NULL && pai->hContact != NULL) - pcli->pfnClcBroadcast( INTM_AVATARCHANGED,(WPARAM)pai->hContact,0); + pcli->pfnClcBroadcast(INTM_AVATARCHANGED, (WPARAM)pai->hContact, 0); } } else if (ack->type == ACKTYPE_EMAIL) { @@ -1824,7 +1800,9 @@ int ClcDoProtoAck(MCONTACT wParam, ACKDATA * ack) int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData) { - if (!pData || !pShortData) return -1; + if (!pData || !pShortData) + return -1; + pShortData->hWnd = pData->hWnd; pShortData->text_replace_smileys = pData->text_replace_smileys; pShortData->text_smiley_height = pData->text_smiley_height; @@ -1835,7 +1813,7 @@ int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData) pShortData->second_line_draw_smileys = pData->second_line_draw_smileys; pShortData->second_line_type = pData->second_line_type; - _tcsncpy(pShortData->second_line_text,pData->second_line_text,TEXT_TEXT_MAX_LENGTH); + _tcsncpy(pShortData->second_line_text, pData->second_line_text, TEXT_TEXT_MAX_LENGTH); pShortData->second_line_xstatus_has_priority = pData->second_line_xstatus_has_priority; pShortData->second_line_show_status_if_no_away = pData->second_line_show_status_if_no_away; @@ -1846,24 +1824,24 @@ int ClcGetShortData(ClcData* pData, struct SHORTDATA *pShortData) pShortData->third_line_draw_smileys = pData->third_line_draw_smileys; pShortData->third_line_type = pData->third_line_type; - _tcsncpy(pShortData->third_line_text,pData->third_line_text,TEXT_TEXT_MAX_LENGTH); + _tcsncpy(pShortData->third_line_text, pData->third_line_text, TEXT_TEXT_MAX_LENGTH); pShortData->third_line_xstatus_has_priority = pData->third_line_xstatus_has_priority; pShortData->third_line_show_status_if_no_away = pData->third_line_show_status_if_no_away; pShortData->third_line_show_listening_if_no_away = pData->third_line_show_listening_if_no_away; pShortData->third_line_use_name_and_message_for_xstatus = pData->third_line_use_name_and_message_for_xstatus; - return 0; } - - int ClcEnterDragToScroll(HWND hwnd, int Y) { - ClcData *dat; - if (IsDragToScrollMode) return 0; - dat = (ClcData*)GetWindowLongPtr(hwnd,0); - if (!dat) return 0; + if (IsDragToScrollMode) + return 0; + + ClcData *dat = (ClcData*)GetWindowLongPtr(hwnd, 0); + if (!dat) + return 0; + StartDragPos = Y; StartScrollPos = dat->yScroll; IsDragToScrollMode = 1; @@ -1880,41 +1858,41 @@ LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wPara #define CASE_MSG_RET(msg, handler) case msg: return handler(dat, hwnd, msg, wParam, lParam); - ClcData *dat = (ClcData*)GetWindowLongPtr(hwnd,0); + ClcData *dat = (ClcData*)GetWindowLongPtr(hwnd, 0); if (msg >= CLM_FIRST && msg < CLM_LAST) - return cli_ProcessExternalMessages(hwnd,dat,msg,wParam,lParam); + return cli_ProcessExternalMessages(hwnd, dat, msg, wParam, lParam); switch (msg) { - CASE_MSG_RET( INTM_GROUPCHANGED, clcOnIntmGroupChanged ); - CASE_MSG_RET( INTM_ICONCHANGED, clcOnIntmIconChanged ); - CASE_MSG_RET( INTM_AVATARCHANGED, clcOnIntmAvatarChanged ); - CASE_MSG_RET( INTM_TIMEZONECHANGED, clcOnIntmTimeZoneChanged ); - CASE_MSG_RET( INTM_NAMECHANGED, clcOnIntmNameChanged ); - CASE_MSG_RET( INTM_APPARENTMODECHANGED, clcOnIntmApparentModeChanged ); - CASE_MSG_RET( INTM_STATUSMSGCHANGED, clcOnIntmStatusMsgChanged ); - CASE_MSG_RET( INTM_NOTONLISTCHANGED, clcOnIntmNotOnListChanged ); - CASE_MSG_RET( INTM_SCROLLBARCHANGED, clcOnIntmScrollBarChanged ); - CASE_MSG_RET( INTM_STATUSCHANGED, clcOnIntmStatusChanged ); - CASE_MSG_RET( INTM_RELOADOPTIONS, clcOnIntmReloadOptions ); - - CASE_MSG_RET( WM_CREATE, clcOnCreate ); - CASE_MSG_RET( WM_NCHITTEST, clcOnHitTest ); - CASE_MSG_RET( WM_COMMAND, clcOnCommand ); - CASE_MSG_RET( WM_SIZE, clcOnSize ); - CASE_MSG_RET( WM_CHAR, clcOnChar ); - CASE_MSG_RET( WM_PAINT, clcOnPaint ); - CASE_MSG_RET( WM_ERASEBKGND, clcOnEraseBkGround ); - CASE_MSG_RET( WM_KEYDOWN, clcOnKeyDown ); - CASE_MSG_RET( WM_TIMER, clcOnTimer ); - CASE_MSG_RET( WM_ACTIVATE, clcOnActivate ); - CASE_MSG_RET( WM_SETCURSOR, clcOnSetCursor ); - CASE_MSG_RET( WM_LBUTTONDOWN, clcOnLButtonDown ); - CASE_MSG_RET( WM_CAPTURECHANGED, clcOnCaptureChanged ); - CASE_MSG_RET( WM_MOUSEMOVE, clcOnMouseMove ); - CASE_MSG_RET( WM_LBUTTONUP, clcOnLButtonUp ); - CASE_MSG_RET( WM_LBUTTONDBLCLK, clcOnLButtonDblClick ); - CASE_MSG_RET( WM_DESTROY, clcOnDestroy ); + CASE_MSG_RET(INTM_GROUPCHANGED, clcOnIntmGroupChanged); + CASE_MSG_RET(INTM_ICONCHANGED, clcOnIntmIconChanged); + CASE_MSG_RET(INTM_AVATARCHANGED, clcOnIntmAvatarChanged); + CASE_MSG_RET(INTM_TIMEZONECHANGED, clcOnIntmTimeZoneChanged); + CASE_MSG_RET(INTM_NAMECHANGED, clcOnIntmNameChanged); + CASE_MSG_RET(INTM_APPARENTMODECHANGED, clcOnIntmApparentModeChanged); + CASE_MSG_RET(INTM_STATUSMSGCHANGED, clcOnIntmStatusMsgChanged); + CASE_MSG_RET(INTM_NOTONLISTCHANGED, clcOnIntmNotOnListChanged); + CASE_MSG_RET(INTM_SCROLLBARCHANGED, clcOnIntmScrollBarChanged); + CASE_MSG_RET(INTM_STATUSCHANGED, clcOnIntmStatusChanged); + CASE_MSG_RET(INTM_RELOADOPTIONS, clcOnIntmReloadOptions); + + CASE_MSG_RET(WM_CREATE, clcOnCreate); + CASE_MSG_RET(WM_NCHITTEST, clcOnHitTest); + CASE_MSG_RET(WM_COMMAND, clcOnCommand); + CASE_MSG_RET(WM_SIZE, clcOnSize); + CASE_MSG_RET(WM_CHAR, clcOnChar); + CASE_MSG_RET(WM_PAINT, clcOnPaint); + CASE_MSG_RET(WM_ERASEBKGND, clcOnEraseBkGround); + CASE_MSG_RET(WM_KEYDOWN, clcOnKeyDown); + CASE_MSG_RET(WM_TIMER, clcOnTimer); + CASE_MSG_RET(WM_ACTIVATE, clcOnActivate); + CASE_MSG_RET(WM_SETCURSOR, clcOnSetCursor); + CASE_MSG_RET(WM_LBUTTONDOWN, clcOnLButtonDown); + CASE_MSG_RET(WM_CAPTURECHANGED, clcOnCaptureChanged); + CASE_MSG_RET(WM_MOUSEMOVE, clcOnMouseMove); + CASE_MSG_RET(WM_LBUTTONUP, clcOnLButtonUp); + CASE_MSG_RET(WM_LBUTTONDBLCLK, clcOnLButtonDblClick); + CASE_MSG_RET(WM_DESTROY, clcOnDestroy); default: return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index af33864e6f..0b4813f8e7 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -242,7 +242,7 @@ INT_PTR CLUI::Service_Menu_ShowContactAvatar(WPARAM hContact, LPARAM lParam) { db_set_b(hContact, "CList", "HideContactAvatar", 0); - pcli->pfnClcBroadcast( INTM_AVATARCHANGED, hContact, 0); + pcli->pfnClcBroadcast(INTM_AVATARCHANGED, hContact, 0); return 0; } @@ -250,7 +250,7 @@ INT_PTR CLUI::Service_Menu_HideContactAvatar(WPARAM hContact, LPARAM lParam) { db_set_b(hContact, "CList", "HideContactAvatar", 1); - pcli->pfnClcBroadcast( INTM_AVATARCHANGED, hContact, 0); + pcli->pfnClcBroadcast(INTM_AVATARCHANGED, hContact, 0); return 0; } @@ -2176,7 +2176,7 @@ LRESULT CLUI::OnDelayedSizingTimer(UINT msg, WPARAM wParam, LPARAM lParam) if (mutex_bDelayedSizing && !mutex_bDuringSizing) { mutex_bDelayedSizing = 0; KillTimer( m_hWnd,TM_DELAYEDSIZING ); - pcli->pfnClcBroadcast( INTM_SCROLLBARCHANGED, 0, 0 ); + pcli->pfnClcBroadcast(INTM_SCROLLBARCHANGED, 0, 0 ); } return TRUE; } diff --git a/plugins/Clist_modern/src/modern_skineditor.cpp b/plugins/Clist_modern/src/modern_skineditor.cpp index 574bc362f5..04c8e00c86 100644 --- a/plugins/Clist_modern/src/modern_skineditor.cpp +++ b/plugins/Clist_modern/src/modern_skineditor.cpp @@ -747,7 +747,7 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM StoreTreeToDB(GetDlgItem(hwndDlg,IDC_OBJECT_TREE),SKIN); //ReloadSkin ske_LoadSkinFromDB(); - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0); Sync(CLUIFrames_OnClistResize_mod, 0, 0); ske_RedrawCompleteWindow(); Sync(CLUIFrames_OnClistResize_mod, 0, 0); diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 7f4528d0bf..a1289008a9 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -176,7 +176,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara ske_LoadSkinFromIniFile( sd->File, FALSE ); ske_LoadSkinFromDB(); glOtherSkinWasLoaded = TRUE; - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 ); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0 ); Sync( CLUIFrames_OnClistResize_mod, 0, 0 ); ske_RedrawCompleteWindow( ); Sync( CLUIFrames_OnClistResize_mod, 0, 0 ); @@ -341,9 +341,9 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 ); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0 ); NotifyEventHooks( g_CluiData.hEventBkgrChanged, 0, 0 ); - pcli->pfnClcBroadcast( INTM_INVALIDATE, 0, 0 ); + pcli->pfnClcBroadcast(INTM_INVALIDATE, 0, 0 ); RedrawWindow( GetParent( pcli->hwndContactTree ), NULL, NULL, RDW_INVALIDATE|RDW_FRAME|RDW_ALLCHILDREN ); } break; @@ -519,7 +519,7 @@ INT_PTR SvcApplySkin(WPARAM wParam, LPARAM lParam) ske_LoadSkinFromIniFile((TCHAR *)lParam, FALSE); ske_LoadSkinFromDB( ); glOtherSkinWasLoaded = TRUE; - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 ); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, 0, 0 ); Sync( CLUIFrames_OnClistResize_mod, 0, 0 ); ske_RedrawCompleteWindow( ); Sync( CLUIFrames_OnClistResize_mod, 0, 0 ); diff --git a/plugins/Clist_modern/src/modern_toolbar.cpp b/plugins/Clist_modern/src/modern_toolbar.cpp index 80c7d474b0..787a6c06a7 100644 --- a/plugins/Clist_modern/src/modern_toolbar.cpp +++ b/plugins/Clist_modern/src/modern_toolbar.cpp @@ -114,10 +114,10 @@ static tbdat = { NULL, CLCDEFAULT_BKCOLOUR, CLCDEFAULT_BKBMPUSE, CLCDEFAULT_USEW COLORREF sttGetColor(char * module, char * color, COLORREF defColor); -static int ehhToolBarSettingsChanged(WPARAM wParam, LPARAM lParam) +static int ehhToolBarSettingsChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if ((HANDLE)wParam != NULL) + if (hContact != NULL) return 0; if (!mir_strcmp(cws->szModule,"CList")) { diff --git a/plugins/Clist_mw/src/clc.cpp b/plugins/Clist_mw/src/clc.cpp index e0fe218ebb..eb93367b70 100644 --- a/plugins/Clist_mw/src/clc.cpp +++ b/plugins/Clist_mw/src/clc.cpp @@ -93,18 +93,18 @@ void SortClcByTimer (HWND hwnd) SetTimer(hwnd,TIMERID_DELAYEDRESORTCLC,db_get_b(NULL,"CLUI","DELAYEDTIMER",200),NULL); } -static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) +static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - if ((HANDLE)wParam != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle")) + if (hContact != NULL && !strcmp(cws->szModule,"MetaContacts") && !strcmp(cws->szSetting,"Handle")) pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, 0, 0 ); - if ((HANDLE)wParam != NULL && !strcmp(cws->szModule,"CList")) { + if (hContact != NULL && !strcmp(cws->szModule,"CList")) { if ( !strcmp( cws->szSetting, "noOffline" )) - pcli->pfnClcBroadcast( INTM_NAMEORDERCHANGED, wParam, lParam ); + pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); else if ( !strcmp(cws->szSetting,"StatusMsg")) - pcli->pfnClcBroadcast( INTM_STATUSMSGCHANGED, wParam, lParam ); + pcli->pfnClcBroadcast(INTM_STATUSMSGCHANGED, hContact, lParam); } return 0; } diff --git a/plugins/Clist_mw/src/clui.cpp b/plugins/Clist_mw/src/clui.cpp index f7d929cce5..ca39b38253 100644 --- a/plugins/Clist_mw/src/clui.cpp +++ b/plugins/Clist_mw/src/clui.cpp @@ -334,12 +334,12 @@ int CreateTimerForConnectingIcon(WPARAM wParam, LPARAM lParam) // Restore protocols to the last global status. // Used to reconnect on restore after standby. -int OnSettingChanging(WPARAM wParam, LPARAM lParam) +int OnSettingChanging(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; - if (wParam == 0) { - if ((dbcws->value.type == DBVT_BYTE)&&!strcmp(dbcws->szModule,"CLUI")) { - if ( !strcmp(dbcws->szSetting,"SBarShow")) { + if (hContact == 0) { + if ((dbcws->value.type == DBVT_BYTE) && !strcmp(dbcws->szModule,"CLUI")) { + if (!strcmp(dbcws->szSetting,"SBarShow")) { showOpts = dbcws->value.bVal; return 0; } diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index f9550d81c4..9a21399db8 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -68,24 +68,24 @@ int __forceinline __strcmp(const char * src, const char * dst) return(ret); } -static int ClcEventAdded(WPARAM wParam, LPARAM lParam) +static int ClcEventAdded(WPARAM hContact, LPARAM lParam) { DWORD new_freq = 0; cfg::dat.t_now = time(NULL); - if (wParam && lParam) { + if (hContact && lParam) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - DWORD firstTime = cfg::getDword(wParam, "CList", "mf_firstEvent", 0); - DWORD count = cfg::getDword(wParam, "CList", "mf_count", 0); + DWORD firstTime = cfg::getDword(hContact, "CList", "mf_firstEvent", 0); + DWORD count = cfg::getDword(hContact, "CList", "mf_count", 0); count++; new_freq = count ? (dbei.timestamp - firstTime) / count : 0x7fffffff; - cfg::writeDword(wParam, "CList", "mf_freq", new_freq); - cfg::writeDword(wParam, "CList", "mf_count", count); + cfg::writeDword(hContact, "CList", "mf_freq", new_freq); + cfg::writeDword(hContact, "CList", "mf_count", count); - TExtraCache *p = cfg::getCache(wParam, NULL); + TExtraCache *p = cfg::getCache(hContact, NULL); if (p) { p->dwLastMsgTime = dbei.timestamp; if (new_freq) @@ -97,67 +97,67 @@ static int ClcEventAdded(WPARAM wParam, LPARAM lParam) return 0; } -static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) +static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { char *szProto = NULL; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - if (wParam) { + if (hContact) { if ( !__strcmp(cws->szModule, "CList")) { if ( !__strcmp(cws->szSetting, "StatusMsg")) - SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, wParam, lParam); + SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); } else if ( !__strcmp(cws->szModule, "UserInfo")) { if ( !__strcmp(cws->szSetting, "ANSIcodepage")) - pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, wParam, lParam); + pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, hContact, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo(wParam); + ReloadExtraInfo(hContact); } - else if (wParam != 0 && (szProto = GetContactProto(wParam)) != NULL) { + else if (hContact != 0 && (szProto = GetContactProto(hContact)) != NULL) { char *id = NULL; if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; - pcli->pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); + pcli->pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); if (cws->value.type == DBVT_DELETED) szProto_s = NULL; else szProto_s = cws->value.pszVal; - pcli->pfnChangeContactIcon(wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord(wParam, szProto_s, "Status", ID_STATUS_OFFLINE), wParam, NULL), 0); + pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord(hContact, szProto_s, "Status", ID_STATUS_OFFLINE), hContact, NULL), 0); } // something is being written to a protocol module if ( !__strcmp(szProto, cws->szModule)) { // was a unique setting key written? - pcli->pfnInvalidateDisplayNameCacheEntry(wParam); + pcli->pfnInvalidateDisplayNameCacheEntry(hContact); if ( !__strcmp(cws->szSetting, "Status")) { - if (!cfg::getByte(wParam, "CList", "Hidden", 0)) { + if (!cfg::getByte(hContact, "CList", "Hidden", 0)) { if (cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) { // User's state is changing, and we are hideOffline-ing if (cws->value.wVal == ID_STATUS_OFFLINE) { - pcli->pfnChangeContactIcon(wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, wParam, NULL), 0); - CallService(MS_CLUI_CONTACTDELETED, wParam, 0); + pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 0); + CallService(MS_CLUI_CONTACTDELETED, hContact, 0); return 0; } - pcli->pfnChangeContactIcon(wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, wParam, NULL), 1); + pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 1); } - pcli->pfnChangeContactIcon(wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, wParam, NULL), 0); + pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(cws->szModule, cws->value.wVal, hContact, NULL), 0); } - SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, wParam, lParam); + SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, hContact, lParam); return 0; } else if (strstr("YMsg|StatusDescr|XStatusMsg", cws->szSetting)) - SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, wParam, lParam); + SendMessage(pcli->hwndContactTree, INTM_STATUSMSGCHANGED, hContact, lParam); else if (strstr(cws->szSetting, "XStatus")) - SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, wParam, lParam); + SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, hContact, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo(wParam); + ReloadExtraInfo(hContact); if (cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, cfg::dat.szMetaName)) { if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting)) - pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, wParam, lParam); + pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam); } } if (cfg::dat.bMetaAvail && cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, cfg::dat.szMetaName) && !__strcmp(cws->szSetting, "IsSubcontact")) - pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam); + pcli->pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); } } else if (!__strcmp(cws->szModule, cfg::dat.szMetaName)) { @@ -178,7 +178,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int ClcPreshutdown(WPARAM wParam, LPARAM lParam) +static int ClcPreshutdown(WPARAM, LPARAM) { cfg::shutDown = TRUE; if (hSvc_GetContactStatusMsg) @@ -186,7 +186,7 @@ static int ClcPreshutdown(WPARAM wParam, LPARAM lParam) return 0; } -int ClcShutdown(WPARAM wParam, LPARAM lParam) +int ClcShutdown(WPARAM, LPARAM) { DeleteObject(cfg::dat.hPen3DBright); DeleteObject(cfg::dat.hPen3DDark); diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index e4398e6e06..07d9597b96 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -151,12 +151,12 @@ static int HookModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -static int HookContactSettingChanged(WPARAM wParam, LPARAM lParam) +static int HookContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; - char *szProto = GetContactProto(wParam); - - if (strcmpnull(cws->szModule, "CList") && strcmpnull(cws->szModule, szProto)) return 0; + char *szProto = GetContactProto(hContact); + if (strcmpnull(cws->szModule, "CList") && strcmpnull(cws->szModule, szProto)) + return 0; WindowList_Broadcast(ghSendWindowList, DM_UPDATETITLE, 0, 0); WindowList_Broadcast(ghRecvWindowList, DM_UPDATETITLE, 0, 0); diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp index d58e49de07..5d27b1bdbb 100644 --- a/plugins/CountryFlags/src/extraimg.cpp +++ b/plugins/CountryFlags/src/extraimg.cpp @@ -160,14 +160,14 @@ static int StatusIconsChanged(WPARAM wParam,LPARAM lParam) return 0; } -static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam) +static int ExtraImgSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam; - if (wParam != NULL) { + if (hContact) { /* user details update */ if (!lstrcmpA(dbcws->szSetting,"RealIP") || !lstrcmpA(dbcws->szSetting,"Country") || !lstrcmpA(dbcws->szSetting,"CompanyCountry")) { /* Extra Image */ - SetExtraImage(wParam); + SetExtraImage(hContact); /* Status Icon */ if (ServiceExists(MS_MSG_REMOVEICON)) CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY); diff --git a/plugins/FileAsMessage/src/main.cpp b/plugins/FileAsMessage/src/main.cpp index 7eb1768619..bf734f56fc 100644 --- a/plugins/FileAsMessage/src/main.cpp +++ b/plugins/FileAsMessage/src/main.cpp @@ -50,15 +50,12 @@ int OnSkinIconsChanged(WPARAM wParam,LPARAM lParam) return 0; } -int OnSettingChanged(WPARAM wParam,LPARAM lParam) +int OnSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - HWND hwnd = WindowList_Find(hFileList,wParam); + HWND hwnd = WindowList_Find(hFileList, hContact); PostMessage(hwnd, WM_FE_STATUSCHANGE, 0,0); - //OnSkinIconsChanged(0,0); - //PostMessage(hwnd, WM_FE_SKINCHANGE, 0,0); - return 0; } diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 416aa4857f..ff267bbc3c 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -226,7 +226,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact); int idStatus = ID_STATUS_OFFLINE; BOOL bRefresh = TRUE; - DBCONTACTWRITESETTING* pdbcws = (DBCONTACTWRITESETTING*)lParam; + DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam; if (hContact == NULL) { if (( 0 == _stricmp( pdbcws->szModule, "CLC" )) || ( 0 == _stricmp( pdbcws->szModule, MODULE )) ) { @@ -242,25 +242,15 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) // Only on these 2 events we need to refresh if (0 == _stricmp(pdbcws->szSetting, "Status")) - { idStatus = pdbcws->value.wVal; - } else if (0 == _stricmp(pdbcws->szSetting, "Nick")) - { idStatus = GetContactStatus(hContact); - } else if (0 == _stricmp(pdbcws->szSetting, "MyHandle")) - { idStatus = GetContactStatus(hContact); - } else if (fcOpt.bShowIdle && 0 == _stricmp( pdbcws->szSetting, "IdleTS")) - { idStatus = GetContactStatus(hContact); - } else - { bRefresh = FALSE; - } // Detach call if (bRefresh) diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index f1d892945c..c6147c64c4 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -945,9 +945,8 @@ void SetExtraIcon(MCONTACT hContact, BOOL set) ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL); } -int SettingChanged(WPARAM wParam,LPARAM lParam) +int SettingChanged(WPARAM hContact,LPARAM lParam) { - MCONTACT hContact = (MCONTACT) wParam; if (hContact == NULL) return 0; diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp index a1622e3879..9ebcba682d 100644 --- a/plugins/Rate/src/main.cpp +++ b/plugins/Rate/src/main.cpp @@ -112,12 +112,12 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam) return 0; } -int onContactSettingChanged(WPARAM wParam,LPARAM lParam) +int onContactSettingChanged(WPARAM hContact,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - if (wParam != NULL && !lstrcmpA(cws->szModule,"CList") && !lstrcmpA(cws->szSetting,"Rate")) - setExtraIcon(wParam, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal); + if (hContact != NULL && !lstrcmpA(cws->szModule,"CList") && !lstrcmpA(cws->szSetting,"Rate")) + setExtraIcon(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal); return 0; } diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 04ee5376fd..df99310e5c 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -415,11 +415,9 @@ INT_PTR OnMenuCommandShowList(WPARAM wParam, LPARAM lParam) return 0; } -static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam ) +static int OnContactSettingChanged( WPARAM hContact, LPARAM lParam ) { - HANDLE hContact = ( HANDLE )wParam; DBCONTACTWRITESETTING* pdbcws = ( DBCONTACTWRITESETTING* )lParam; - if ( hContact == NULL ) if ( !stricmp( pdbcws->szModule, dbLastUC_ModuleName)) LoadDBSettings(); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 82164abd1b..b5aad3f530 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -242,13 +242,12 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) return 0; } -static int MessageSettingChanged(WPARAM wParam, LPARAM lParam) +static int MessageSettingChanged(WPARAM hContact, LPARAM lParam) { - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - char *szProto = GetContactProto(wParam); - if (lstrcmpA(cws->szModule, "CList") && (szProto == NULL || lstrcmpA(cws->szModule, szProto))) - return 0; - WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, wParam, lParam); + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam; + char *szProto = GetContactProto(hContact); + if (!lstrcmpA(cws->szModule, "CList") && !lstrcmpA(cws->szModule, szProto)) + WindowList_Broadcast(g_dat.hMessageWindowList, DM_CLISTSETTINGSCHANGED, hContact, lParam); return 0; } diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index 80b736c44f..1d24cb7b8c 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -543,12 +543,12 @@ static void waitThread(void *param) mir_free(infoParam); } -int UpdateValues(WPARAM wparam,LPARAM lparam) +int UpdateValues(WPARAM hContact,LPARAM lparam) { // to make this code faster - if (!wparam) return 0; + if (!hContact) + return 0; - MCONTACT hContact = (MCONTACT)wparam; DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING *)lparam; //if (CallService(MS_IGNORE_ISIGNORED,hContact,IGNOREEVENT_USERONLINE)) return 0; BOOL isIdleEvent = includeIdle?(strcmp(cws->szSetting,"IdleTS")==0):0; diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 03cc73334e..d0779d747b 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -186,9 +186,8 @@ MIRANDA_HOOK_EVENT(ME_OPT_INITIALISE, w, l) return 0; } -MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) +MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, hContact, l) { - MCONTACT hContact = (MCONTACT)w; DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)l; // if CList/NotOnList is being deleted then remove answeredSetting diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1422425ce2..1136cdab6a 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -393,20 +393,19 @@ int CGlobals::ModulesLoaded(WPARAM wParam, LPARAM lParam) // needed to catch status, nickname and other changes in order to update open message // sessions. -int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) +int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; const char *szProto = NULL; const char *setting = cws->szSetting; - HWND hwnd = 0; CContactCache* c = 0; - bool fChanged = false, fNickChanged = false, fExtendedStatusChange = false; + bool fChanged = false, fNickChanged = false, fExtendedStatusChange = false; - hwnd = M.FindWindow(wParam); + HWND hwnd = M.FindWindow(hContact); - if (hwnd == 0 && wParam != 0) { // we are not interested in this event if there is no open message window/tab + if (hwnd == 0 && hContact != 0) { // we are not interested in this event if there is no open message window/tab if (!strcmp(setting, "Status") || !strcmp(setting, "MyHandle") || !strcmp(setting, "Nick") || !strcmp(cws->szModule, SRMSGMOD_T)) { - c = CContactCache::getContactCache(wParam); + c = CContactCache::getContactCache(hContact); if (c) { fChanged = c->updateStatus(); if (strcmp(setting, "Status")) @@ -418,13 +417,13 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) return 0; } - if (wParam == 0 && !strcmp("Nick", setting)) { + if (hContact == 0 && !strcmp("Nick", setting)) { M.BroadcastMessage(DM_OWNNICKCHANGED, 0, (LPARAM)cws->szModule); return 0; } - if (wParam) { - c = CContactCache::getContactCache(wParam); + if (hContact) { + c = CContactCache::getContactCache(hContact); if (c) { szProto = c->getProto(); if (!strcmp(cws->szModule, SRMSGMOD_T)) { // catch own relevant settings @@ -434,7 +433,7 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) } } - if (wParam == 0 && !lstrcmpA(setting, "Enabled")) { + if (hContact == 0 && !lstrcmpA(setting, "Enabled")) { if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) { // catch the disabled meta contacts PluginConfig.bMetaEnabled = abs(M.GetByte(PluginConfig.szMetaName, "Enabled", -1)); CContactCache::cacheUpdateMetaChanged(); @@ -445,7 +444,7 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) return 0; if (PluginConfig.g_MetaContactsAvail && !lstrcmpA(cws->szModule, PluginConfig.szMetaName)) - if (wParam != 0 && !lstrcmpA(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact + if (hContact != 0 && !lstrcmpA(setting, "Nick")) // filter out this setting to avoid infinite loops while trying to obtain the most online contact return 0; if (hwnd) { @@ -497,10 +496,10 @@ int CGlobals::DBSettingChanged(WPARAM wParam, LPARAM lParam) ///////////////////////////////////////////////////////////////////////////////////////// // event fired when a contact has been deleted. Make sure to close its message session -int CGlobals::DBContactDeleted(WPARAM wParam, LPARAM lParam) +int CGlobals::DBContactDeleted(WPARAM hContact, LPARAM lParam) { - if (wParam) { - CContactCache *c = CContactCache::getContactCache(wParam); + if (hContact) { + CContactCache *c = CContactCache::getContactCache(hContact); if (c) c->deletedHandler(); } @@ -512,10 +511,10 @@ int CGlobals::DBContactDeleted(WPARAM wParam, LPARAM lParam) // our contact cache and, if a message window exists, tell it to update // relevant information. -int CGlobals::MetaContactEvent(WPARAM wParam, LPARAM lParam) +int CGlobals::MetaContactEvent(WPARAM hContact, LPARAM lParam) { - if (wParam) { - CContactCache *c = CContactCache::getContactCache(wParam); + if (hContact) { + CContactCache *c = CContactCache::getContactCache(hContact); if (c) { c->updateMeta(true); if (c->getHwnd()) { diff --git a/plugins/TipperYM/src/tipper.cpp b/plugins/TipperYM/src/tipper.cpp index e49d0de5c5..822775154f 100644 --- a/plugins/TipperYM/src/tipper.cpp +++ b/plugins/TipperYM/src/tipper.cpp @@ -94,7 +94,7 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) } // hack to hide tip when clist hides from timeout -int SettingChanged(WPARAM wParam, LPARAM lParam) +int SettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dcws = (DBCONTACTWRITESETTING *)lParam; if (strcmp(dcws->szModule, "CList") != 0 || strcmp(dcws->szSetting, "State") != 0) diff --git a/plugins/TopToolBar/src/InternalButtons.cpp b/plugins/TopToolBar/src/InternalButtons.cpp index 5ee174c7e1..528554d87c 100644 --- a/plugins/TopToolBar/src/InternalButtons.cpp +++ b/plugins/TopToolBar/src/InternalButtons.cpp @@ -28,10 +28,10 @@ static stdButtons[] = /////////////////////////////////////////////////////////////////////////////// -int OnSettingChanging(WPARAM wParam, LPARAM lParam) +int OnSettingChanging(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; - if (wParam != 0 || dbcws == NULL) + if (hContact != 0 || dbcws == NULL) return 0; if ( !strcmp(dbcws->szModule, "CList")) { diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index bf48a674eb..75da95834c 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -163,9 +163,9 @@ static int OnStatusIconsChanged(WPARAM wParam, LPARAM lParam) * misc functions ***********************************************************************************************************/ -static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) +static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) { - if ((HANDLE)wParam == NULL) + if (hContact == NULL) return 0; /* user details update */ @@ -175,12 +175,12 @@ static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) !lstrcmpA(dbcws->szSetting, SET_CONTACT_COMPANY_COUNTRY)) { /* Extra Image */ - SetExtraImage(wParam); + SetExtraImage(hContact); /* Status Icon */ - int i = gMsgWndList.getIndex((MsgWndData*)&wParam); + int i = gMsgWndList.getIndex((MsgWndData*)&hContact); if (i != -1) { - gMsgWndList[i]->ContryIDchange((int)ServiceDetectContactOriginCountry(wParam, 0)); + gMsgWndList[i]->ContryIDchange((int)ServiceDetectContactOriginCountry(hContact, 0)); gMsgWndList[i]->FlagsIconSet(); } } diff --git a/plugins/UserInfoEx/src/svc_contactinfo.cpp b/plugins/UserInfoEx/src/svc_contactinfo.cpp index ed30f18c8d..92ccdf4050 100644 --- a/plugins/UserInfoEx/src/svc_contactinfo.cpp +++ b/plugins/UserInfoEx/src/svc_contactinfo.cpp @@ -717,9 +717,9 @@ static INT_PTR GetContactSettingStrExService(WPARAM wParam, LPARAM lParam) * @return 0 **/ -static int OnSettingChanged(WPARAM wParam, LPARAM lParam) +static int OnSettingChanged(WPARAM hContact, LPARAM lParam) { - if ((HANDLE)wParam == NULL) { + if (hContact == NULL) { DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*) lParam; if (!mir_strcmp(pdbcws->szModule, "Contact") && !mir_strcmp(pdbcws->szSetting, "NameOrder")) memcpy(gNameOrder, pdbcws->value.pbVal, pdbcws->value.cpbVal); diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp index e245862d39..71be90da7a 100644 --- a/plugins/WhenWasIt/src/hooked_events.cpp +++ b/plugins/WhenWasIt/src/hooked_events.cpp @@ -63,12 +63,12 @@ static int OnOptionsInitialise(WPARAM wParam, LPARAM lParam) return 0; } -static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) +static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *dw = (DBCONTACTWRITESETTING *) lParam; DBVARIANT dv = dw->value; if ((strcmp(dw->szModule, DUMMY_MODULE) == 0) && (strcmp(dw->szSetting, DUMMY_SETTING) == 0)) - RefreshContactListIcons(wParam); + RefreshContactListIcons(hContact); return 0; } diff --git a/plugins/ZeroNotification/src/main.cpp b/plugins/ZeroNotification/src/main.cpp index 4703795c22..9a79a2af02 100644 --- a/plugins/ZeroNotification/src/main.cpp +++ b/plugins/ZeroNotification/src/main.cpp @@ -105,10 +105,11 @@ static void UpdateMenuItem() } //Called when the sound setting in the database is changed -static int SoundSettingChanged(WPARAM wParam,LPARAM lParam) +static int SoundSettingChanged(WPARAM hContact,LPARAM lParam) { DBCONTACTWRITESETTING *cws=(DBCONTACTWRITESETTING*)lParam; - if(lstrcmpA(cws->szModule, "Skin") || lstrcmpA(cws->szSetting, "UseSound")) return 0; + if(lstrcmpA(cws->szModule, "Skin") || lstrcmpA(cws->szSetting, "UseSound")) + return 0; UpdateMenuItem(); return 0; diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index dac87bdf52..8b7e3aa0cb 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -2572,7 +2572,7 @@ void CIcqProto::resetServContactAuthState(MCONTACT hContact, DWORD dwUin) * */ -int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) +int CIcqProto::ServListDbSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING* cws = (DBCONTACTWRITESETTING*)lParam; @@ -2590,28 +2590,19 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!strcmpnull(cws->szModule, "CList")) { // Has contact been renamed? - if (!strcmpnull(cws->szSetting, "MyHandle") && - getByte("StoreServerDetails", DEFAULT_SS_STORE)) - { // Update contact's details in server-list - servlistUpdateContact(wParam); - } + if (!strcmpnull(cws->szSetting, "MyHandle") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) + servlistUpdateContact(hContact); // Update contact's details in server-list // Has contact been moved to another group? - if (!strcmpnull(cws->szSetting, "Group") && - getByte("StoreServerDetails", DEFAULT_SS_STORE)) - { // Read group from DB - char* szNewGroup = getContactCListGroup(wParam); - + if (!strcmpnull(cws->szSetting, "Group") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) { + char* szNewGroup = getContactCListGroup(hContact); // Read group from DB SAFE_FREE(&szNewGroup); } } - else if (!strcmpnull(cws->szModule, "UserInfo")) - { - if (!strcmpnull(cws->szSetting, "MyNotes") && - getByte("StoreServerDetails", DEFAULT_SS_STORE)) - { // Update contact's details in server-list - servlistUpdateContact(wParam); - } + else if (!strcmpnull(cws->szModule, "UserInfo")) { + // Update contact's details in server-list + if (!strcmpnull(cws->szSetting, "MyNotes") && getByte("StoreServerDetails", DEFAULT_SS_STORE)) + servlistUpdateContact(hContact); } return 0; diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 8e9aca7833..e806efb274 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -152,18 +152,18 @@ void CYahooProto::ShowError(const TCHAR *title, const TCHAR *buff) ShowNotification(title, buff, NIIF_ERROR); } -int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) +int __cdecl CYahooProto::OnSettingChanged(WPARAM hContact, LPARAM lParam) { - if (!wParam || !m_bLoggedIn) + if (!hContact || !m_bLoggedIn) return 0; - DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*) lParam; + DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam; if ( !strcmp(cws->szSetting, "ApparentMode")) { debugLogA("DB Setting changed. YAHOO user's visible setting changed."); DBVARIANT dbv; - if (!getString(wParam, YAHOO_LOGINID, &dbv)) { - int iAdd = (ID_STATUS_OFFLINE == getWord(wParam, "ApparentMode", 0)); + if (!getString(hContact, YAHOO_LOGINID, &dbv)) { + int iAdd = (ID_STATUS_OFFLINE == getWord(hContact, "ApparentMode", 0)); stealth(dbv.pszVal, iAdd); db_free(&dbv); } diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index 6d0fe461b1..0592f10ffb 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -68,54 +68,54 @@ HMENU fnBuildGroupPopupMenu(ClcGroup* group) ///////////////////////////////////////////////////////////////////////////////////////// // standard CLC services -static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) +static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; - if ((HANDLE)wParam == NULL) { + if (hContact == NULL) { if (!strcmp(cws->szModule, "CListGroups")) - cli.pfnClcBroadcast(INTM_GROUPSCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_GROUPSCHANGED, hContact, lParam); return 0; } if (!strcmp(cws->szModule, "CList")) { if (!strcmp(cws->szSetting, "MyHandle")) { - cli.pfnInvalidateDisplayNameCacheEntry(wParam); - cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam); + cli.pfnInvalidateDisplayNameCacheEntry(hContact); + cli.pfnClcBroadcast(INTM_NAMECHANGED, hContact, lParam); } else if (!strcmp(cws->szSetting, "Group")) - cli.pfnClcBroadcast(INTM_GROUPCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_GROUPCHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "Hidden")) - cli.pfnClcBroadcast(INTM_HIDDENCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_HIDDENCHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "NotOnList")) - cli.pfnClcBroadcast(INTM_NOTONLISTCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_NOTONLISTCHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "Status")) cli.pfnClcBroadcast(INTM_INVALIDATE, 0, 0); else if (!strcmp(cws->szSetting, "NameOrder")) cli.pfnClcBroadcast(INTM_NAMEORDERCHANGED, 0, 0); } else { - char *szProto = GetContactProto(wParam); + char *szProto = GetContactProto(hContact); if (szProto != NULL) { if (!strcmp(cws->szModule, "Protocol") && !strcmp(cws->szSetting, "p")) - cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); // something is being written to a protocol module if (!strcmp(szProto, cws->szModule)) { // was a unique setting key written? char *id = (char *) CallProtoServiceInt(NULL,szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)id != CALLSERVICE_NOTFOUND && id != NULL && !strcmp(id, cws->szSetting)) - cli.pfnClcBroadcast(INTM_PROTOCHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_PROTOCHANGED, hContact, lParam); } } if (szProto == NULL || strcmp(szProto, cws->szModule)) return 0; if (!strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "e-mail") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "UIN")) - cli.pfnClcBroadcast(INTM_NAMECHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_NAMECHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "ApparentMode")) - cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_APPARENTMODECHANGED, hContact, lParam); else if (!strcmp(cws->szSetting, "IdleTS")) - cli.pfnClcBroadcast(INTM_IDLECHANGED, wParam, lParam); + cli.pfnClcBroadcast(INTM_IDLECHANGED, hContact, lParam); } return 0; } -- cgit v1.2.3