diff options
24 files changed, 40 insertions, 39 deletions
diff --git a/include/m_clistint.h b/include/m_clistint.h index f2d8c70467..c38a3ff812 100644 --- a/include/m_clistint.h +++ b/include/m_clistint.h @@ -286,6 +286,8 @@ EXTERN_C MIR_APP_DLL(int) Clist_TrayIconSetBaseInfo(HICON hIcon, const cha EXTERN_C MIR_APP_DLL(void) Clist_TrayIconUpdateBase(const char *szChangedProto);
EXTERN_C MIR_APP_DLL(void) Clist_TraySetTimer();
+MIR_APP_DLL(CListEvent*) Clist_GetEvent(MCONTACT hContact, int idx);
+
EXTERN_C MIR_APP_DLL(ClcCacheEntry*) Clist_GetCacheEntry(MCONTACT hContact);
// calculates account's index by its position in status bar
@@ -394,7 +396,6 @@ struct CLIST_INTERFACE OBJLIST<CListEvent> *events;
CListEvent* (*pfnAddEvent)(CLISTEVENT*);
- CLISTEVENT* (*pfnGetEvent)(MCONTACT hContact, int idx);
int (*pfnRemoveEvent)(MCONTACT hContact, MEVENT hDbEvent);
int (*pfnGetImlIconIndex)(HICON hIcon);
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex c5387ed734..e15d70e7d1 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex fd8947ee81..ffa505ace7 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib 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();
diff --git a/protocols/ICQ-WIM/src/utils.cpp b/protocols/ICQ-WIM/src/utils.cpp index 83d876adb0..4c5d494115 100644 --- a/protocols/ICQ-WIM/src/utils.cpp +++ b/protocols/ICQ-WIM/src/utils.cpp @@ -380,7 +380,7 @@ void CIcqProto::EmailNotification(const wchar_t *pwszText) mir_snprintf(szServiceFunction, "%s%s", m_szModuleName, PS_DUMMY);
int i = 0;
- while (CLISTEVENT *pcle = g_clistApi.pfnGetEvent(-1, i++))
+ while (auto *pcle = Clist_GetEvent(-1, i++))
if (!mir_strcmp(pcle->pszService, szServiceFunction))
return;
diff --git a/protocols/IRCG/src/clist.cpp b/protocols/IRCG/src/clist.cpp index c3f24b5dfd..e8bdb1a5b3 100644 --- a/protocols/IRCG/src/clist.cpp +++ b/protocols/IRCG/src/clist.cpp @@ -73,7 +73,7 @@ BOOL CIrcProto::CList_AddDCCChat(const CMStringW& name, const CMStringW& hostmas cle.szTooltip.w = szNick;
cle.lParam = (LPARAM)pdci;
- if (g_clistApi.pfnGetEvent(hContact, 0))
+ if (Clist_GetEvent(hContact, 0))
g_clistApi.pfnRemoveEvent(hContact, -100);
g_clistApi.pfnAddEvent(&cle);
}
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 652da6a36c..20e9ba44a9 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -266,7 +266,7 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam) ACKDATA *ack = (ACKDATA*)lParam;
if (ack->type == ACKTYPE_FILE) {
int iEvent = 0;
- while (CLISTEVENT *cle = g_clistApi.pfnGetEvent(ack->hContact, iEvent++))
+ while (auto *cle = Clist_GetEvent(ack->hContact, iEvent++))
if (cle->lParam == (LPARAM)ack->hProcess)
g_clistApi.pfnRemoveEvent(ack->hContact, cle->hDbEvent);
}
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 22f16ec7c4..63fde09620 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -272,7 +272,7 @@ void CMsgDialog::OnActivate() 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/src/core/stdmsg/src/tabs.cpp b/src/core/stdmsg/src/tabs.cpp index fcce849ab8..e6a5d34e93 100644 --- a/src/core/stdmsg/src/tabs.cpp +++ b/src/core/stdmsg/src/tabs.cpp @@ -476,7 +476,7 @@ void CTabbedWindow::TabClicked() if (si->wState & GC_EVENT_HIGHLIGHT) {
si->wState &= ~GC_EVENT_HIGHLIGHT;
- if (g_clistApi.pfnGetEvent(si->hContact, 0))
+ if (Clist_GetEvent(si->hContact, 0))
g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
}
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 2246219438..37e32e0d95 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -129,7 +129,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM) SESSION_INFO *si = Chat_Find(roomid, szProto);
if (si) {
- if (si->pDlg != nullptr && !g_clistApi.pfnGetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
+ if (si->pDlg != nullptr && !Clist_GetEvent(hContact, 0) && IsWindowVisible(si->pDlg->GetHwnd()) && !IsIconic(si->pDlg->GetHwnd())) {
si->pDlg->CloseTab();
return 1;
}
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 49f39c0883..394f0d16e7 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -113,7 +113,7 @@ static SESSION_INFO* SM_CreateSession(void) void SM_FreeSession(SESSION_INFO *si)
{
- if (g_clistApi.pfnGetEvent(si->hContact, 0))
+ if (Clist_GetEvent(si->hContact, 0))
g_clistApi.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT);
si->wState &= ~STATE_TALK;
db_set_w(si->hContact, si->pszModule, "ApparentMode", 0);
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index e06e4ab30f..cbe06d3d77 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -132,11 +132,11 @@ static void AddEvent(MCONTACT hContact, HICON hIcon, int type, const wchar_t *pw CreateServiceFunction(cle.pszService, &EventDoubleclicked);
if (type) {
- if (!g_clistApi.pfnGetEvent(hContact, 0))
+ if (!Clist_GetEvent(hContact, 0))
g_clistApi.pfnAddEvent(&cle);
}
else {
- if (g_clistApi.pfnGetEvent(hContact, 0))
+ if (Clist_GetEvent(hContact, 0))
g_clistApi.pfnRemoveEvent(hContact, GC_FAKE_EVENT);
g_clistApi.pfnAddEvent(&cle);
}
@@ -228,7 +228,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case WM_CONTEXTMENU:
SESSION_INFO *si = (SESSION_INFO*)PUGetPluginData(hWnd);
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/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 15eae7d75c..6a38b78e9f 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -119,7 +119,6 @@ void UnregisterFileDropping(HWND hwnd); /* clistevents.c */
struct CListEvent* fnAddEvent(CLISTEVENT *cle);
-CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx);
int fnGetImlIconIndex(HICON hIcon);
int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent);
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index ebfa53dda6..dcb1b64045 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -100,7 +100,6 @@ void InitClistCore() g_clistApi.pfnRowHitTest = fnRowHitTest;
g_clistApi.pfnAddEvent = fnAddEvent;
- g_clistApi.pfnGetEvent = fnGetEvent;
g_clistApi.pfnGetImlIconIndex = fnGetImlIconIndex;
g_clistApi.pfnRemoveEvent = fnRemoveEvent;
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index 89928c9569..51185c681f 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -242,7 +242,7 @@ int fnRemoveEvent(MCONTACT hContact, MEVENT dbEvent) /////////////////////////////////////////////////////////////////////////////////////////
-CLISTEVENT* fnGetEvent(MCONTACT hContact, int idx)
+MIR_APP_DLL(CListEvent *) Clist_GetEvent(MCONTACT hContact, int idx)
{
if (hContact == INVALID_CONTACT_ID) {
if (idx >= g_cliEvents.getCount())
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index fc9f882c9f..4dba25cc4d 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -869,3 +869,4 @@ Chat_IsMuted @941 NONAME ?OnCreateOfflineFile@PROTO_INTERFACE@@UAEXAAVFILE_BLOB@DB@@PAX@Z @984 NONAME
?setSize@FILE_BLOB@DB@@QAEX_J@Z @985 NONAME
?setUrl@FILE_BLOB@DB@@QAEXPBD@Z @986 NONAME
+?Clist_GetEvent@@YGPAUCListEvent@@IH@Z @987 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 091462dd8c..6c56bbbffa 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -869,3 +869,4 @@ Chat_IsMuted @941 NONAME ?OnCreateOfflineFile@PROTO_INTERFACE@@UEAAXAEAVFILE_BLOB@DB@@PEAX@Z @984 NONAME
?setSize@FILE_BLOB@DB@@QEAAX_J@Z @985 NONAME
?setUrl@FILE_BLOB@DB@@QEAAXPEBD@Z @986 NONAME
+?Clist_GetEvent@@YAPEAUCListEvent@@IH@Z @987 NONAME
|