From ddba4ede6b451d0cfcd0d32b5180fbd0689966bf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 10 Feb 2014 08:04:30 +0000 Subject: - HANDLE hContact => HCONTACT - GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/Include/clc.h | 56 +++--- plugins/Clist_nicer/src/Include/clist.h | 4 +- plugins/Clist_nicer/src/Include/config.h | 22 +-- plugins/Clist_nicer/src/clc.cpp | 330 +++++++++++++++---------------- plugins/Clist_nicer/src/clcitems.cpp | 22 +-- plugins/Clist_nicer/src/clcmsgs.cpp | 8 +- plugins/Clist_nicer/src/clistevents.cpp | 4 +- plugins/Clist_nicer/src/clistmenus.cpp | 6 +- plugins/Clist_nicer/src/clistmod.cpp | 8 +- plugins/Clist_nicer/src/clistopts.cpp | 2 +- plugins/Clist_nicer/src/clui.cpp | 16 +- plugins/Clist_nicer/src/config.cpp | 22 +-- plugins/Clist_nicer/src/contact.cpp | 10 +- plugins/Clist_nicer/src/extBackg.cpp | 2 +- plugins/Clist_nicer/src/init.cpp | 12 +- plugins/Clist_nicer/src/viewmodes.cpp | 21 +- 16 files changed, 270 insertions(+), 275 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/Include/clc.h b/plugins/Clist_nicer/src/Include/clc.h index 08a89895c9..afb5a7ece5 100644 --- a/plugins/Clist_nicer/src/Include/clc.h +++ b/plugins/Clist_nicer/src/Include/clc.h @@ -103,32 +103,32 @@ typedef struct _OrderTreeData struct TExtraCache { - HANDLE hContact; - HANDLE hTimeZone; - BYTE valid; - TCHAR *statusMsg; - BYTE bStatusMsgValid; - DWORD dwCFlags; - DWORD dwDFlags; // display flags for caching only + HCONTACT hContact; + HANDLE hTimeZone; + BYTE valid; + TCHAR *statusMsg; + BYTE bStatusMsgValid; + DWORD dwCFlags; + DWORD dwDFlags; // display flags for caching only StatusItems_t *status_item, *proto_status_item; - DWORD dwLastMsgTime; - DWORD msgFrequency; - BOOL isChatRoom; + DWORD dwLastMsgTime; + DWORD msgFrequency; + BOOL isChatRoom; }; struct ClcContact : public ClcContactBase { - BOOL bIsMeta; - BYTE xStatus; - int xStatusIcon; - HANDLE hSubContact; - char *metaProto; - DWORD codePage; - WORD wStatus; - int avatarLeft, extraIconRightBegin; - int isRtl; - DWORD cFlags; - BYTE bSecondLine; + BOOL bIsMeta; + BYTE xStatus; + int xStatusIcon; + HCONTACT hSubContact; + char *metaProto; + DWORD codePage; + WORD wStatus; + int avatarLeft, extraIconRightBegin; + int isRtl; + DWORD cFlags; + BYTE bSecondLine; avatarCacheEntry *ace; TExtraCache* pExtra; @@ -233,7 +233,7 @@ struct TCluiData { HMENU hMenuNotify; int iLastEventAdded; int wNextMenuID; - HANDLE hUpdateContact; + HCONTACT hUpdateContact; DWORD sortTimer; TCHAR *szNoEvents; BOOL forceResize; @@ -329,7 +329,7 @@ struct IconDesc { }; struct NotifyMenuItemExData { - HANDLE hContact; + HCONTACT hContact; int iIcon; // icon index in the image list HICON hIcon; // corresponding icon handle HANDLE hDbEvent; @@ -357,7 +357,7 @@ HANDLE ContactToItemHandle(ClcContact *contact, DWORD *nmFlags); //clcitems.c void RebuildEntireList(HWND hwnd, struct ClcData *dat); -DWORD INTSORT_GetLastMsgTime(HANDLE hContact); +DWORD INTSORT_GetLastMsgTime(HCONTACT hContact); //clcmsgs.c LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); @@ -409,10 +409,10 @@ void ConfigureEventArea(HWND hwnd); void ClearIcons(int mode); void SkinDrawBg(HWND hwnd, HDC hdc); int GetBasicFontID(ClcContact * contact); -extern int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, struct ClcData *dat); +extern int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szStatus, struct ClcData *dat); void CreateViewModeFrame(); -int GetExtraCache(HANDLE hContact, char *szProto); -void ReloadExtraInfo(HANDLE hContact); +int GetExtraCache(HCONTACT hContact, char *szProto); +void ReloadExtraInfo(HCONTACT hContact); void LoadAvatarForContact(ClcContact *p); void ApplyViewMode(const char *name); @@ -425,7 +425,7 @@ void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int in void Reload3dBevelColors(); void ReloadThemedOptions(); void SetButtonToSkinned(); -void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact); +void RTL_DetectAndSet(ClcContact *contact, HCONTACT hContact); void RTL_DetectGroupName(ClcContact *group); void CLN_LoadAllIcons(BOOL mode); void ReloadSkinItemsToCache(); diff --git a/plugins/Clist_nicer/src/Include/clist.h b/plugins/Clist_nicer/src/Include/clist.h index b60b0db108..51c769d031 100644 --- a/plugins/Clist_nicer/src/Include/clist.h +++ b/plugins/Clist_nicer/src/Include/clist.h @@ -23,8 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ void LoadContactTree(void); -int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon); -HTREEITEM GetTreeItemByHContact(HANDLE hContact); +int IconFromStatusMode(const char *szProto, int status, HCONTACT hContact, HICON *phIcon); +HTREEITEM GetTreeItemByHContact(HCONTACT hContact); void SortContacts(void); #define CLUIINTM_REDRAW (WM_USER+100) diff --git a/plugins/Clist_nicer/src/Include/config.h b/plugins/Clist_nicer/src/Include/config.h index 2052232339..e40a92d36c 100644 --- a/plugins/Clist_nicer/src/Include/config.h +++ b/plugins/Clist_nicer/src/Include/config.h @@ -52,34 +52,34 @@ class cfg public: static void init(); - static DWORD getDword(const HANDLE hContact, const char *szModule, const char *szSetting, DWORD uDefault); + static DWORD getDword(const HCONTACT hContact, const char *szModule, const char *szSetting, DWORD uDefault); static DWORD getDword(const char *szModule, const char *szSetting, DWORD uDefault); static DWORD getDword(const char *szSetting, DWORD uDefault); - static WORD getWord(const HANDLE hContact, const char *szModule, const char *szSetting, WORD uDefault); + static WORD getWord(const HCONTACT hContact, const char *szModule, const char *szSetting, WORD uDefault); static WORD getWord(const char *szModule, const char *szSetting, WORD uDefault); static WORD getWord(const char *szSetting, WORD uDefault); - static int getByte(const HANDLE hContact, const char *szModule, const char *szSetting, int uDefault); + static int getByte(const HCONTACT hContact, const char *szModule, const char *szSetting, int uDefault); static int getByte(const char *szModule, const char *szSetting, int uDefault); static int getByte(const char *szSetting, int uDefault); - static INT_PTR getTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - static INT_PTR getString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + static INT_PTR getTString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); + static INT_PTR getString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv); - static INT_PTR writeDword(const HANDLE hContact, const char *szModule, const char *szSetting, DWORD value); + static INT_PTR writeDword(const HCONTACT hContact, const char *szModule, const char *szSetting, DWORD value); static INT_PTR writeDword(const char *szModule, const char *szSetting, DWORD value); - static INT_PTR writeWord(const HANDLE hContact, const char *szModule, const char *szSetting, WORD value); + static INT_PTR writeWord(const HCONTACT hContact, const char *szModule, const char *szSetting, WORD value); static INT_PTR writeWord(const char *szModule, const char *szSetting, WORD value); - static INT_PTR writeByte(const HANDLE hContact, const char *szModule, const char *szSetting, BYTE value); + static INT_PTR writeByte(const HCONTACT hContact, const char *szModule, const char *szSetting, BYTE value); static INT_PTR writeByte(const char *szModule, const char *szSetting, BYTE value); - static INT_PTR writeTString(const HANDLE hContact, const char *szModule, const char *szSetting, const TCHAR *st); - static INT_PTR writeString(const HANDLE hContact, const char *szModule, const char *szSetting, const char *st); + static INT_PTR writeTString(const HCONTACT hContact, const char *szModule, const char *szSetting, const TCHAR *st); + static INT_PTR writeString(const HCONTACT hContact, const char *szModule, const char *szSetting, const char *st); - static TExtraCache* getCache(const HANDLE hContact, const char *szProto); + static TExtraCache* getCache(const HCONTACT hContact, const char *szProto); public: static TCluiData dat; diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index e8187cd572..00d7be37d2 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -46,7 +46,7 @@ static HRESULT(WINAPI *MyCloseThemeData)(HANDLE); LONG g_cxsmIcon, g_cysmIcon; -void SetDBButtonStates(HANDLE hContact); +void SetDBButtonStates(HCONTACT hContact); HMENU BuildGroupPopupMenu(ClcGroup* group) { @@ -78,14 +78,14 @@ static int ClcEventAdded(WPARAM wParam, LPARAM lParam) DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get((HANDLE)lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - DWORD firstTime = cfg::getDword((HANDLE)wParam, "CList", "mf_firstEvent", 0); - DWORD count = cfg::getDword((HANDLE)wParam, "CList", "mf_count", 0); + DWORD firstTime = cfg::getDword((HCONTACT)wParam, "CList", "mf_firstEvent", 0); + DWORD count = cfg::getDword((HCONTACT)wParam, "CList", "mf_count", 0); count++; new_freq = count ? (dbei.timestamp - firstTime) / count : 0x7fffffff; - cfg::writeDword((HANDLE)wParam, "CList", "mf_freq", new_freq); - cfg::writeDword((HANDLE)wParam, "CList", "mf_count", count); + cfg::writeDword((HCONTACT)wParam, "CList", "mf_freq", new_freq); + cfg::writeDword((HCONTACT)wParam, "CList", "mf_count", count); - TExtraCache *p = cfg::getCache((HANDLE)wParam, NULL); + TExtraCache *p = cfg::getCache((HCONTACT)wParam, NULL); if (p) { p->dwLastMsgTime = dbei.timestamp; if (new_freq) @@ -111,9 +111,9 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) if ( !__strcmp(cws->szSetting, "ANSIcodepage")) pcli->pfnClcBroadcast(INTM_CODEPAGECHANGED, wParam, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo((HANDLE)wParam); + ReloadExtraInfo((HCONTACT)wParam); } - else if (wParam != 0 && (szProto = GetContactProto((HANDLE)wParam)) != NULL) { + else if (wParam != 0 && (szProto = GetContactProto((HCONTACT)wParam)) != NULL) { char *id = NULL; if ( !__strcmp(cws->szModule, "Protocol") && !__strcmp(cws->szSetting, "p")) { char *szProto_s; @@ -122,24 +122,24 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) szProto_s = NULL; else szProto_s = cws->value.pszVal; - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HANDLE)wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(szProto_s, szProto_s == NULL ? ID_STATUS_OFFLINE : cfg::getWord((HCONTACT)wParam, szProto_s, "Status", ID_STATUS_OFFLINE), (HCONTACT)wParam, NULL), 0); } // something is being written to a protocol module if ( !__strcmp(szProto, cws->szModule)) { // was a unique setting key written? - pcli->pfnInvalidateDisplayNameCacheEntry((HANDLE)wParam); + pcli->pfnInvalidateDisplayNameCacheEntry((HCONTACT)wParam); if ( !__strcmp(cws->szSetting, "Status")) { - if ( !cfg::getByte((HANDLE)wParam, "CList", "Hidden", 0)) { + if (!cfg::getByte((HCONTACT)wParam, "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((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 0); CallService(MS_CLUI_CONTACTDELETED, wParam, 0); return 0; } - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 1); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 1); } - pcli->pfnChangeContactIcon((HANDLE)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HANDLE)wParam, NULL), 0); + pcli->pfnChangeContactIcon((HCONTACT)wParam, IconFromStatusMode(cws->szModule, cws->value.wVal, (HCONTACT)wParam, NULL), 0); } SendMessage(pcli->hwndContactTree, INTM_STATUSCHANGED, wParam, lParam); return 0; @@ -149,7 +149,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam) else if (strstr(cws->szSetting, "XStatus")) SendMessage(pcli->hwndContactTree, INTM_XSTATUSCHANGED, wParam, lParam); else if ( !__strcmp(cws->szSetting, "Timezone") || !__strcmp(cws->szSetting, "TzName")) - ReloadExtraInfo((HANDLE)wParam); + ReloadExtraInfo((HCONTACT)wParam); 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)) @@ -239,7 +239,7 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L case WM_CREATE: dat = (struct ClcData *)mir_alloc(sizeof(struct ClcData)); memset(dat, 0, sizeof(struct ClcData)); - SetWindowLongPtr(hwnd, 0, (LONG_PTR) dat); + SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat); RowHeight::Init(dat); dat->forceScroll = 0; @@ -255,7 +255,8 @@ LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, L cfg::clcdat = dat; if (cfg::dat.bShowLocalTime) SetTimer(hwnd, TIMERID_REFRESH, 65000, NULL); - } else + } + else dat->bisEmbedded = TRUE; } break; @@ -278,116 +279,116 @@ LBL_Def: return FrameNCPaint(hwnd, DefWindowProc, wParam, lParam, frameHasTitlebar); case INTM_GROUPCHANGED: - { - WORD iExtraImage[EXTRA_ICON_COUNT]; - BYTE flags = 0; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - memset(iExtraImage, 0xFF, sizeof(iExtraImage)); - else { - memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); - flags = contact->flags; + { + WORD iExtraImage[EXTRA_ICON_COUNT]; + BYTE flags = 0; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + memset(iExtraImage, 0xFF, sizeof(iExtraImage)); + else { + memcpy(iExtraImage, contact->iExtraImage, sizeof(iExtraImage)); + flags = contact->flags; + } + pcli->pfnDeleteItemFromTree(hwnd, (HCONTACT)wParam); + if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HCONTACT)wParam, NULL, dat)) { + pcli->pfnAddContactToTree(hwnd, dat, (HCONTACT)wParam, 1, 1); + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); + if (flags & CONTACTF_CHECKED) + contact->flags |= CONTACTF_CHECKED; } - pcli->pfnDeleteItemFromTree(hwnd, (HANDLE)wParam); - if (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus((HANDLE)wParam, NULL, dat)) { - pcli->pfnAddContactToTree(hwnd, dat, (HANDLE)wParam, 1, 1); - if (FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - memcpy(contact->iExtraImage, iExtraImage, sizeof(iExtraImage)); - if (flags & CONTACTF_CHECKED) - contact->flags |= CONTACTF_CHECKED; - } - NMCLISTCONTROL nm; - nm.hdr.code = CLN_CONTACTMOVED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = (HANDLE)wParam; - SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM) &nm); - } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, 1); + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CONTACTMOVED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = (HANDLE)wParam; + SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)&nm); } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, 1); + } goto LBL_Def; case INTM_ICONCHANGED: - { - int recalcScrollBar = 0; - HANDLE hContact = (HANDLE)wParam; - WORD status = ID_STATUS_OFFLINE; - int contactRemoved = 0; - HANDLE hSelItem = NULL; - ClcContact *selcontact = NULL; - - char *szProto = GetContactProto(hContact); - if (szProto == NULL) - status = ID_STATUS_OFFLINE; - else - status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); - - int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || - !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || - pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown - - if (!FindItem(hwnd, dat, hContact, &contact, &group, NULL)) { - if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); - recalcScrollBar = 1; - FindItem(hwnd, dat, hContact, &contact, NULL, NULL); - if (contact) { - contact->iImage = (WORD)lParam; - pcli->pfnNotifyNewContact(hwnd, hContact); - } - } - } - else { - //item in list already - DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); - if (contact->iImage == (WORD)lParam) - break; - if ( !shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed - if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = pcli->pfnContactToHItem(selcontact); - pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); - contactRemoved = TRUE; - recalcScrollBar = 1; - } - else { + { + int recalcScrollBar = 0; + HCONTACT hContact = (HCONTACT)wParam; + WORD status = ID_STATUS_OFFLINE; + int contactRemoved = 0; + HCONTACT hSelItem = NULL; + ClcContact *selcontact = NULL; + + char *szProto = GetContactProto(hContact); + if (szProto == NULL) + status = ID_STATUS_OFFLINE; + else + status = cfg::getWord(hContact, szProto, "Status", ID_STATUS_OFFLINE); + + int shouldShow = (GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_SHOWHIDDEN || + !CLVM_GetContactHiddenStatus(hContact, szProto, dat)) && ((cfg::dat.bFilterEffective ? TRUE : !pcli->pfnIsHiddenMode(dat, status)) || + pcli->pfnGetContactIcon(hContact) != lParam); // XXX CLVM changed - this means an offline msg is flashing, so the contact should be shown + + if (!FindItem(hwnd, dat, hContact, &contact, &group, NULL)) { + if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnAddContactToTree(hwnd, dat, hContact, 0, 0); + recalcScrollBar = 1; + FindItem(hwnd, dat, hContact, &contact, NULL, NULL); + if (contact) { contact->iImage = (WORD)lParam; - if ( !pcli->pfnIsHiddenMode(dat, status)) - contact->flags |= CONTACTF_ONLINE; - else - contact->flags &= ~CONTACTF_ONLINE; + pcli->pfnNotifyNewContact(hwnd, hContact); } } - 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)); + } + else { + //item in list already + DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); + if (contact->iImage == (WORD)lParam) + break; + if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline || cfg::dat.bFilterEffective)) { // CLVM changed + if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) + hSelItem = (HCONTACT)pcli->pfnContactToHItem(selcontact); + pcli->pfnRemoveItemFromGroup(hwnd, group, contact, 0); + contactRemoved = TRUE; + recalcScrollBar = 1; + } + else { + contact->iImage = (WORD)lParam; + if (!pcli->pfnIsHiddenMode(dat, status)) + contact->flags |= CONTACTF_ONLINE; else - dat->selection = -1; + contact->flags &= ~CONTACTF_ONLINE; } - dat->needsResort = TRUE; - PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); - if (recalcScrollBar) - pcli->pfnRecalcScrollBar(hwnd, dat); } + 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)); + else + dat->selection = -1; + } + dat->needsResort = TRUE; + PostMessage(hwnd, INTM_SORTCLC, 0, recalcScrollBar); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contactRemoved ? 0 : wParam)); + if (recalcScrollBar) + pcli->pfnRecalcScrollBar(hwnd, dat); + } goto LBL_Def; case INTM_METACHANGED: - if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (contact->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - contact->hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) contact->hContact, 0); + contact->hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)contact->hContact, 0); contact->metaProto = GetContactProto(contact->hSubContact); contact->iImage = pcli->pfnGetContactIcon(contact->hSubContact); if (contact->pExtra) { TExtraCache *pSub = cfg::getCache(contact->hSubContact, contact->metaProto); ClcContact *subContact; - if ( !pcli->pfnFindItem(hwnd, dat, (HANDLE)contact->hSubContact, &subContact, NULL, NULL)) + if (!pcli->pfnFindItem(hwnd, dat, (HCONTACT)contact->hSubContact, &subContact, NULL, NULL)) break; contact->pExtra->proto_status_item = GetProtocolStatusItem(contact->metaProto); @@ -401,7 +402,7 @@ LBL_Def: goto LBL_Def; case INTM_METACHANGEDEVENT: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; if (lParam == 0) SendMessage(hwnd, CLM_AUTOREBUILD, 0, 0); @@ -409,9 +410,9 @@ LBL_Def: case INTM_NAMECHANGED: ClcContact *contact; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); RTL_DetectAndSet(contact, 0); @@ -420,65 +421,65 @@ LBL_Def: goto LBL_Def; case INTM_CODEPAGECHANGED: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - contact->codePage = cfg::getDword((HANDLE)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HANDLE)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); + contact->codePage = cfg::getDword((HCONTACT)wParam, "Tab_SRMsg", "ANSIcodepage", cfg::getDword((HCONTACT)wParam, "UserInfo", "ANSIcodepage", CP_ACP)); PostMessage(hwnd, INTM_INVALIDATE, 0, 0); goto LBL_Def; case INTM_AVATARCHANGED: - { - avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; - contact = NULL; - - if (wParam == 0) { - //RemoveFromImgCache(0, cEntry); - cfg::dat.bForceRefetchOnPaint = TRUE; - RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); - cfg::dat.bForceRefetchOnPaint = FALSE; - goto LBL_Def; - } + { + avatarCacheEntry *cEntry = (struct avatarCacheEntry *)lParam; + contact = NULL; + + if (wParam == 0) { + //RemoveFromImgCache(0, cEntry); + cfg::dat.bForceRefetchOnPaint = TRUE; + RedrawWindow(hwnd, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW); + cfg::dat.bForceRefetchOnPaint = FALSE; + goto LBL_Def; + } - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - return 0; - contact->ace = cEntry; - if (cEntry == NULL) - contact->cFlags &= ~ECF_AVATAR; - else { - DWORD dwFlags; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + return 0; + contact->ace = cEntry; + if (cEntry == NULL) + contact->cFlags &= ~ECF_AVATAR; + else { + DWORD dwFlags; - if (contact->pExtra) - dwFlags = contact->pExtra->dwDFlags; - else - dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); - if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) - contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); - else - contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); - } - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); + if (contact->pExtra) + dwFlags = contact->pExtra->dwDFlags; + else + dwFlags = cfg::getDword(contact->hContact, "CList", "CLN_Flags", 0); + if (cfg::dat.dwFlags & CLUI_FRAME_AVATARS) + contact->cFlags = (dwFlags & ECF_HIDEAVATAR ? contact->cFlags & ~ECF_AVATAR : contact->cFlags | ECF_AVATAR); + else + contact->cFlags = (dwFlags & ECF_FORCEAVATAR ? contact->cFlags | ECF_AVATAR : contact->cFlags & ~ECF_AVATAR); } + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); + } goto LBL_Def; case INTM_STATUSMSGCHANGED: - { - TExtraCache *p; - char *szProto = NULL; - - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) - p = cfg::getCache((HANDLE)wParam, NULL); - else { - p = contact->pExtra; - szProto = contact->proto; - } - GetCachedStatusMsg(p, szProto); - PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); + { + TExtraCache *p; + char *szProto = NULL; + + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) + p = cfg::getCache((HCONTACT)wParam, NULL); + else { + p = contact->pExtra; + szProto = contact->proto; } + GetCachedStatusMsg(p, szProto); + PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)(contact ? contact->hContact : 0)); + } goto LBL_Def; case INTM_STATUSCHANGED: - if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { - WORD wStatus = cfg::getWord((HANDLE)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { + WORD wStatus = cfg::getWord((HCONTACT)wParam, contact->proto, "Status", ID_STATUS_OFFLINE); if (cfg::dat.bNoOfflineAvatars && wStatus != ID_STATUS_OFFLINE && contact->wStatus == ID_STATUS_OFFLINE) { contact->wStatus = wStatus; if (cfg::dat.bAvatarServiceAvail && contact->ace == NULL) @@ -490,12 +491,12 @@ LBL_Def: break; case INTM_PROTOCHANGED: - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) break; - contact->proto = GetContactProto((HANDLE)wParam); + contact->proto = GetContactProto((HCONTACT)wParam); CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0); - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HANDLE)wParam, 0), SIZEOF(contact->szText)); + lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName((HCONTACT)wParam, 0), SIZEOF(contact->szText)); RTL_DetectAndSet(contact, 0); @@ -504,7 +505,7 @@ LBL_Def: goto LBL_Def; case INTM_INVALIDATE: - if ( !dat->bNeedPaint) { + if (!dat->bNeedPaint) { KillTimer(hwnd, TIMERID_PAINT); SetTimer(hwnd, TIMERID_PAINT, 100, NULL); dat->bNeedPaint = TRUE; @@ -512,13 +513,12 @@ LBL_Def: goto LBL_Def; case INTM_INVALIDATECONTACT: - { - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) - break; - - if (contact == 0 || group == 0) - break; + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) + break; + if (contact == 0 || group == 0) + break; + { int iItem = pcli->pfnGetRowsPriorTo(&dat->list, group, List_IndexOf((SortedList*) & group->cl, contact)); pcli->pfnInvalidateItem(hwnd, dat, iItem); } @@ -538,14 +538,14 @@ LBL_Def: goto LBL_Def; case INTM_IDLECHANGED: - if ( FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) { + if (FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char *szProto = (char*)cws->szModule; if (szProto == NULL) break; contact->flags &= ~CONTACTF_IDLE; - if (cfg::getDword((HANDLE)wParam, szProto, "IdleTS", 0)) { + if (cfg::getDword((HCONTACT)wParam, szProto, "IdleTS", 0)) { contact->flags |= CONTACTF_IDLE; } PostMessage(hwnd, INTM_INVALIDATE, 0, (LPARAM)contact->hContact); @@ -557,14 +557,14 @@ LBL_Def: { DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam; char *szProto = (char *)cws->szModule; - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; TExtraCache *p; if (!FindItem(hwnd, dat, hContact, &contact, NULL, NULL)) { p = cfg::getCache(hContact, szProto); if (!dat->bisEmbedded && cfg::dat.bMetaAvail && szProto) { // may be a subcontact, forward the xstatus if (cfg::getByte(hContact, cfg::dat.szMetaName, "IsSubcontact", 0)) { - HANDLE hMasterContact = (HANDLE)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0); + HCONTACT hMasterContact = (HCONTACT)cfg::getDword(hContact, cfg::dat.szMetaName, "Handle", 0); if (hMasterContact && hMasterContact != hContact) // avoid recursive call of settings handler cfg::writeByte(hMasterContact, cfg::dat.szMetaName, "XStatusId", (BYTE)cfg::getByte(hContact, szProto, "XStatusId", 0)); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 7b26c3cefc..4f01d00972 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -24,12 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include -extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HANDLE hContact); +extern int ( *saveAddContactToGroup )(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); extern int ( *saveAddInfoItemToGroup )(ClcGroup *group, int flags, const TCHAR *pszText); extern ClcGroup* ( *saveRemoveItemFromGroup )(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount); extern ClcGroup* ( *saveAddGroup )(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers); -static void TZ_LoadTimeZone(HANDLE hContact, struct TExtraCache *c, const char *szProto); +static void TZ_LoadTimeZone(HCONTACT hContact, struct TExtraCache *c, const char *szProto); //routines for managing adding/removal of items in the list, including sorting @@ -92,7 +92,7 @@ void LoadAvatarForContact(ClcContact *p) p->cFlags &= ~ECF_AVATAR; } -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) +int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact) { int i = saveAddContactToGroup(dat, group, hContact); ClcContact* p = group->cl.items[i]; @@ -105,7 +105,7 @@ int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact) else p->bIsMeta = FALSE; if (p->bIsMeta && cfg::dat.bMetaAvail && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - p->hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM) hContact, 0); + p->hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); p->metaProto = GetContactProto(p->hSubContact); p->iImage = pcli->pfnGetContactIcon(p->hSubContact); } @@ -163,7 +163,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) } } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (style & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(hContact, NULL, dat)) { ZeroMemory((void *)&dbv, sizeof(dbv)); if (cfg::getTString(hContact, "CList", "Group", &dbv)) @@ -228,7 +228,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) return 0; p->bStatusMsgValid = STATUSMSG_NOTFOUND; - HANDLE hContact = p->hContact; + HCONTACT hContact = p->hContact; int result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv); if ( !result && lstrlen(dbv.ptszVal) > 1) @@ -322,14 +322,14 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) * differences. */ -static void TZ_LoadTimeZone(HANDLE hContact, struct TExtraCache *c, const char *szProto) +static void TZ_LoadTimeZone(HCONTACT hContact, struct TExtraCache *c, const char *szProto) { DWORD flags = 0; if (cfg::dat.bShowLocalTimeSelective) flags |= TZF_DIFONLY; c->hTimeZone = tmi.createByContact(hContact, flags); } -void ReloadExtraInfo(HANDLE hContact) +void ReloadExtraInfo(HCONTACT hContact) { if (hContact && pcli->hwndContactTree) { TExtraCache *p = cfg::getCache(hContact, NULL); @@ -347,7 +347,7 @@ void ReloadExtraInfo(HANDLE hContact) */ -void RTL_DetectAndSet(ClcContact *contact, HANDLE hContact) +void RTL_DetectAndSet(ClcContact *contact, HCONTACT hContact) { WORD infoTypeC2[12]; int i; @@ -425,7 +425,7 @@ void GetExtendedInfo(ClcContact *contact, ClcData *dat) void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) { - HANDLE hContact = cEntry->hContact; + HCONTACT hContact = cEntry->hContact; if (cfg::getByte(hContact, "EXTBK", "VALID", 0)) { if (cEntry->status_item == NULL) @@ -462,7 +462,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) * also cares about sub contacts (if meta is active) */ -int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szProto, struct ClcData *dat) +int __fastcall CLVM_GetContactHiddenStatus(HCONTACT hContact, char *szProto, struct ClcData *dat) { int dbHidden = cfg::getByte(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. int filterResult = 1; diff --git a/plugins/Clist_nicer/src/clcmsgs.cpp b/plugins/Clist_nicer/src/clcmsgs.cpp index da02231308..def28802ac 100644 --- a/plugins/Clist_nicer/src/clcmsgs.cpp +++ b/plugins/Clist_nicer/src/clcmsgs.cpp @@ -35,7 +35,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM { ClcContact *contact; ClcGroup *group; - if (wParam == 0 || !FindItem(hwnd, dat, (HANDLE)wParam, &contact, &group, NULL)) + if (wParam == 0 || !FindItem(hwnd, dat, (HCONTACT)wParam, &contact, &group, NULL)) return 0; if (lParam) @@ -48,7 +48,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_GETSTATUSMSG: if (wParam) { ClcContact *contact = NULL; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) @@ -67,7 +67,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_TOGGLEPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; @@ -80,7 +80,7 @@ LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM case CLM_QUERYPRIORITYCONTACT: if (wParam) { ClcContact *contact = NULL; - if ( !FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) + if (!FindItem(hwnd, dat, (HCONTACT)wParam, &contact, NULL, NULL)) return 0; if (contact->type != CLCIT_CONTACT) return 0; diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index ef42eab6bd..dd9870e7e4 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -29,7 +29,7 @@ static HWND hwndEventFrame = 0; HFONT __fastcall ChangeToFont(HDC hdc, struct ClcData *dat, int id, int *fontHeight); extern struct CListEvent* ( *saveAddEvent )(CLISTEVENT *cle); -extern int ( *saveRemoveEvent )(HANDLE hContact, HANDLE hDbEvent); +extern int ( *saveRemoveEvent )(HCONTACT hContact, HANDLE hDbEvent); extern FRAMEWND *wndFrameEventArea; extern HPEN g_hPenCLUIFrames; @@ -333,7 +333,7 @@ struct CListEvent* AddEvent(CLISTEVENT *cle) // wParam=(WPARAM)(HANDLE)hContact // lParam=(LPARAM)(HANDLE)hDbEvent // Returns 0 if the event was successfully removed, or nonzero if the event was not found -int RemoveEvent(HANDLE hContact, HANDLE hDbEvent) +int RemoveEvent(HCONTACT hContact, HANDLE hDbEvent) { HANDLE hItem; int i; diff --git a/plugins/Clist_nicer/src/clistmenus.cpp b/plugins/Clist_nicer/src/clistmenus.cpp index 2e3c9a8f39..a5d2ca8255 100644 --- a/plugins/Clist_nicer/src/clistmenus.cpp +++ b/plugins/Clist_nicer/src/clistmenus.cpp @@ -68,7 +68,7 @@ static HANDLE hWindowListIGN = 0; static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - HANDLE hContact = (HANDLE)GetWindowLongPtr(hWnd, GWLP_USERDATA); + HCONTACT hContact = (HCONTACT)GetWindowLongPtr(hWnd, GWLP_USERDATA); switch(msg) { case WM_INITDIALOG: @@ -78,7 +78,7 @@ static INT_PTR CALLBACK IgnoreDialogProc(HWND hWnd, UINT msg, WPARAM wParam, LPA int pCaps; HWND hwndAdd; - hContact = (HANDLE)lParam; + hContact = (HCONTACT)lParam; SetWindowLongPtr(hWnd, GWLP_USERDATA, (LONG_PTR)hContact); dwMask = cfg::getDword(hContact, "Ignore", "Mask1", 0); SendMessage(hWnd, WM_USER + 100, (WPARAM)hContact, dwMask); @@ -367,7 +367,7 @@ static INT_PTR SetContactIgnore(WPARAM wParam, LPARAM lParam) if (hWindowListIGN == 0) hWindowListIGN = WindowList_Create(); - hWnd = WindowList_Find(hWindowListIGN, (HANDLE)wParam); + hWnd = WindowList_Find(hWindowListIGN, (HCONTACT)wParam); if ( wParam ) { if ( hWnd == 0 ) CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_QUICKIGNORE), 0, IgnoreDialogProc, (LPARAM)wParam); diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 8b23d00f02..2514716017 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -30,7 +30,7 @@ extern int RemoveEvent(WPARAM wParam, LPARAM lParam); int InitCustomMenus(void); void UninitCustomMenus(void); INT_PTR GetContactStatusMessage(WPARAM wParam, LPARAM lParam); -int EventsProcessContactDoubleClick(HANDLE hContact); +int EventsProcessContactDoubleClick(HCONTACT hContact); int SetHideOffline(WPARAM wParam, LPARAM lParam); extern HIMAGELIST hCListImages; @@ -44,9 +44,9 @@ static INT_PTR GetStatusMode(WPARAM wParam, LPARAM lParam) return(g_maxStatus == ID_STATUS_OFFLINE ? pcli->currentDesiredStatusMode : g_maxStatus); } -extern int ( *saveIconFromStatusMode )( const char *szProto, int status, HANDLE hContact ); +extern int ( *saveIconFromStatusMode )( const char *szProto, int status, HCONTACT hContact ); -int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON *phIcon) +int IconFromStatusMode(const char *szProto, int status, HCONTACT hContact, HICON *phIcon) { if (phIcon != NULL) *phIcon = NULL; @@ -55,7 +55,7 @@ int IconFromStatusMode(const char *szProto, int status, HANDLE hContact, HICON * int finalStatus; if (szProto != NULL && !strcmp(szProto, cfg::dat.szMetaName) && cfg::dat.bMetaAvail && hContact != 0 && !(cfg::dat.dwFlags & CLUI_USEMETAICONS)) { - HANDLE hSubContact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); + HCONTACT hSubContact = (HCONTACT)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0); szFinalProto = GetContactProto(hSubContact); finalStatus = (status == 0) ? (WORD) cfg::getWord(hSubContact, szFinalProto, "Status", ID_STATUS_OFFLINE) : status; hContact = hSubContact; diff --git a/plugins/Clist_nicer/src/clistopts.cpp b/plugins/Clist_nicer/src/clistopts.cpp index 3dac5426da..5517524a5f 100644 --- a/plugins/Clist_nicer/src/clistopts.cpp +++ b/plugins/Clist_nicer/src/clistopts.cpp @@ -39,7 +39,7 @@ INT_PTR CALLBACK DlgProcGenOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP switch (msg) { case WM_USER+1: { - HANDLE hContact = (HANDLE)wParam; + HCONTACT hContact = (HCONTACT)wParam; DBCONTACTWRITESETTING *ws = (DBCONTACTWRITESETTING *) lParam; if (hContact == NULL && ws != NULL && ws->szModule != NULL && ws->szSetting != NULL && lstrcmpiA(ws->szModule, "CList") == 0 && lstrcmpiA(ws->szSetting, "UseGroups") == 0 && IsWindowVisible(hwndDlg)) CheckDlgButton(hwndDlg, IDC_DISABLEGROUPS, ws->value.bVal == 0); diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 9a3f756193..72a579d453 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -400,10 +400,10 @@ void ConfigureCLUIGeometry(int mode) * set the states of defined database action buttons (only if button is a toggle) */ -void SetDBButtonStates(HANDLE hPassedContact) +void SetDBButtonStates(HCONTACT hPassedContact) { ButtonItem *buttonItem = g_ButtonItems; - HANDLE hContact = 0, hFinalContact = 0; + HCONTACT hContact = 0, hFinalContact = 0; char *szModule, *szSetting; int sel = cfg::clcdat ? cfg::clcdat->selection : -1; ClcContact *contact = 0; @@ -714,7 +714,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) extern LRESULT(CALLBACK *saveContactListWndProc)(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); -static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HANDLE hContact) +static int ServiceParamsOK(ButtonItem *item, WPARAM *wParam, LPARAM *lParam, HCONTACT hContact) { if (item->dwFlags & BUTTON_PASSHCONTACTW || item->dwFlags & BUTTON_PASSHCONTACTL || item->dwFlags & BUTTON_ISCONTACTDBACTION) { if (hContact == 0) @@ -1344,7 +1344,7 @@ skipbg: ButtonItem *item = g_ButtonItems; WPARAM wwParam = 0; LPARAM llParam = 0; - HANDLE hContact = 0; + HCONTACT hContact = 0; ClcContact *contact = 0; int sel = cfg::clcdat ? cfg::clcdat->selection : -1; int serviceFailure = FALSE; @@ -1378,7 +1378,7 @@ skipbg: BYTE *pValue; char *szModule = item->szModule; char *szSetting = item->szSetting; - HANDLE finalhContact = 0; + HCONTACT finalhContact = 0; if (item->dwFlags & BUTTON_ISCONTACTDBACTION || item->dwFlags & BUTTON_DBACTIONONCONTACT) { contactOK = ServiceParamsOK(item, &wwParam, &llParam, hContact); @@ -1400,17 +1400,15 @@ skipbg: } else pValue = item->bValuePush; - if (fDelete) { - //_DebugTraceA("delete value: %s, %s ON %d", szModule, szSetting, finalhContact); + if (fDelete) db_unset(finalhContact, szModule, szSetting); - } else { + else { switch (item->type) { case DBVT_BYTE: cfg::writeByte(finalhContact, szModule, szSetting, pValue[0]); break; case DBVT_WORD: cfg::writeWord(finalhContact, szModule, szSetting, *((WORD *)&pValue[0])); - //_DebugTraceA("set WORD value: %s, %s, %d ON %d", szModule, item->szSetting, *((WORD *)&pValue[0]), finalhContact); break; case DBVT_DWORD: cfg::writeDword(finalhContact, szModule, szSetting, *((DWORD *)&pValue[0])); diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 8e5e232b26..189471c5e1 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -52,7 +52,7 @@ void cfg::init() InitializeCriticalSection(&cachecs); } -DWORD cfg::getDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0) +DWORD cfg::getDword(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD uDefault = 0) { return((DWORD)db_get_dw(hContact, szModule, szSetting, uDefault)); } @@ -76,7 +76,7 @@ DWORD cfg::getDword(const char *szModule, const char *szSetting, DWORD uDefault) } -WORD cfg::getWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD uDefault = 0) +WORD cfg::getWord(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD uDefault = 0) { return((WORD)db_get_w(hContact, szModule, szSetting, uDefault)); } @@ -102,7 +102,7 @@ WORD cfg::getWord(const char *szModule, const char *szSetting, WORD uDefault) /* * same for bytes now */ -int cfg::getByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0) +int cfg::getByte(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, int uDefault = 0) { return(db_get_b(hContact, szModule, szSetting, uDefault)); } @@ -117,12 +117,12 @@ int cfg::getByte(const char *szModule, const char *szSetting, int uDefault) return(db_get_b(0, szModule, szSetting, uDefault)); } -INT_PTR cfg::getTString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +INT_PTR cfg::getTString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return(db_get_ts(hContact, szModule, szSetting, dbv)); } -INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) +INT_PTR cfg::getString(const HCONTACT hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv) { return(db_get_s(hContact, szModule, szSetting, dbv)); } @@ -131,7 +131,7 @@ INT_PTR cfg::getString(const HANDLE hContact, const char *szModule, const char * * writer functions */ -INT_PTR cfg::writeDword(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) +INT_PTR cfg::writeDword(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, DWORD value = 0) { return(db_set_dw(hContact, szModule, szSetting, value)); } @@ -141,7 +141,7 @@ INT_PTR cfg::writeDword(const char *szModule = 0, const char *szSetting = 0, DWO return(db_set_dw(0, szModule, szSetting, value)); } -INT_PTR cfg::writeWord(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD value = 0) +INT_PTR cfg::writeWord(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, WORD value = 0) { return(db_set_w(hContact, szModule, szSetting, value)); } @@ -151,7 +151,7 @@ INT_PTR cfg::writeWord(const char *szModule = 0, const char *szSetting = 0, WORD return(db_set_w(0, szModule, szSetting, value)); } -INT_PTR cfg::writeByte(const HANDLE hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) +INT_PTR cfg::writeByte(const HCONTACT hContact = 0, const char *szModule = 0, const char *szSetting = 0, BYTE value = 0) { return(db_set_b(hContact, szModule, szSetting, value)); } @@ -161,17 +161,17 @@ INT_PTR cfg::writeByte(const char *szModule = 0, const char *szSetting = 0, BYTE return(db_set_b(0, szModule, szSetting, value)); } -INT_PTR cfg::writeTString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0) +INT_PTR cfg::writeTString(const HCONTACT hContact, const char *szModule = 0, const char *szSetting = 0, const TCHAR *str = 0) { return(db_set_ts(hContact, szModule, szSetting, str)); } -INT_PTR cfg::writeString(const HANDLE hContact, const char *szModule = 0, const char *szSetting = 0, const char *str = 0) +INT_PTR cfg::writeString(const HCONTACT hContact, const char *szModule = 0, const char *szSetting = 0, const char *str = 0) { return(db_set_s(hContact, szModule, szSetting, str)); } -TExtraCache* cfg::getCache(const HANDLE hContact, const char *szProto) +TExtraCache* cfg::getCache(const HCONTACT hContact, const char *szProto) { int idx = cfg::arCache.getIndex((TExtraCache*)&hContact); if (idx != -1) diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index c379979a79..88d2defe08 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -39,7 +39,7 @@ struct { {ID_STATUS_OUTTOLUNCH,425} }; -static int GetContactStatus(HANDLE hContact) +static int GetContactStatus(HCONTACT hContact) { char *szProto; @@ -61,7 +61,7 @@ int __forceinline GetStatusModeOrdering(int statusMode) int mf_updatethread_running = TRUE; HANDLE hThreadMFUpdate = 0; -static void MF_CalcFrequency(HANDLE hContact, DWORD dwCutoffDays, int doSleep) +static void MF_CalcFrequency(HCONTACT hContact, DWORD dwCutoffDays, int doSleep) { DWORD curTime = time(NULL); DWORD frequency, eventCount; @@ -109,7 +109,7 @@ void MF_UpdateThread(LPVOID) ResetEvent(hEvent); while(mf_updatethread_running) { - for (HANDLE hContact = db_find_first(); hContact && mf_updatethread_running; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact && mf_updatethread_running; hContact = db_find_next(hContact)) { MF_CalcFrequency(hContact, 50, 1); if (mf_updatethread_running) WaitForSingleObject(hEvent, 5000); @@ -140,7 +140,7 @@ void LoadContactTree(void) hideOffline = cfg::getByte("CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { status = GetContactStatus(hContact); if ((!hideOffline || status != ID_STATUS_OFFLINE) && !CLVM_GetContactHiddenStatus(hContact, NULL, NULL)) pcli->pfnChangeContactIcon(hContact, IconFromStatusMode(GetContactProto(hContact), status, hContact, NULL), 1); @@ -162,7 +162,7 @@ void LoadContactTree(void) CallService(MS_CLUI_LISTENDREBUILD, 0, 0); } -DWORD INTSORT_GetLastMsgTime(HANDLE hContact) +DWORD INTSORT_GetLastMsgTime(HCONTACT hContact) { HANDLE hDbEvent = db_event_last(hContact); while(hDbEvent) { diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index d72f0ec13d..0ed8a12036 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1261,7 +1261,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) } if (items) { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { char *szProto = GetContactProto(hContact); if (szProto == NULL) continue; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index b657100533..683c2fd72f 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -57,8 +57,8 @@ int ClcShutdown(WPARAM wParam, LPARAM lParam); void (*saveLoadClcOptions)(HWND hwnd, struct ClcData *dat); void LoadClcOptions(HWND hwnd, struct ClcData *dat); -int (*saveAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HANDLE hContact); -int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HANDLE hContact); +int (*saveAddContactToGroup)(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); +int AddContactToGroup(struct ClcData *dat, ClcGroup *group, HCONTACT hContact); CListEvent* (*saveAddEvent)(CLISTEVENT *cle); CListEvent* AddEvent(CLISTEVENT *cle); @@ -75,13 +75,13 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT message, WPARAM wParam, LPAR LRESULT (CALLBACK *saveContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -int (*saveIconFromStatusMode)(const char *szProto, int status, HANDLE hContact); +int (*saveIconFromStatusMode)(const char *szProto, int status, HCONTACT hContact); LRESULT(*saveProcessExternalMessages)(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); LRESULT ProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); -int (*saveRemoveEvent)(HANDLE hContact, HANDLE hDbEvent); -int RemoveEvent(HANDLE hContact, HANDLE hDbEvent); +int (*saveRemoveEvent)(HCONTACT hContact, HANDLE hDbEvent); +int RemoveEvent(HCONTACT hContact, HANDLE hDbEvent); INT_PTR (*saveTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); INT_PTR TrayIconProcessMessage(WPARAM wParam, LPARAM lParam); @@ -194,7 +194,7 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -static int fnIconFromStatusMode(const char* szProto, int status, HANDLE hContact) +static int fnIconFromStatusMode(const char* szProto, int status, HCONTACT hContact) { return IconFromStatusMode(szProto, status, hContact, NULL); } diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index db08996df5..c189db26bb 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -120,7 +120,7 @@ static void ShowPage(HWND hwnd, int page) } } -static int UpdateClistItem(HANDLE hContact, DWORD mask) +static int UpdateClistItem(HCONTACT hContact, DWORD mask) { for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hContact, MAKELONG(i - ID_STATUS_OFFLINE, @@ -141,24 +141,21 @@ static DWORD GetMaskForItem(HANDLE hItem) static void UpdateStickies() { - HANDLE hItem; - int i; - - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + HCONTACT hItem = (HCONTACT)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, cfg::getByte(hContact, "CLVM", g_szModename, 0) ? 1 : 0); DWORD localMask = HIWORD(cfg::getDword(hContact, "CLVM", g_szModename, 0)); UpdateClistItem(hItem, (localMask == 0 || localMask == stickyStatusMask) ? stickyStatusMask : localMask); } - for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hInfoItem, MAKELONG(i - ID_STATUS_OFFLINE, (1 << (i - ID_STATUS_OFFLINE)) & stickyStatusMask ? i - ID_STATUS_OFFLINE : ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1)); - hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM,CLGN_ROOT,0); + HANDLE hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETNEXTITEM, CLGN_ROOT, 0); hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP, (LPARAM)hItem); while(hItem) { - for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELONG(i - ID_STATUS_OFFLINE, nullImage)); hItem=(HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST,CLM_GETNEXTITEM,CLGN_NEXTGROUP,(LPARAM)hItem); } @@ -396,7 +393,7 @@ void SaveState() SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szModeName); dwGlobalMask = GetMaskForItem(hInfoItem); - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { hItem = (HANDLE)SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) { if (SendDlgItemMessage(clvmHwnd, IDC_CLIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) { @@ -675,7 +672,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0); SetWindowTextA(hwndSelector, Translate("No view mode")); } - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) if (cfg::getDword(hContact, "CLVM", szBuf, -1) != -1) cfg::writeDword(hContact, "CLVM", szBuf, 0); @@ -721,7 +718,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP } case IDC_CLEARALL: { - for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, (WPARAM)hContact, 0); if (hItem) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_SETCHECKMARK, (WPARAM)hItem, 0); -- cgit v1.2.3