From a26b87e766d8f93dfc3f3e37a92c812305fb8f83 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 12 May 2015 13:33:04 +0000 Subject: patch to keep Lotus connection online git-svn-id: http://svn.miranda-ng.org/main/trunk@13561 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/LotusNotify/res/LotusNotify.rc | 5 ++++- plugins/LotusNotify/src/LotusNotify.cpp | 20 +++++++++++++++++--- plugins/LotusNotify/src/resource.h | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/plugins/LotusNotify/res/LotusNotify.rc b/plugins/LotusNotify/res/LotusNotify.rc index 2f964786c6..8428d9f888 100644 --- a/plugins/LotusNotify/res/LotusNotify.rc +++ b/plugins/LotusNotify/res/LotusNotify.rc @@ -102,7 +102,7 @@ BEGIN PUSHBUTTON "try detect",IDC_BUTTON_DETECT,191,14,51,36,BS_MULTILINE LTEXT "Secondary server:",IDC_STATIC,10,29,65,9 GROUPBOX "Check interval:",IDC_STATIC,246,7,61,57 - LTEXT "(0-disabled)",IDC_STATIC,250,34,56,8 + LTEXT "(0-disabled)",IDC_STATIC,250,31,56,8 LTEXT "min.",IDC_STATIC,273,19,19,8 EDITTEXT IDC_PASSWORD,75,50,115,11,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,10,51,65,9 @@ -118,6 +118,9 @@ BEGIN PUSHBUTTON "-",IDC_BUTTON_REMOVE_TO_FILTER,185,184,16,11,BS_CENTER CONTROL "autoregister",IDC_BUTTON_CHECK,"Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,191,50,51,12 + CONTROL "Keep connection on error",IDC_KEEP_CONNEXION_ON_ERROR, + "Button",BS_AUTOCHECKBOX | BS_PUSHLIKE | BS_MULTILINE | + WS_TABSTOP,248,42,57,20 END diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 7c0b9f5e69..ffd8258266 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -15,6 +15,7 @@ There is no warranty. #include "lotusnotes.h" #include "LotusNotify.h" +INT_PTR SetStatus(WPARAM wParam, LPARAM lParam); #define MAX_FIELD 256 #define MAX_SETTING_STR 512 @@ -65,6 +66,7 @@ BYTE settingNonClickedOnly = 0; BYTE settingNewest = 0; BOOL settingStatus[STATUS_COUNT]; BOOL bMirandaCall=FALSE; +BYTE settingKeepConnection = 1; struct HISTORIA *first = NULL; BOOL running = FALSE; @@ -702,6 +704,10 @@ void checkthread(void*) log(L"checkthread: skiped-only newest option enabled, so if old id don't show it"); + // remember newest id + if(settingNewest&&(noteID > settingNewestID) ) + db_set_dw(NULL, PLUGINNAME, "LNNewestID", settingNewestID=noteID); + //if(((!settingOnceOnly||(settingOnceOnly&&settingNonClickedOnly))&&existElem(noteID))||(settingNewest&&settingNewestID>=noteID)) //continue; @@ -841,9 +847,13 @@ errorblock: log_p(L"checkthread: errorblock. error=%d", error); ErMsgByLotusCode(error); //NotesTerm(); - //if(currentStatus!=ID_STATUS_OFFLINE) - //LNEnableMenuItem(hMenuHandle,!running); - //SetStatus(ID_STATUS_OFFLINE,0); + + // go offline if connection error occurs and let KeepStatus or other plugin managing reconnection + if(!settingKeepConnection && currentStatus!=ID_STATUS_OFFLINE) { + LNEnableMenuItem(hMenuHandle,!running); + SetStatus(ID_STATUS_OFFLINE,0); + } + running = FALSE; return; } @@ -960,6 +970,7 @@ void LoadSettings() { settingInterval = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval", 15); settingInterval1 = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval1", 0); + settingKeepConnection = db_get_b(NULL, PLUGINNAME, "LNKeepConnection", 1); DBVARIANT dbv; if(!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)){ @@ -1040,6 +1051,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword); SetDlgItemInt(hwndDlg, IDC_INTERVAL, settingInterval,FALSE); SetDlgItemInt(hwndDlg, IDC_INTERVAL1, settingInterval1,TRUE); + CheckDlgButton(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR, settingKeepConnection ? BST_CHECKED : BST_UNCHECKED); SetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand); SetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters); CheckDlgButton(hwndDlg, IDC_ONCEONLY, settingOnceOnly ? BST_CHECKED : BST_UNCHECKED); @@ -1161,6 +1173,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_INTERVAL: settingInterval =GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break; case IDC_INTERVAL1: settingInterval1 =GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break; + case IDC_KEEP_CONNEXION_ON_ERROR: settingKeepConnection=(BYTE) IsDlgButtonChecked(hwndDlg, IDC_KEEP_CONNEXION_ON_ERROR); break; case IDC_COMMAND: GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, SIZEOF(settingCommand)); break; case IDC_PARAMETERS: GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, SIZEOF(settingParameters)); break; case IDC_ONCEONLY: @@ -1267,6 +1280,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_s(NULL, PLUGINNAME, "LNDatabase", settingDatabase); db_set_dw (NULL, PLUGINNAME, "LNInterval", settingInterval); db_set_dw (NULL, PLUGINNAME, "LNInterval1", settingInterval1); + db_set_b(NULL, PLUGINNAME, "LNKeepConnection", settingKeepConnection); db_set_s(NULL, PLUGINNAME, "LNCommand", settingCommand ); db_set_s(NULL, PLUGINNAME, "LNParameters", settingParameters); db_set_b(NULL, PLUGINNAME, "LNOnceOnly", settingOnceOnly); diff --git a/plugins/LotusNotify/src/resource.h b/plugins/LotusNotify/src/resource.h index d6277ef73a..9d9c06a073 100644 --- a/plugins/LotusNotify/src/resource.h +++ b/plugins/LotusNotify/src/resource.h @@ -34,11 +34,11 @@ #define IDC_BUTTON_REMOVE_SENDER_FILTER 1024 #define IDC_BUTTON_REMOVE_SUBJECT_FILTER 1025 #define IDC_PASSWORD 1026 -#define IDC_CHECK1 1027 #define IDC_BUTTON_CHECK 1027 #define IDC_FILTER_TO 1028 #define IDC_BUTTON_ADD_TO_FILTER 1029 #define IDC_BUTTON_REMOVE_TO_FILTER 1030 +#define IDC_KEEP_CONNEXION_ON_ERROR 1031 // Next default values for new objects // @@ -46,7 +46,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 104 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1028 +#define _APS_NEXT_CONTROL_VALUE 1032 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3