From 6a8ea9b06515655f35a7e6998813eb69c80b8010 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 6 Apr 2018 18:14:12 +0300 Subject: CLIST_INTERFACE::pfnGetCacheEntry => Clist_GetCacheEntry --- include/delphi/m_clistint.inc | 6 +- include/m_clistint.h | 162 +++++++++++----------- libs/win32/mir_app.lib | Bin 149958 -> 150198 bytes libs/win64/mir_app.lib | Bin 145472 -> 145692 bytes plugins/Clist_modern/src/modern_awaymsg.cpp | 2 +- plugins/Clist_modern/src/modern_cachefuncs.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 2 +- plugins/Clist_modern/src/modern_clcitems.cpp | 10 +- plugins/Clist_modern/src/modern_clistmod.cpp | 2 +- plugins/Clist_modern/src/modern_clistsettings.cpp | 8 +- src/mir_app/src/clc.h | 5 +- src/mir_app/src/clcitems.cpp | 6 +- src/mir_app/src/clistcore.cpp | 3 - src/mir_app/src/clistevents.cpp | 4 +- src/mir_app/src/clistgroups.cpp | 2 +- src/mir_app/src/clistmod.cpp | 2 +- src/mir_app/src/clistsettings.cpp | 10 +- src/mir_app/src/clisttray.cpp | 2 +- src/mir_app/src/clui.cpp | 2 +- src/mir_app/src/keyboard.cpp | 4 +- src/mir_app/src/mir_app.def | 1 + src/mir_app/src/mir_app64.def | 1 + 22 files changed, 120 insertions(+), 116 deletions(-) diff --git a/include/delphi/m_clistint.inc b/include/delphi/m_clistint.inc index 809a18cd3a..9338ac0e97 100644 --- a/include/delphi/m_clistint.inc +++ b/include/delphi/m_clistint.inc @@ -371,15 +371,15 @@ type pfnRowHitTest : function (var dat:TClcData; y:int):int; cdecl; (* clistevents.c *) - pfnEventsProcessContactDoubleClick : function (hContact:TMCONTACT):int; cdecl; - pfnEventsProcessTrayDoubleClick : function (_para1:int):int; cdecl; + blablablabla2 : procedure; cdecl; + blablablabla3 : procedure; cdecl; (* clistmod.c *) pfnIconFromStatusMode : function (szProto:PAnsiChar; status:int; hContact:TMCONTACT):int; cdecl; pfnShowHide : function :int; cdecl; (* clistsettings.c *) - pfnGetCacheEntry : function (hContact:TMCONTACT):PClcCacheEntry; cdecl; + blablablabla1 : procedure; cdecl; pfnCreateCacheItem : function (hContact:TMCONTACT):PClcCacheEntry; cdecl; pfnCheckCacheItem : procedure (_para1:PClcCacheEntry); cdecl; pfnFreeCacheItem : procedure (_para1:PClcCacheEntry); cdecl; diff --git a/include/m_clistint.h b/include/m_clistint.h index 2c7d9ec763..2fd75eaef0 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -267,6 +267,8 @@ EXTERN_C MIR_APP_DLL(int) Clist_TrayIconSetBaseInfo(HICON hIcon, const char *sz EXTERN_C MIR_APP_DLL(void) Clist_TrayIconUpdateBase(const char *szChangedProto); EXTERN_C MIR_APP_DLL(void) Clist_TraySetTimer(); +EXTERN_C MIR_APP_DLL(ClcCacheEntry*) Clist_GetCacheEntry(MCONTACT hContact); + // calculates account's index by its position in status bar EXTERN_C MIR_APP_DLL(int) Clist_GetAccountIndex(int iPos); @@ -303,114 +305,114 @@ struct CLIST_INTERFACE ClcProtoStatus *clcProto; /* clc.h */ - void (*pfnClcOptionsChanged)(void); - HMENU (*pfnBuildGroupPopupMenu)(struct ClcGroup*); // unused - - LRESULT (CALLBACK *pfnContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + void (*pfnClcOptionsChanged)(void); + HMENU (*pfnBuildGroupPopupMenu)(struct ClcGroup*); // unused + + LRESULT (CALLBACK *pfnContactListControlWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); /* clcfiledrop.c */ - void (*pfnRegisterFileDropping)(HWND hwnd); - void (*pfnUnregisterFileDropping)(HWND hwnd); + void (*pfnRegisterFileDropping)(HWND hwnd); + void (*pfnUnregisterFileDropping)(HWND hwnd); /* clcidents.c */ - ClcContact* (*pfnFindItem)(DWORD dwItem, ClcContact *contact); - - int (*pfnGetRowsPriorTo)(ClcGroup *group, ClcGroup *subgroup, int contactIndex); - int (*pfnGetRowByIndex)(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); - int (*pfnGetContactHiddenStatus)(MCONTACT hContact, char *szProto, ClcData *dat); - int (*pfnIsVisibleContact)(ClcCacheEntry *pce, ClcGroup *group); + ClcContact* (*pfnFindItem)(DWORD dwItem, ClcContact *contact); + + int (*pfnGetRowsPriorTo)(ClcGroup *group, ClcGroup *subgroup, int contactIndex); + int (*pfnGetRowByIndex)(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup); + int (*pfnGetContactHiddenStatus)(MCONTACT hContact, char *szProto, ClcData *dat); + int (*pfnIsVisibleContact)(ClcCacheEntry *pce, ClcGroup *group); /* clcitems.c */ - ClcContact* (*pfnCreateClcContact)(void); - struct ClcGroup* (*pfnAddGroup)(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags, int groupId, int calcTotalMembers); - struct ClcGroup* (*pfnRemoveItemFromGroup)(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount); - - void (*pfnFreeContact)(ClcContact *contact); - void (*pfnFreeGroup)(ClcGroup *group); - - ClcContact* (*pfnAddInfoItemToGroup)(ClcGroup *group, int flags, const wchar_t *pszText); - ClcContact* (*pfnAddItemToGroup)(ClcGroup *group, int iAboveItem); - ClcContact* (*pfnAddContactToGroup)(ClcData *dat, ClcGroup *group, MCONTACT hContact); - - void (*pfnAddContactToTree)(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); - void (*pfnDeleteItemFromTree)(HWND hwnd, MCONTACT hItem); - void (*pfnRebuildEntireList)(HWND hwnd, ClcData *dat); - int (*pfnGetGroupContentsCount)(ClcGroup *group, int visibleOnly); - void (*pfnSortCLC)(HWND hwnd, ClcData *dat, int useInsertionSort); - void (*pfnSaveStateAndRebuildList)(HWND hwnd, ClcData *dat); + ClcContact* (*pfnCreateClcContact)(void); + ClcGroup* (*pfnAddGroup)(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags, int groupId, int calcTotalMembers); + ClcGroup* (*pfnRemoveItemFromGroup)(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount); + + void (*pfnFreeContact)(ClcContact *contact); + void (*pfnFreeGroup)(ClcGroup *group); + + ClcContact* (*pfnAddInfoItemToGroup)(ClcGroup *group, int flags, const wchar_t *pszText); + ClcContact* (*pfnAddItemToGroup)(ClcGroup *group, int iAboveItem); + ClcContact* (*pfnAddContactToGroup)(ClcData *dat, ClcGroup *group, MCONTACT hContact); + + void (*pfnAddContactToTree)(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline); + void (*pfnDeleteItemFromTree)(HWND hwnd, MCONTACT hItem); + void (*pfnRebuildEntireList)(HWND hwnd, ClcData *dat); + int (*pfnGetGroupContentsCount)(ClcGroup *group, int visibleOnly); + void (*pfnSortCLC)(HWND hwnd, ClcData *dat, int useInsertionSort); + void (*pfnSaveStateAndRebuildList)(HWND hwnd, ClcData *dat); /* clcmsgs.c */ - LRESULT (*pfnProcessExternalMessages)(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT (*pfnProcessExternalMessages)(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam); /* clcpaint.c */ - void (*pfnPaintClc)(HWND hwnd, ClcData *dat, HDC hdc, RECT * rcPaint); + void (*pfnPaintClc)(HWND hwnd, ClcData *dat, HDC hdc, RECT * rcPaint); /* clcutils.c */ - wchar_t* (*pfnGetGroupCountsText)(ClcData *dat, ClcContact *contact); - int (*pfnHitTest)(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags); - void (*pfnScrollTo)(HWND hwnd, ClcData *dat, int desty, int noSmooth); - void (*pfnEnsureVisible)(HWND hwnd, ClcData *dat, int iItem, int partialOk); - void (*pfnRecalcScrollBar)(HWND hwnd, ClcData *dat); - void (*pfnSetGroupExpand)(HWND hwnd, ClcData *dat, ClcGroup *group, int newState); - void (*pfnDoSelectionDefaultAction)(HWND hwnd, ClcData *dat); - int (*pfnFindRowByText)(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk); - void (*pfnEndRename)(HWND hwnd, ClcData *dat, int save); - void (*pfnDeleteFromContactList)(HWND hwnd, ClcData *dat); - void (*pfnBeginRenameSelection)(HWND hwnd, ClcData *dat); - void (*pfnCalcEipPosition)(ClcData *dat, ClcContact *contact, ClcGroup *group, POINT *result); - int (*pfnGetDropTargetInformation)(HWND hwnd, ClcData *dat, POINT pt); - int (*pfnClcStatusToPf2)(int status); - int (*pfnIsHiddenMode)(ClcData *dat, int status); - void (*pfnHideInfoTip)(HWND hwnd, ClcData *dat); - void (*pfnNotifyNewContact)(HWND hwnd, MCONTACT hContact); - DWORD (*pfnGetDefaultExStyle)(void); - void (*pfnGetDefaultFontSetting)(int i, LOGFONT* lf, COLORREF* colour); - void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour); - void (*pfnLoadClcOptions)(HWND hwnd, ClcData *dat, BOOL bFirst); - void (*pfnRecalculateGroupCheckboxes)(HWND hwnd, ClcData *dat); - void (*pfnSetGroupChildCheckboxes)(ClcGroup *group, int checked); - void (*pfnInvalidateItem)(HWND hwnd, ClcData *dat, int iItem); - - int (*pfnGetRowBottomY)(ClcData *dat, int item); - int (*pfnGetRowHeight)(ClcData *dat, int item); - int (*pfnGetRowTopY)(ClcData *dat, int item); - int (*pfnGetRowTotalHeight)(ClcData *dat); - int (*pfnRowHitTest)(ClcData *dat, int y); - + wchar_t* (*pfnGetGroupCountsText)(ClcData *dat, ClcContact *contact); + int (*pfnHitTest)(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags); + void (*pfnScrollTo)(HWND hwnd, ClcData *dat, int desty, int noSmooth); + void (*pfnEnsureVisible)(HWND hwnd, ClcData *dat, int iItem, int partialOk); + void (*pfnRecalcScrollBar)(HWND hwnd, ClcData *dat); + void (*pfnSetGroupExpand)(HWND hwnd, ClcData *dat, ClcGroup *group, int newState); + void (*pfnDoSelectionDefaultAction)(HWND hwnd, ClcData *dat); + int (*pfnFindRowByText)(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk); + void (*pfnEndRename)(HWND hwnd, ClcData *dat, int save); + void (*pfnDeleteFromContactList)(HWND hwnd, ClcData *dat); + void (*pfnBeginRenameSelection)(HWND hwnd, ClcData *dat); + void (*pfnCalcEipPosition)(ClcData *dat, ClcContact *contact, ClcGroup *group, POINT *result); + int (*pfnGetDropTargetInformation)(HWND hwnd, ClcData *dat, POINT pt); + int (*pfnClcStatusToPf2)(int status); + int (*pfnIsHiddenMode)(ClcData *dat, int status); + void (*pfnHideInfoTip)(HWND hwnd, ClcData *dat); + void (*pfnNotifyNewContact)(HWND hwnd, MCONTACT hContact); + DWORD (*pfnGetDefaultExStyle)(void); + void (*pfnGetDefaultFontSetting)(int i, LOGFONT* lf, COLORREF* colour); + void (*pfnGetFontSetting)(int i, LOGFONT* lf, COLORREF* colour); + void (*pfnLoadClcOptions)(HWND hwnd, ClcData *dat, BOOL bFirst); + void (*pfnRecalculateGroupCheckboxes)(HWND hwnd, ClcData *dat); + void (*pfnSetGroupChildCheckboxes)(ClcGroup *group, int checked); + void (*pfnInvalidateItem)(HWND hwnd, ClcData *dat, int iItem); + + int (*pfnGetRowBottomY)(ClcData *dat, int item); + int (*pfnGetRowHeight)(ClcData *dat, int item); + int (*pfnGetRowTopY)(ClcData *dat, int item); + int (*pfnGetRowTotalHeight)(ClcData *dat); + int (*pfnRowHitTest)(ClcData *dat, int y); + /* clistevents.c */ - int (*pfnEventsProcessContactDoubleClick)(MCONTACT hContact); - int (*pfnEventsProcessTrayDoubleClick)(int); + void (*blablablabla2)(); + void (*blablablabla3)(); /* clistmod.c */ - int (*pfnIconFromStatusMode)(const char *szProto, int status, MCONTACT hContact); - int (*pfnShowHide)(void); + int (*pfnIconFromStatusMode)(const char *szProto, int status, MCONTACT hContact); + int (*pfnShowHide)(void); /* clistsettings.c */ - ClcCacheEntry* (*pfnGetCacheEntry)(MCONTACT hContact); + void (*blablablabla1)(); ClcCacheEntry* (*pfnCreateCacheItem)(MCONTACT hContact); void (*pfnCheckCacheItem)(ClcCacheEntry*); void (*pfnFreeCacheItem)(ClcCacheEntry*); - - void (*pfnInvalidateDisplayNameCacheEntry)(MCONTACT hContact); + + void (*pfnInvalidateDisplayNameCacheEntry)(MCONTACT hContact); /* clisttray.c */ - int (*pfnTrayIconPauseAutoHide)(WPARAM wParam, LPARAM lParam); - INT_PTR (*pfnTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); + int (*pfnTrayIconPauseAutoHide)(WPARAM wParam, LPARAM lParam); + INT_PTR (*pfnTrayIconProcessMessage)(WPARAM wParam, LPARAM lParam); /* clui.c */ - LRESULT (CALLBACK *pfnContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); - - void (*pfnCluiProtocolStatusChanged)(int status, const char *szProto); - void (*pfnLoadCluiGlobalOpts)(void); - BOOL (*pfnInvalidateRect)(HWND hwnd, CONST RECT* lpRect, BOOL bErase); - void (*pfnOnCreateClc)(void); + LRESULT (CALLBACK *pfnContactListWndProc)(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + + void (*pfnCluiProtocolStatusChanged)(int status, const char *szProto); + void (*pfnLoadCluiGlobalOpts)(void); + BOOL (*pfnInvalidateRect)(HWND hwnd, CONST RECT* lpRect, BOOL bErase); + void (*pfnOnCreateClc)(void); /* contact.c */ - int (*pfnCompareContacts)(const ClcContact *contact1, const ClcContact *contact2); - int (*pfnSetHideOffline)(int newValue); // TRUE, FALSE or -1 to revert the current setting + int (*pfnCompareContacts)(const ClcContact *contact1, const ClcContact *contact2); + int (*pfnSetHideOffline)(int newValue); // TRUE, FALSE or -1 to revert the current setting /* docking.c */ - int (*pfnDocking_ProcessWindowMessage)(WPARAM wParam, LPARAM lParam); + int (*pfnDocking_ProcessWindowMessage)(WPARAM wParam, LPARAM lParam); /************************************************************************************* * version 2 - events processing diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 494deb0944..e28de7b603 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 5fcf370069..a593a4de4d 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index 811e95a5de..79d9ea0c99 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -88,7 +88,7 @@ static void amThreadProc(void *) goto LBL_Exit; } - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); HANDLE ACK = nullptr; if (pdnce->ApparentMode != ID_STATUS_OFFLINE) //don't ask if contact is always invisible (should be done with protocol) diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 7be75f489f..2cf812b360 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -46,7 +46,7 @@ static BOOL ExecuteOnAllContactsOfGroup(ClcGroup *group, ExecuteOnAllContactsFun // void Cache_GetTimezone(ClcData *dat, MCONTACT hContact) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (dat == nullptr && pcli->hwndContactTree) dat = (ClcData *)GetWindowLongPtr(pcli->hwndContactTree, 0); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index cbc887b625..9ac6cb147c 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -161,7 +161,7 @@ static int clcHookDbEventAdded(WPARAM hContact, LPARAM lParam) db_event_get(lParam, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { db_set_dw(hContact, "CList", "mf_lastmsg", dbei.timestamp); - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (pdnce) pdnce->dwLastMsgTime = dbei.timestamp; } diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 9dfe3505b6..e7697c0a0b 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -46,7 +46,7 @@ void AddSubcontacts(ClcData *dat, ClcContact *cont, BOOL showOfflineHereGroup) if (hsub == -1) continue; - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hsub); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hsub); if (pdnce->szProto == nullptr) continue; @@ -169,7 +169,7 @@ static void _LoadDataToContact(ClcContact *cont, ClcCacheEntry *pdnce, ClcGroup ClcContact* cli_AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (pdnce->m_iStatus == ID_STATUS_OFFLINE && dat->bPlaceOfflineToRoot) group = &dat->list; @@ -180,7 +180,7 @@ ClcContact* cli_AddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hConta void cli_AddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTotalCount, int checkHideOffline) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (dat->IsMetaContactsEnabled && pdnce->m_bIsSub) return; //contact should not be added @@ -344,7 +344,7 @@ ClcCacheEntry* cliCreateCacheItem(MCONTACT hContact) void cliInvalidateDisplayNameCacheEntry(MCONTACT hContact) { if (hContact != INVALID_CONTACT_ID) { - ClcCacheEntry *p = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *p = Clist_GetCacheEntry(hContact); if (p) p->m_iStatus = 0; } @@ -400,7 +400,7 @@ int CLVM_GetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat) int dbHidden = db_get_b(hContact, "CList", "Hidden", 0); // default hidden state, always respect it. int filterResult = 1; int searchResult = 0; - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); // always hide subcontacts (but show them on embedded contact lists) if (dat != nullptr && dat->IsMetaContactsEnabled && db_mc_isSub(hContact)) diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 7d1bf35620..a1cae8871d 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -78,7 +78,7 @@ int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact) // substitute params by mostonline contact datas MCONTACT hMostOnlineContact = db_mc_getMostOnline(hActContact); if (hMostOnlineContact) { - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hMostOnlineContact); + ClcCacheEntry *cacheEntry = Clist_GetCacheEntry(hMostOnlineContact); if (cacheEntry && cacheEntry->szProto) { szActProto = cacheEntry->szProto; nActStatus = cacheEntry->m_iStatus; diff --git a/plugins/Clist_modern/src/modern_clistsettings.cpp b/plugins/Clist_modern/src/modern_clistsettings.cpp index 1dbfe85f35..5d5cc8d7cf 100644 --- a/plugins/Clist_modern/src/modern_clistsettings.cpp +++ b/plugins/Clist_modern/src/modern_clistsettings.cpp @@ -78,7 +78,7 @@ int GetStatusForContact(MCONTACT hContact, char *szProto) int GetContactInfosForSort(MCONTACT hContact, char **Proto, wchar_t **Name, int *Status) { - ClcCacheEntry *cacheEntry = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *cacheEntry = Clist_GetCacheEntry(hContact); if (cacheEntry != nullptr) { if (Proto != nullptr) *Proto = cacheEntry->szProto; if (Name != nullptr) *Name = cacheEntry->tszName; @@ -89,7 +89,7 @@ int GetContactInfosForSort(MCONTACT hContact, char **Proto, wchar_t **Name, int int GetContactCachedStatus(MCONTACT hContact) { - return pcli->pfnGetCacheEntry(hContact)->getStatus(); + return Clist_GetCacheEntry(hContact)->getStatus(); } int ContactAdded(WPARAM hContact, LPARAM) @@ -102,7 +102,7 @@ int ContactAdded(WPARAM hContact, LPARAM) int MetaStatusChanged(WPARAM hMeta, LPARAM) { - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hMeta); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hMeta); if (pdnce) Clist_Broadcast(INTM_STATUSCHANGED, hMeta, 0); @@ -114,7 +114,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) if (MirandaExiting() || !pcli || !hContact) return 0; - ClcCacheEntry *pdnce = pcli->pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (pdnce == nullptr) { TRACE("!!! Very bad pdnce not found."); return 0; diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 29530ba84a..4b1f11877f 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -133,11 +133,12 @@ void fnUnregisterFileDropping(HWND hwnd); struct CListEvent* fnAddEvent(CLISTEVENT *cle); CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx); -int fnEventsProcessContactDoubleClick(MCONTACT hContact); -int fnEventsProcessTrayDoubleClick(int); int fnGetImlIconIndex(HICON hIcon); int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent); +int EventsProcessContactDoubleClick(MCONTACT hContact); +int EventsProcessTrayDoubleClick(int); + /* clistmod.c */ int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact); int fnShowHide(void); diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index cc521205d4..beb352ea49 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -106,7 +106,7 @@ ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags if (flags != (DWORD)-1 && pNextField == nullptr && calcTotalMembers) { DWORD style = GetWindowLongPtr(hwnd, GWL_STYLE); for (auto &hContact : Contacts()) { - ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *cache = Clist_GetCacheEntry(hContact); if (!mir_wstrcmp(cache->tszGroup, szName) && (style & CLS_SHOWHIDDEN || !cache->bIsHidden)) group->totalMembers++; } @@ -181,7 +181,7 @@ ClcContact* fnAddContactToGroup(ClcData *dat, ClcGroup *group, MCONTACT hContact char *szProto = GetContactProto(hContact); - ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pce = Clist_GetCacheEntry(hContact); replaceStrW(pce->tszGroup, nullptr); ClcContact *cc = cli.pfnAddItemToGroup(group, index + 1); @@ -362,7 +362,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) for (auto &hContact : Contacts()) { int nHiddenStatus = cli.pfnGetContactHiddenStatus(hContact, nullptr, dat); if (((style & CLS_SHOWHIDDEN) && nHiddenStatus != -1) || !nHiddenStatus) { - ClcCacheEntry *pce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pce = Clist_GetCacheEntry(hContact); if (pce->szProto == nullptr) continue; diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index 5a58f6e157..4d846c0ece 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -124,8 +124,6 @@ void InitClistCore() cli.pfnRowHitTest = fnRowHitTest; cli.pfnAddEvent = fnAddEvent; - cli.pfnEventsProcessContactDoubleClick = fnEventsProcessContactDoubleClick; - cli.pfnEventsProcessTrayDoubleClick = fnEventsProcessTrayDoubleClick; cli.pfnGetEvent = fnGetEvent; cli.pfnGetImlIconIndex = fnGetImlIconIndex; cli.pfnRemoveEvent = fnRemoveEvent; @@ -134,7 +132,6 @@ void InitClistCore() cli.pfnCreateCacheItem = fnCreateCacheItem; cli.pfnCheckCacheItem = fnCheckCacheItem; cli.pfnFreeCacheItem = fnFreeCacheItem; - cli.pfnGetCacheEntry = fnGetCacheEntry; cli.szTip = szTip; diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index fff355e70f..0bd3951cc9 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -263,7 +263,7 @@ CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx) return nullptr; } -int fnEventsProcessContactDoubleClick(MCONTACT hContact) +int EventsProcessContactDoubleClick(MCONTACT hContact) { for (auto &it : g_cliEvents) { if (it->hContact == hContact) { @@ -277,7 +277,7 @@ int fnEventsProcessContactDoubleClick(MCONTACT hContact) return 1; } -int fnEventsProcessTrayDoubleClick(int index) +int EventsProcessTrayDoubleClick(int index) { BOOL click_in_first_icon = FALSE; if (g_cliEvents.getCount() == 0) diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 65c2010e2e..1474f15630 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -343,7 +343,7 @@ static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move) // must rename setting in all child contacts too for (auto &hContact : Contacts()) { - ClcCacheEntry *cache = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *cache = Clist_GetCacheEntry(hContact); if (!mir_wstrcmp(cache->tszGroup, oldName)) { db_set_ws(hContact, "CList", "Group", szName); replaceStrW(cache->tszGroup, szName); diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index b9bb9727f9..683c99e108 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -223,7 +223,7 @@ static int ContactListAccountsChanged(WPARAM eventCode, LPARAM lParam) MIR_APP_DLL(void) Clist_ContactDoubleClicked(MCONTACT hContact) { // Try to process event myself - if (cli.pfnEventsProcessContactDoubleClick(hContact) == 0) + if (EventsProcessContactDoubleClick(hContact) == 0) return; // Allow third-party plugins to process a dblclick diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index 105f06fd91..ef7dc74b7b 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -72,7 +72,7 @@ void fnFreeCacheItem(ClcCacheEntry *p) p->bIsHidden = -1; } -ClcCacheEntry* fnGetCacheEntry(MCONTACT hContact) +MIR_APP_DLL(ClcCacheEntry*) Clist_GetCacheEntry(MCONTACT hContact) { ClcCacheEntry *p; int idx = clistCache.getIndex((ClcCacheEntry*)&hContact); @@ -112,7 +112,7 @@ MIR_APP_DLL(wchar_t*) Clist_GetContactDisplayName(MCONTACT hContact, int mode) if (mode & GCDNF_NOCACHE) mode &= ~GCDNF_NOCACHE; else if (mode != GCDNF_NOMYHANDLE) { - cacheEntry = cli.pfnGetCacheEntry(hContact); + cacheEntry = Clist_GetCacheEntry(hContact); if (cacheEntry && cacheEntry->tszName) return cacheEntry->tszName; } @@ -191,7 +191,7 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) char *szProto = GetContactProto(hContact); if (!mir_strcmp(cws->szModule, szProto)) { if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName") || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); replaceStrW(pdnce->tszName, nullptr); cli.pfnCheckCacheItem(pdnce); } @@ -206,12 +206,12 @@ int ContactSettingChanged(WPARAM hContact, LPARAM lParam) Clist_ChangeContactIcon(hContact, cli.pfnIconFromStatusMode(szProto, szProto == nullptr ? ID_STATUS_OFFLINE : db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE), hContact)); } else if (!strcmp(cws->szSetting, "MyHandle")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); replaceStrW(pdnce->tszName, nullptr); cli.pfnCheckCacheItem(pdnce); } else if (!strcmp(cws->szSetting, "Group")) { - ClcCacheEntry *pdnce = cli.pfnGetCacheEntry(hContact); + ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); Dbwcs2tstr(cws, pdnce->tszGroup); } } diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index c57c684a1d..72ad947983 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -711,7 +711,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) GetCursorPos(&pt); TrackPopupMenu(hMenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_LEFTBUTTON, pt.x, pt.y, 0, msg->hwnd, nullptr); } - else if (cli.pfnEventsProcessTrayDoubleClick(msg->wParam)) + else if (EventsProcessTrayDoubleClick(msg->wParam)) cli.pfnShowHide(); } else if (msg->lParam == WM_RBUTTONUP) { diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index 77e539c784..2295c2b198 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -832,7 +832,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (hItem) { if (hitFlags & CLCHT_ONITEMEXTRA) { if (!IsHContactGroup((UINT_PTR)hItem) && !IsHContactInfo((UINT_PTR)hItem)) - if (cli.pfnGetCacheEntry((UINT_PTR)nmc->hItem)) + if (Clist_GetCacheEntry((UINT_PTR)nmc->hItem)) NotifyEventHooks(hEventExtraClick, (WPARAM)nmc->hItem, nmc->iColumn + 1); } break; diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp index 0c805443d8..5c5c47a9b1 100644 --- a/src/mir_app/src/keyboard.cpp +++ b/src/mir_app/src/keyboard.cpp @@ -34,7 +34,9 @@ static INT_PTR hkHideShow(WPARAM, LPARAM) static INT_PTR hkRead(WPARAM, LPARAM) { - if (cli.pfnEventsProcessTrayDoubleClick(0) == 0) return TRUE; + if (EventsProcessTrayDoubleClick(0) == 0) + return true; + SetForegroundWindow(cli.hwndContactList); SetFocus(cli.hwndContactList); return 0; diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index ce81e5405c..d6d6715df8 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -555,3 +555,4 @@ Clist_TrayIconDestroy @574 Clist_TrayIconAdd @575 Clist_TraySetTimer @576 Clist_GetContactDisplayName @577 +Clist_GetCacheEntry @578 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index a46b4aa1e0..f1ffdd88ea 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -555,3 +555,4 @@ Clist_TrayIconDestroy @574 Clist_TrayIconAdd @575 Clist_TraySetTimer @576 Clist_GetContactDisplayName @577 +Clist_GetCacheEntry @578 -- cgit v1.2.3