diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2013-01-04 13:51:04 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2013-01-04 13:51:04 +0000 |
commit | 0bc7bd1b53ff6ca8cc32787fe7a4f16f6b0e1813 (patch) | |
tree | ead91c643f80da75a3b7d7f4fb56faefd55bfd60 /plugins/New_GPG/src/utilities.cpp | |
parent | 88a7618d8c5de816ae07fb26ed67130793039485 (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/New_GPG/src/utilities.cpp')
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 84 |
1 files changed, 81 insertions, 3 deletions
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);
+}
|