summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorAlexander Gluzsky <sss123next@list.ru>2013-01-04 13:51:04 +0000
committerAlexander Gluzsky <sss123next@list.ru>2013-01-04 13:51:04 +0000
commit0bc7bd1b53ff6ca8cc32787fe7a4f16f6b0e1813 (patch)
treeead91c643f80da75a3b7d7f4fb56faefd55bfd60 /plugins
parent88a7618d8c5de816ae07fb26ed67130793039485 (diff)
additional options for filetransfers
git-svn-id: http://svn.miranda-ng.org/main/trunk@2959 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/New_GPG/res/new_gpg.rc29
-rwxr-xr-xplugins/New_GPG/src/globals.h2
-rwxr-xr-xplugins/New_GPG/src/init.cpp3
-rwxr-xr-xplugins/New_GPG/src/options.cpp6
-rwxr-xr-xplugins/New_GPG/src/resource.h7
-rwxr-xr-xplugins/New_GPG/src/utilities.cpp84
6 files changed, 120 insertions, 11 deletions
diff --git a/plugins/New_GPG/res/new_gpg.rc b/plugins/New_GPG/res/new_gpg.rc
index 286665f363..bc2c71c3a7 100755
--- a/plugins/New_GPG/res/new_gpg.rc
+++ b/plugins/New_GPG/res/new_gpg.rc
@@ -1,6 +1,6 @@
// Microsoft Visual C++ generated resource script.
//
-#include "..\src\resource.h"
+#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
@@ -13,7 +13,7 @@
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
-// Russian (Russia) resources
+// Русский (Россия) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
@@ -172,6 +172,17 @@ BEGIN
COMBOBOX IDC_KEYSERVER,15,34,125,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
+IDD_ENCRYPTED_FILE_MSG_BOX DIALOGEX 0, 0, 229, 63
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Recieved encrypted file"
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+ PUSHBUTTON "Ignore",IDC_IGNORE,7,42,50,14
+ PUSHBUTTON "Decrypt",IDC_DECRYPT,97,42,50,14
+ LTEXT "Recieved encrypted file form contact whith disabled encryption.",IDC_STATIC,7,7,215,14
+ CONTROL "Remember choice",IDC_REMEMBER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,22,157,10
+END
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -247,6 +258,14 @@ BEGIN
TOPMARGIN, 7
BOTTOMMARGIN, 74
END
+
+ IDD_ENCRYPTED_FILE_MSG_BOX, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 222
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 56
+ END
END
#endif // APSTUDIO_INVOKED
@@ -298,12 +317,12 @@ BEGIN
END
END
-#endif // Russian (Russia) resources
+#endif // Русский (Россия) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
+// Английский (США) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
@@ -402,7 +421,7 @@ BEGIN
END
#endif // APSTUDIO_INVOKED
-#endif // English (United States) resources
+#endif // Английский (США) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/New_GPG/src/globals.h b/plugins/New_GPG/src/globals.h
index e84ae1e505..4e561d8358 100755
--- a/plugins/New_GPG/src/globals.h
+++ b/plugins/New_GPG/src/globals.h
@@ -16,7 +16,7 @@
#ifndef GLOBALS_H
#define GLOBALS_H
-extern bool bAppendTags, bPresenceSigning, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used;
+extern bool bAppendTags, bPresenceSigning, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used, bSameAction, bFileTransfers;
extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag;
extern logtofile debuglog;
#endif
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index af433e0d79..1caaa9c0e1 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -17,7 +17,7 @@
#include "commonheaders.h"
//global variables
-bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
+bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false;
TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL;
list <JabberAccount*> Accounts;
@@ -82,6 +82,7 @@ void init_vars()
outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("</GPGenc>"));
bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0);
bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0);
+ bSameAction = DBGetContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T(""));
debuglog.init();
bIsMiranda09 = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0) >= 0x00090001?true:false;
diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp
index 8b9f32d58c..1030595e00 100755
--- a/plugins/New_GPG/src/options.cpp
+++ b/plugins/New_GPG/src/options.cpp
@@ -463,7 +463,13 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if(bDebugLog)
debuglog.init();
bJabberAPI = CheckStateStoreDB(hwndDlg, IDC_JABBER_API, "bJabberAPI");
+ bool old_bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0);
bFileTransfers = CheckStateStoreDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers");
+ if(bFileTransfers != old_bFileTransfers)
+ {
+ DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ bSameAction = false;
+ }
bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange");
{
TCHAR tmp[512];
diff --git a/plugins/New_GPG/src/resource.h b/plugins/New_GPG/src/resource.h
index 027e27965c..1135dbd3ea 100755
--- a/plugins/New_GPG/src/resource.h
+++ b/plugins/New_GPG/src/resource.h
@@ -16,6 +16,7 @@
#define IDD_IMPORT_KEY 112
#define IDI_UNSECURED 113
#define IDD_OPT_GPG_ADVANCED 113
+#define IDD_ENCRYPTED_FILE_MSG_BOX 114
#define IDC_SET_BIN_PATH 1016
#define IDC_SET_HOME_DIR 1017
#define IDC_BIN_PATH 1018
@@ -38,6 +39,7 @@
#define IDC_IGNORE_KEY 1026
#define IDC_SELECT_EXISTING 1026
#define IDC_KEY_EMAIL 1026
+#define IDC_IGNORE 1026
#define IDC_DELETE_KEY_BUTTON 1027
#define IDC_IN_CLOSE_TAG 1027
#define IDC_KEY_REAL_NAME 1027
@@ -58,6 +60,7 @@
#define IDC_OTHER 1046
#define IDC_LOG_FILE_SET 1046
#define IDC_IMPORT 1046
+#define IDC_DECRYPT 1046
#define IDC_SAVE_PASSWORD 1047
#define IDC_DEBUG_LOG 1048
#define IDC_JABBER_API 1049
@@ -78,6 +81,8 @@
#define IDC_STRIP_TAGS 1067
#define IDC_CHECK1 1068
#define IDC_PRESCENSE_SUBSCRIPTION 1068
+#define IDC_REMEMBRE 1068
+#define IDC_REMEMBER 1068
#define IDC_GENERATING_KEY 1069
#define IDC_GENERATING_TEXT 1070
#define IDC_KEY_ID 1071
@@ -88,7 +93,7 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 114
+#define _APS_NEXT_RESOURCE_VALUE 115
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1073
#define _APS_NEXT_SYMED_VALUE 101
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp
index ec737b7c10..adb50e4c2d 100755
--- a/plugins/New_GPG/src/utilities.cpp
+++ b/plugins/New_GPG/src/utilities.cpp
@@ -279,14 +279,15 @@ int OnPreBuildContactMenu(WPARAM w, LPARAM l)
list<wstring> transfers;
-extern bool bFileTransfers;
+
+DWORD file_msg_state = -1;
int onProtoAck(WPARAM w, LPARAM l)
{
ACKDATA *ack=(ACKDATA*)l;
CCSDATA *ccs=(CCSDATA*)ack->lParam;
- if(ack->type == ACKTYPE_FILE && bFileTransfers)
+ if(ack->type == ACKTYPE_FILE)
{
switch(ack->result)
{
@@ -314,6 +315,15 @@ int onProtoAck(WPARAM w, LPARAM l)
}
if(_tcsstr(filename, _T(".gpg"))) //decrypt it
{ //process encrypted file
+ if(!bFileTransfers && !bSameAction)
+ {
+ void ShowEncryptedFileMsgBox();
+ ShowEncryptedFileMsgBox();
+ }
+ if(!bFileTransfers && bSameAction)
+ return 0;
+ if(file_msg_state < 1)
+ return 0;
HistoryLog(ack->hContact, db_event("Recieved encrypted file, trying to decrypt", 0,0, 0));
if(_waccess(f->tszCurrentFile, 0) == -1)
{
@@ -1916,4 +1926,72 @@ void strip_tags(std::wstring &str)
for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag))
str.erase(p, _tcslen(outclosetag));
}
-} \ No newline at end of file
+}
+
+
+static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ char *inkeyid = NULL;
+ switch (msg)
+ {
+ case WM_INITDIALOG:
+ {
+ TranslateDialogDefault(hwndDlg);
+ file_msg_state = -1;
+ return TRUE;
+ }
+
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_IGNORE:
+ if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
+ {
+ DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 1);
+ bSameAction = true;
+ }
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDC_DECRYPT:
+ file_msg_state = 1;
+ if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER))
+ {
+ DBWriteContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1);
+ bFileTransfers = true;
+ DBWriteContactSettingByte(NULL, szGPGModuleName, "bSameAction", 0);
+ bSameAction = false;
+ }
+
+ DestroyWindow(hwndDlg);
+ break;
+
+ default:
+ break;
+ }
+
+ break;
+ }
+
+ case WM_NOTIFY:
+ {
+ }
+ break;
+ case WM_CLOSE:
+ DestroyWindow(hwndDlg);
+ break;
+ case WM_DESTROY:
+ {
+ }
+ break;
+ }
+ return FALSE;
+}
+
+void ShowEncryptedFileMsgBox()
+{
+ extern HINSTANCE hInst;
+ DialogBox(hInst, MAKEINTRESOURCE(IDD_ENCRYPTED_FILE_MSG_BOX), NULL, DlgProcEncryptedFileMsgBox);
+}