From 334f2948a725ab44b8c856242c2399f920d8ee7b Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Mon, 30 Sep 2013 19:51:19 +0000 Subject: KeyboardNotify: cleanup Jabber: Fixed error message when AdvaImg not found git-svn-id: http://svn.miranda-ng.org/main/trunk@6280 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/KeyboardNotify/src/main.cpp | 41 ++++++++++++++----------------------- protocols/JabberG/src/jabber.cpp | 4 ++-- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 5b046fceeb..ad3507975a 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -26,13 +26,6 @@ #define NCONVERS_BLINKID ((HANDLE)123456) //nconvers' random identifier used to flash an icon for "incoming message" on contact list -#ifndef WM_XBUTTONDBLCLK -#define WM_XBUTTONDBLCLK 0x020D -#endif -#ifndef WM_NCXBUTTONDBLCLK -#define WM_NCXBUTTONDBLCLK 0x00AD -#endif - HINSTANCE hInst; @@ -372,13 +365,14 @@ BOOL checkMsgTimestamp(HANDLE hEventCurrent, DWORD timestampCurrent) if (!bFlashIfMsgOlder) return TRUE; - DBEVENTINFO einfo = { sizeof(einfo) }; for (HANDLE hEvent = db_event_prev(hEventCurrent); hEvent; hEvent = db_event_prev(hEvent)) { - db_event_get(hEvent, &einfo); - if ((einfo.timestamp + wSecondsOlder) <= timestampCurrent) - return TRUE; - if (einfo.eventType == EVENTTYPE_MESSAGE) - return FALSE; + DBEVENTINFO einfo = { sizeof(einfo) }; + if(!db_event_get(hEvent, &einfo)) { + if ((einfo.timestamp + wSecondsOlder) <= timestampCurrent) + return TRUE; + if (einfo.eventType == EVENTTYPE_MESSAGE) + return FALSE; + } } return TRUE; @@ -409,7 +403,6 @@ BOOL checkStatus(char *szProto) BOOL checkXstatus(char *szProto) { int status=0; - CUSTOM_STATUS xstatus = { sizeof(CUSTOM_STATUS) }; if (!szProto) return checkGlobalXstatus(); @@ -419,6 +412,7 @@ BOOL checkXstatus(char *szProto) if (!ProtoList.protoInfo[i].xstatus.count) return TRUE; // Retrieve xstatus for protocol + CUSTOM_STATUS xstatus = { sizeof(CUSTOM_STATUS) }; xstatus.flags = CSSF_MASK_STATUS; xstatus.status = &status; CallProtoService(ProtoList.protoInfo[i].szProto, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus); @@ -438,8 +432,7 @@ static int PluginMessageEventHook(WPARAM wParam, LPARAM lParam) //get DBEVENTINFO without pBlob DBEVENTINFO einfo = { sizeof(einfo) }; - db_event_get(hEvent, &einfo); - if (!(einfo.flags & DBEF_SENT)) + if (!db_event_get(hEvent, &einfo) && !(einfo.flags & DBEF_SENT)) if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg && checkOpenWindow(hContact) && checkMsgTimestamp(hEvent, einfo.timestamp)) || (einfo.eventType == EVENTTYPE_URL && bFlashOnURL) || (einfo.eventType == EVENTTYPE_FILE && bFlashOnFile) || @@ -468,9 +461,8 @@ static VOID CALLBACK ReminderTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DW return; } - DBEVENTINFO einfo = { sizeof(einfo) }; for (nIndex = 0; !bReminderDisabled && (pCLEvent = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, -1, nIndex)); nIndex++) { - einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); + DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg) || (einfo.eventType == EVENTTYPE_URL && bFlashOnURL) || @@ -589,12 +581,10 @@ void createProcessList(void) void destroyProcessList(void) { - unsigned int i, count; - - count = ProcessList.count; + unsigned int count = ProcessList.count; ProcessList.count = 0; - for (i=0; i < count; i++) + for (unsigned int i=0; i < count; i++) if (ProcessList.szFileName[i]) free(ProcessList.szFileName[i]); @@ -673,9 +663,9 @@ void LoadSettings(void) void GetWindowsVersion(void) { OSVERSIONINFOEX osvi = { sizeof(OSVERSIONINFOEX) }; - BOOL bOsVersionInfoEx; + BOOL bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi); - if (!(bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *) &osvi))) { + if (!bOsVersionInfoEx) { osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (!GetVersionEx((OSVERSIONINFO *)&osvi)) osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS; @@ -1022,10 +1012,9 @@ void countUnopenEvents(int *msgCount, int *fileCount, int *urlCount, int *otherC { int nIndex; CLISTEVENT *pCLEvent; - DBEVENTINFO einfo = { sizeof(einfo) }; for (nIndex = 0; pCLEvent = (CLISTEVENT*)CallService(MS_CLIST_GETEVENT, -1, nIndex); nIndex++) { - einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); + DBEVENTINFO einfo = readEventInfo(pCLEvent->hDbEvent, pCLEvent->hContact); if (metaCheckProtocol(einfo.szModule, pCLEvent->hContact, einfo.eventType)) switch (einfo.eventType) { diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp index c040ff5f3a..f329037b06 100644 --- a/protocols/JabberG/src/jabber.cpp +++ b/protocols/JabberG/src/jabber.cpp @@ -187,10 +187,10 @@ extern "C" int __declspec(dllexport) Load() mir_getLP(&pluginInfo); mir_getCLI(); - if (ServiceExists(MS_IMG_GETINTERFACE)) { + { INT_PTR result = CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&FIP); if (FIP == NULL || result != S_OK) { - MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Flags Module will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); + MessageBoxEx(NULL, TranslateT("Fatal error, image services not found. Jabber Protocol will be disabled."), _T("Error"), MB_OK | MB_ICONERROR | MB_APPLMODAL, 0); return 1; } } -- cgit v1.2.3