From bb5aff746c50564ded61159c5ae28e6218d0a49d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 28 Jan 2016 16:04:16 +0000 Subject: another atavism removed: old stub services for clist events git-svn-id: http://svn.miranda-ng.org/main/trunk@16181 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/core/stdauth/src/auth.cpp | 4 ++-- src/core/stdauth/src/main.cpp | 2 ++ src/core/stdchat/src/window.cpp | 12 ++++++------ src/core/stdfile/src/file.cpp | 11 +++-------- src/core/stdmsg/src/msglog.cpp | 2 +- src/core/stdmsg/src/msgs.cpp | 2 +- src/core/stduseronline/src/useronline.cpp | 4 ++-- src/mir_app/src/chat_clist.cpp | 12 ++++++------ src/mir_app/src/chat_tools.cpp | 4 ++-- src/mir_app/src/clistevents.cpp | 9 --------- 10 files changed, 25 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/core/stdauth/src/auth.cpp b/src/core/stdauth/src/auth.cpp index 1358e7858c..adb4577ab3 100644 --- a/src/core/stdauth/src/auth.cpp +++ b/src/core/stdauth/src/auth.cpp @@ -93,7 +93,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST); cli.pszService = MS_AUTH_SHOWREQUEST; - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cli); + pcli->pfnAddEvent(&cli); } else if (dbei.eventType == EVENTTYPE_ADDED) { SkinPlaySound("AddedEvent"); @@ -104,7 +104,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam) cli.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD); cli.pszService = MS_AUTH_SHOWADDED; - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cli); + pcli->pfnAddEvent(&cli); } return 0; } diff --git a/src/core/stdauth/src/main.cpp b/src/core/stdauth/src/main.cpp index f5f9e27d74..bfda91b735 100644 --- a/src/core/stdauth/src/main.cpp +++ b/src/core/stdauth/src/main.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., int LoadSendRecvAuthModule(void); +CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; @@ -56,6 +57,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_SRAUTH extern "C" int __declspec(dllexport) Load(void) { mir_getLP(&pluginInfo); + mir_getCLI(); LoadSendRecvAuthModule(); return 0; diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index fec7afd472..00abe9297a 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -1734,8 +1734,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (s->wState & GC_EVENT_HIGHLIGHT) { s->wState &= ~GC_EVENT_HIGHLIGHT; - if (CallService(MS_CLIST_GETEVENT, (WPARAM)s->hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM)s->hContact, (LPARAM)GC_FAKE_EVENT); + if (pcli->pfnGetEvent(s->hContact, 0)) + pcli->pfnRemoveEvent(s->hContact, GC_FAKE_EVENT); } SendMessage(hwndDlg, GC_FIXTABICONS, 0, (LPARAM)s); @@ -1914,8 +1914,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar db_set_dw(si->hContact, CHAT_MODULE, "roomwidth", si->iWidth); db_set_dw(si->hContact, CHAT_MODULE, "roomheight", si->iHeight); } - if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT); + if (pcli->pfnGetEvent(si->hContact, 0)) + pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); si->wState &= ~STATE_TALK; db_set_w(si->hContact, si->pszModule, "ApparentMode", 0); SendMessage(hwndDlg, GC_CLOSEWINDOW, 0, 0); @@ -2087,8 +2087,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar FlashWindow(hwndDlg, FALSE); if (db_get_w(si->hContact, si->pszModule, "ApparentMode", 0) != 0) db_set_w(si->hContact, si->pszModule, "ApparentMode", (LPARAM)0); - if (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT); + if (pcli->pfnGetEvent(si->hContact, 0)) + pcli->pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); } break; diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 752c1f1fae..33d6a5df66 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -128,7 +128,7 @@ void PushFileEvent(MCONTACT hContact, MEVENT hdbe, LPARAM lParam) cle.flags |= CLEF_TCHAR; cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE); cle.pszService = "SRFile/RecvFile"; - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); + pcli->pfnAddEvent(&cle); } } @@ -321,14 +321,9 @@ static int SRFileProtoAck(WPARAM, LPARAM lParam) if (ack->type != ACKTYPE_FILE) return 0; int iEvent = 0; - CLISTEVENT *cle = NULL; - while ((cle = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, ack->hContact, iEvent++)) != NULL) - { + while (CLISTEVENT *cle = pcli->pfnGetEvent(ack->hContact, iEvent++)) if (cle->lParam == (LPARAM)ack->hProcess) - { - CallService(MS_CLIST_REMOVEEVENT, ack->hContact, cle->hDbEvent); - } - } + pcli->pfnRemoveEvent(ack->hContact, cle->hDbEvent); return 0; } diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index 66ae2ab483..29ab6af1f9 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -221,7 +221,7 @@ static char* CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, MEVENT } if (!(dbei.flags & DBEF_SENT) && (dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) { db_event_markRead(hContact, hDbEvent); - CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)hDbEvent); + pcli->pfnRemoveEvent(hContact, hDbEvent); } else if (dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) { db_event_markRead(hContact, hDbEvent); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index ebb815c423..aeeaceb504 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -58,7 +58,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) if (dbei.flags & (DBEF_SENT | DBEF_READ) || !(dbei.eventType == EVENTTYPE_MESSAGE || DbEventIsForMsgWindow(&dbei))) return 0; - CallServiceSync(MS_CLIST_REMOVEEVENT, hContact, 1); + pcli->pfnRemoveEvent(hContact, 1); /* does a window for the contact exist? */ HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact); if (hwnd) { diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 12f7cda357..20ba0e68cf 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -47,7 +47,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) int lastEvent = (int)db_get_dw(hContact, "UserOnline", "LastEvent", 0); if (lastEvent) { - CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)lastEvent); + pcli->pfnRemoveEvent(hContact, lastEvent); db_set_dw(hContact, "UserOnline", "LastEvent", 0); } } @@ -67,7 +67,7 @@ static int UserOnlineSettingChanged(WPARAM hContact, LPARAM lParam) cle.hIcon = Skin_LoadIcon(SKINICON_OTHER_USERONLINE, false); cle.pszService = "UserOnline/Description"; cle.ptszTooltip = tooltip; - CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); + pcli->pfnAddEvent(&cle); IcoLib_ReleaseIcon(cle.hIcon, 0); db_set_dw(cle.hContact, "UserOnline", "LastEvent", (DWORD)cle.hDbEvent); SkinPlaySound("UserOnline"); diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 267fca44d5..62c313c8b2 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -121,7 +121,7 @@ int RoomDoubleclicked(WPARAM hContact, LPARAM) // is the "toggle visibility option set, so we need to close the window? if (si->hWnd != NULL && db_get_b(NULL, CHAT_MODULE, "ToggleVisibility", 0) == 1 && - !CallService(MS_CLIST_GETEVENT, hContact, 0) && + !cli.pfnGetEvent(hContact, 0) && IsWindowVisible(si->hWnd) && !IsIconic(si->hWnd)) { if (chatApi.OnDblClickSession) @@ -220,13 +220,13 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fm cle.pszService = "GChat/DblClickEvent" ; cle.ptszTooltip = TranslateTS(szBuf); if (type) { - if (!CallService(MS_CLIST_GETEVENT, hContact, 0)) - CallService(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle); + if (!cli.pfnGetEvent(hContact, 0)) + cli.pfnAddEvent(&cle); } else { - if (CallService(MS_CLIST_GETEVENT, hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, hContact, (LPARAM)GC_FAKE_EVENT); - CallService(MS_CLIST_ADDEVENT, hContact, (LPARAM)&cle); + if (cli.pfnGetEvent(hContact, 0)) + cli.pfnRemoveEvent(hContact, GC_FAKE_EVENT); + cli.pfnAddEvent(&cle); } return TRUE; } diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 5d8e7c7dfa..2497dabec7 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -151,8 +151,8 @@ 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 (CallService(MS_CLIST_GETEVENT, (WPARAM)si->hContact, 0)) - CallService(MS_CLIST_REMOVEEVENT, (WPARAM)si->hContact, (LPARAM)GC_FAKE_EVENT); + if (cli.pfnGetEvent(si->hContact, 0)) + cli.pfnRemoveEvent(si->hContact, GC_FAKE_EVENT); if (si->hWnd && KillTimer(si->hWnd, TIMERID_FLASHWND)) FlashWindow(si->hWnd, FALSE); diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index 2d7e90aaa2..7ed8ef4485 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -376,11 +376,6 @@ static int CListEventSettingsChanged(WPARAM hContact, LPARAM lParam) /***************************************************************************************/ -INT_PTR AddEventSyncStub(WPARAM wParam, LPARAM lParam) { return CallServiceSync(MS_CLIST_ADDEVENT"_SYNC", wParam, lParam); } -INT_PTR AddEventStub(WPARAM, LPARAM lParam) { return cli.pfnAddEvent((CLISTEVENT*)lParam) == NULL; } -INT_PTR RemoveEventStub(WPARAM wParam, LPARAM lParam) { return cli.pfnRemoveEvent(wParam, lParam); } -INT_PTR GetEventStub(WPARAM wParam, LPARAM lParam) { return (INT_PTR)cli.pfnGetEvent(wParam, (int)lParam); } - int InitCListEvents(void) { memset(&cli.events, 0, sizeof(cli.events)); @@ -388,10 +383,6 @@ int InitCListEvents(void) disableTrayFlash = db_get_b(NULL, "CList", "DisableTrayFlash", 0); disableIconFlash = db_get_b(NULL, "CList", "NoIconBlink", 0); - CreateServiceFunction(MS_CLIST_ADDEVENT, AddEventSyncStub); //need to be called through sync to keep flash timer workable - CreateServiceFunction(MS_CLIST_ADDEVENT"_SYNC", AddEventStub); - CreateServiceFunction(MS_CLIST_REMOVEEVENT, RemoveEventStub); - CreateServiceFunction(MS_CLIST_GETEVENT, GetEventStub); HookEvent(ME_DB_CONTACT_DELETED, RemoveEventsForContact); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, CListEventSettingsChanged); return 0; -- cgit v1.2.3