From 109877a3c75cb290c55755dcfc88794d2453669d Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 30 Mar 2013 17:32:39 +0000 Subject: MS_DB_EVENT_* services remained, but their calls removed git-svn-id: http://svn.miranda-ng.org/main/trunk@4255 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/src/watcher.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'plugins/AutoShutdown/src/watcher.cpp') diff --git a/plugins/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 0162ca5867..10323614d6 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -91,19 +91,20 @@ static TCHAR* GetMessageText(BYTE **ppBlob,DWORD *pcbBlob) static int MsgEventAdded(WPARAM wParam,LPARAM lParam) { - if(currentWatcherType&SDWTF_MESSAGE) { - DBEVENTINFO dbe; - dbe.cbSize=sizeof(dbe); - dbe.cbBlob=(DWORD)CallService(MS_DB_EVENT_GETBLOBSIZE,(WPARAM)lParam,0); - dbe.pBlob=(BYTE*)mir_alloc(dbe.cbBlob+2); /* ensure term zero */ - if(dbe.pBlob==NULL) return 0; - if(!CallService(MS_DB_EVENT_GET,(WPARAM)lParam,(LPARAM)&dbe)) - if(dbe.eventType==EVENTTYPE_MESSAGE && !(dbe.flags&DBEF_SENT)) { + HANDLE hDbEvent = (HANDLE)lParam; + + if (currentWatcherType & SDWTF_MESSAGE) { + DBEVENTINFO dbe = { sizeof(dbe) }; + dbe.cbBlob = db_event_getBlobSize(hDbEvent); + dbe.pBlob = (BYTE*)mir_alloc(dbe.cbBlob+2); /* ensure term zero */ + if (dbe.pBlob == NULL) + return 0; + if (!db_event_get(hDbEvent, &dbe)) + if(dbe.eventType == EVENTTYPE_MESSAGE && !(dbe.flags & DBEF_SENT)) { DBVARIANT dbv; - TCHAR *pszMsg; if(!DBGetContactSettingTString(NULL,"AutoShutdown","Message",&dbv)) { TrimString(dbv.ptszVal); - pszMsg=GetMessageText(&dbe.pBlob,&dbe.cbBlob); + TCHAR *pszMsg = GetMessageText(&dbe.pBlob,&dbe.cbBlob); if(pszMsg!=NULL && _tcsstr(pszMsg,dbv.ptszVal)!=NULL) ShutdownAndStopWatcher(); /* msg with specified text recvd */ mir_free(dbv.ptszVal); /* does NULL check */ -- cgit v1.2.3