diff options
author | George Hazan <george.hazan@gmail.com> | 2023-05-21 15:23:35 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-05-21 15:23:35 +0300 |
commit | d43eaaab830eb233f998f2bf5514b3943b6aeb30 (patch) | |
tree | ca9cfdd69f9019197b2ba8ce709518f1fa91a61a /plugins/Clist_nicer | |
parent | f04b54e3fc162d475e8688784631a316f264f733 (diff) |
link to events collection also removed from CLIST_INTERFACE + code cleaning
Diffstat (limited to 'plugins/Clist_nicer')
-rw-r--r-- | plugins/Clist_nicer/src/clistevents.cpp | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index 08a48dcede..667fc07b3f 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -64,15 +64,6 @@ void HideShowNotifyFrame() }
}
-static CLISTEVENT* MyGetEvent(int iSelection)
-{
- for (auto &p : *g_clistApi.events)
- if (p->menuId == iSelection)
- return p;
-
- return nullptr;
-}
-
LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
@@ -153,13 +144,13 @@ LRESULT CALLBACK EventAreaWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa if (result != 0) {
nmi = (struct NotifyMenuItemExData *) mii.dwItemData;
if (nmi) {
- CLISTEVENT *cle = MyGetEvent(iSelection);
+ auto *cle = Clist_GetEventByMenu(iSelection);
if (cle) {
- CLISTEVENT *cle1 = nullptr;
CallService(cle->pszService, (WPARAM)NULL, (LPARAM)cle);
+
// re-obtain the pointer, it may already be invalid/point to another event if the
// event we're interested in was removed by the service (nasty one...)
- cle1 = MyGetEvent(iSelection);
+ auto *cle1 = Clist_GetEventByMenu(iSelection);
if (cle1 != nullptr)
Clist_RemoveEvent(cle->hContact, cle->hDbEvent);
}
@@ -296,7 +287,7 @@ CListEvent* AddEvent(CLISTEVENT *cle) }
}
- if (g_clistApi.events->getCount() > 0) {
+ if (Clist_GetEventCount() > 0) {
cfg::dat.bEventAreaEnabled = TRUE;
if (cfg::dat.notifyActive == 0) {
cfg::dat.notifyActive = 1;
@@ -334,7 +325,7 @@ int RemoveEvent(CListEvent *e) auto hDbEvent = e->hDbEvent;
int res = coreCli.pfnFreeEvent(e);
- if (g_clistApi.events->getCount() == 0) {
+ if (Clist_GetEventCount() == 0) {
cfg::dat.bEventAreaEnabled = FALSE;
if (cfg::dat.dwFlags & CLUI_FRAME_AUTOHIDENOTIFY) {
cfg::dat.notifyActive = 0;
|