From ec8a7614a371f41937dc1dbc2d53289e45706e3a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 21 May 2023 13:56:23 +0300 Subject: static function pfnGetEvent removed from CLIST_INTERFACE --- plugins/KeyboardNotify/src/main.cpp | 32 ++++++++++++++--------------- plugins/NewEventNotify/src/popup.cpp | 2 +- plugins/NotesAndReminders/src/reminders.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 4 ++-- plugins/TabSRMM/src/chat_tools.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 4 ++-- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msgdlgother.cpp | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) (limited to 'plugins') diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index b0b65376aa..f4c1ac3e61 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -239,13 +239,11 @@ BOOL metaCheckProtocol(const char *szProto, MCONTACT hContact, uint16_t eventTyp BOOL checkUnopenEvents() { - int nIndex; - CLISTEVENT *pCLEvent; - if (nExternCount && bFlashOnOther) return TRUE; - for (nIndex = 0; pCLEvent = g_clistApi.pfnGetEvent(-1, nIndex); nIndex++) { + int nIndex = 0; + while (auto *pCLEvent = Clist_GetEvent(-1, nIndex)) { DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg) || @@ -254,6 +252,7 @@ BOOL checkUnopenEvents() if (metaCheckProtocol(einfo.szModule, pCLEvent->hContact, einfo.eventType)) return TRUE; + nIndex++; } return FALSE; @@ -426,26 +425,27 @@ static int OnGcEvent(WPARAM, LPARAM lParam) static VOID CALLBACK ReminderTimer(HWND, UINT, UINT_PTR, DWORD) { - int nIndex; - CLISTEVENT *pCLEvent; - if (!bReminderDisabled && nExternCount && bFlashOnOther) { SetEvent(hFlashEvent); return; } - for (nIndex = 0; !bReminderDisabled && (pCLEvent = g_clistApi.pfnGetEvent(-1, nIndex)); nIndex++) { - DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); + int nIndex = 0; + while (auto *pCLEvent = Clist_GetEvent(-1, nIndex)) { + if (bReminderDisabled) + break; + DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg) || - (einfo.eventType == EVENTTYPE_FILE && bFlashOnFile) || - (einfo.eventType != EVENTTYPE_MESSAGE && einfo.eventType != EVENTTYPE_FILE && bFlashOnOther)) + (einfo.eventType == EVENTTYPE_FILE && bFlashOnFile) || + (einfo.eventType != EVENTTYPE_MESSAGE && einfo.eventType != EVENTTYPE_FILE && bFlashOnOther)) if (metaCheckProtocol(einfo.szModule, pCLEvent->hContact, einfo.eventType) && checkNotifyOptions() && checkStatus(einfo.szModule) && checkXstatus(einfo.szModule)) { - SetEvent(hFlashEvent); return; } + + nIndex++; } } @@ -847,10 +847,8 @@ BOOL CheckMsgWnd(MCONTACT hContact, BOOL *focus) void countUnopenEvents(int *msgCount, int *fileCount, int *otherCount) { - int nIndex; - CLISTEVENT *pCLEvent; - - for (nIndex = 0; pCLEvent = g_clistApi.pfnGetEvent(-1, nIndex); nIndex++) { + int nIndex = 0; + while (auto *pCLEvent = Clist_GetEvent(-1, nIndex)) { DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); if (metaCheckProtocol(einfo.szModule, pCLEvent->hContact, einfo.eventType)) { @@ -868,7 +866,9 @@ void countUnopenEvents(int *msgCount, int *fileCount, int *otherCount) (*otherCount)++; } } + nIndex++; } + if (bFlashOnOther) (*otherCount) += nExternCount; } diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index cfb40947b7..c0218bf43d 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -63,7 +63,7 @@ int PopupAct(HWND hWnd, UINT mask, PLUGIN_DATA *pdata) MEVENT hEvent = pdata->events[0]; for (int idx = 0;; idx++) { - CLISTEVENT *cle = g_clistApi.pfnGetEvent(pdata->hContact, idx); + auto *cle = Clist_GetEvent(pdata->hContact, idx); if (cle == nullptr) { CallFunctionSync(DoDefaultHandling, pdata); break; diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index f047751a6b..125aa07d58 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -113,7 +113,7 @@ static void RemoveReminderSystemEvent(REMINDERDATA *p) { if (p->bSystemEventQueued) { for (int i = 0;; i++) { - CLISTEVENT *pev = g_clistApi.pfnGetEvent(-1, i); + auto *pev = Clist_GetEvent(-1, i); if (!pev) break; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 1eab95ef1a..d6d589bd69 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1041,7 +1041,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (m_si->wState & GC_EVENT_HIGHLIGHT) { m_si->wState &= ~GC_EVENT_HIGHLIGHT; - if (g_clistApi.pfnGetEvent(m_hContact, 0)) + if (Clist_GetEvent(m_hContact, 0)) g_clistApi.pfnRemoveEvent(m_hContact, GC_FAKE_EVENT); } @@ -1063,7 +1063,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) if (db_get_w(m_hContact, m_si->pszModule, "ApparentMode", 0) != 0) db_set_w(m_hContact, m_si->pszModule, "ApparentMode", 0); - if (g_clistApi.pfnGetEvent(m_hContact, 0)) + if (Clist_GetEvent(m_hContact, 0)) g_clistApi.pfnRemoveEvent(m_hContact, GC_FAKE_EVENT); } else { diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 49063bf0a4..8c3d507819 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -40,7 +40,7 @@ static void __stdcall Chat_DismissPopup(void *pi) { SESSION_INFO *si = (SESSION_INFO*)pi; if (si->hContact) - if (g_clistApi.pfnGetEvent(si->hContact, 0)) + if (Clist_GetEvent(si->hContact, 0)) g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); if (si->pDlg && si->pDlg->timerFlash.Stop()) diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 5deb191552..67685eabfa 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -157,7 +157,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case WM_HOTKEY: { - CLISTEVENT *cli = g_clistApi.pfnGetEvent(-1, 0); + auto *cli = Clist_GetEvent(-1, 0); if (cli != nullptr) { if (strncmp(cli->pszService, MS_MSG_TYPINGMESSAGE, mir_strlen(cli->pszService))) { CallService(cli->pszService, 0, (LPARAM)cli); @@ -220,7 +220,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (lParam == 0) HandleMenuEntryFromhContact(wParam); else { - CLISTEVENT *cle = g_clistApi.pfnGetEvent(wParam, 0); + auto *cle = Clist_GetEvent(wParam, 0); if (cle) { if (ServiceExists(cle->pszService)) { CallService(cle->pszService, 0, (LPARAM)cle); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index b131ac952c..7d6316ac5f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -695,7 +695,7 @@ void CMsgDialog::OnDestroy() DestroyWindow(m_hwndPanelPicParent); if (m_si) { - if (g_clistApi.pfnGetEvent(m_si->hContact, 0)) + if (Clist_GetEvent(m_si->hContact, 0)) g_clistApi.pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); m_si->wState &= ~STATE_TALK; m_si->pDlg = nullptr; diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index b04236acfb..5a736cd187 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -2953,7 +2953,7 @@ void CMsgDialog::UpdateWindowState(UINT msg) if (db_get_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0) != 0) db_set_w(m_si->hContact, m_si->pszModule, "ApparentMode", 0); - if (g_clistApi.pfnGetEvent(m_si->hContact, 0)) + if (Clist_GetEvent(m_si->hContact, 0)) g_clistApi.pfnRemoveEvent(m_si->hContact, GC_FAKE_EVENT); UpdateTitle(); -- cgit v1.2.3