diff options
author | George Hazan <george.hazan@gmail.com> | 2023-05-21 14:56:39 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-05-21 14:56:39 +0300 |
commit | f04b54e3fc162d475e8688784631a316f264f733 (patch) | |
tree | 5feed9526e1c2acac25942f39f68713b8ccb9d1d /plugins/Clist_modern | |
parent | ec8a7614a371f41937dc1dbc2d53289e45706e3a (diff) |
Clist_RemoveEvent became static, pfnRemoveEvent is replaced with pfnFreeEvent
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/init.cpp | 2 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_clistevents.cpp | 20 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_commonprototypes.h | 2 |
3 files changed, 8 insertions, 16 deletions
diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 6e809c6b4b..851076a1c5 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -206,7 +206,7 @@ static HRESULT SubclassClistInterface() g_clistApi.pfnContactListControlWndProc = cli_ContactListControlWndProc;
g_clistApi.pfnProcessExternalMessages = cli_ProcessExternalMessages;
g_clistApi.pfnAddEvent = cli_AddEvent;
- g_clistApi.pfnRemoveEvent = cli_RemoveEvent;
+ g_clistApi.pfnFreeEvent = cli_RemoveEvent;
g_clistApi.pfnDocking_ProcessWindowMessage = Docking_ProcessWindowMessage;
return S_OK;
}
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index e918bcee65..d0eb4753d2 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -155,19 +155,11 @@ CListEvent* cli_AddEvent(CLISTEVENT *cle) }
-int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent)
+int cli_RemoveEvent(CListEvent *pEvent)
{
- // Find the event that should be removed
- CListEvent *pEvent = nullptr;
- for (auto &it : *g_clistApi.events)
- if (it->hContact == hContact && it->hDbEvent == hDbEvent) {
- pEvent = it;
- break;
- }
-
- // Event was not found
- if (pEvent == nullptr)
- return 1;
+ // save variables because pEvent should be freed
+ auto hContact = pEvent->hContact;
+ auto hDbEvent = pEvent->hDbEvent;
// remove event from the notify menu
int iMenuId = pEvent->menuId;
@@ -184,7 +176,7 @@ int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent) }
}
- int res = corecli.pfnRemoveEvent(hContact, hDbEvent);
+ int res = corecli.pfnFreeEvent(pEvent);
if (g_clistApi.events->getCount() == 0) {
g_CluiData.bNotifyActive = false;
@@ -407,7 +399,7 @@ static LRESULT CALLBACK EventArea_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LP // event we're interested in was removed by the service (nasty one...)
cle1 = MyGetEvent(iSelection);
if (cle1 != nullptr)
- g_clistApi.pfnRemoveEvent(cle->hContact, cle->hDbEvent);
+ Clist_RemoveEvent(cle->hContact, cle->hDbEvent);
}
}
}
diff --git a/plugins/Clist_modern/src/modern_commonprototypes.h b/plugins/Clist_modern/src/modern_commonprototypes.h index 78cc984508..69c0264136 100644 --- a/plugins/Clist_modern/src/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/modern_commonprototypes.h @@ -214,7 +214,7 @@ int cliGetGroupContentsCount(ClcGroup *group, int visibleOnly); int cliFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk);
int cliGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
int cli_IconFromStatusMode(const char *szProto, int nStatus, MCONTACT hContact);
-int cli_RemoveEvent(MCONTACT hContact, MEVENT hDbEvent);
+int cli_RemoveEvent(CListEvent *cle);
void cli_FreeContact(ClcContact*);
void cli_SetContactCheckboxes(ClcContact*, int);
LRESULT cli_ProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
|