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/src/LotusNotify.cpp | 20 +++++++++++++++++--- plugins/LotusNotify/src/resource.h | 4 ++-- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'plugins/LotusNotify/src') 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