From 6b1b91acffcc90db9f6d8e0c466d44e2a6819dc3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 9 Sep 2010 22:56:44 +0300 Subject: modified: init.cpp modified: messages.cpp modified: new_gpg.rc modified: options.cpp modified: utilities.cpp --- init.cpp | 2 +- messages.cpp | 12 +++++++----- new_gpg.rc | 4 ++-- options.cpp | 8 +++++++- utilities.cpp | 27 ++++++++++++++++++++++++++- 5 files changed, 43 insertions(+), 10 deletions(-) diff --git a/init.cpp b/init.cpp index be462da..d12472c 100644 --- a/init.cpp +++ b/init.cpp @@ -39,7 +39,7 @@ logtofile debuglog; PLUGININFOEX pluginInfo={ sizeof(PLUGININFOEX), 0, - PLUGIN_MAKE_VERSION(0,0,0,5), + PLUGIN_MAKE_VERSION(0,0,0,6), "new GPG encryption support plugin, used code from http://addons.miranda-im.org/details.php?action=viewfile&id=3485", "sss", "sss123next@list.ru", diff --git a/messages.cpp b/messages.cpp index 18db824..9dfe9d7 100644 --- a/messages.cpp +++ b/messages.cpp @@ -316,14 +316,15 @@ int RecvMsgSvc(WPARAM w, LPARAM l) delete [] tmp; str.append(tmp2); mir_free(tmp2); + f.close(); + DeleteFile(path.c_str()); } - f.close(); - DeleteFile(path.c_str()); if(str.empty()) { string str = pre->szMessage; mir_free((void**)pre->szMessage); str.insert(0, "Failed to decrypt GPG encrypted message:\n"); + debuglog<<"info: Failed to decrypt GPG encrypted message.\n"; pre->szMessage = mir_strdup(str.c_str()); return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } @@ -473,12 +474,13 @@ int SendMsgSvc(WPARAM w, LPARAM l) tmp[size]= '\0'; str.append(tmp); delete [] tmp; + f.close(); + DeleteFile(path.c_str()); } - f.close(); - DeleteFile(path.c_str()); - if(!str.length()) + if(str.empty()) { HistoryLog(hContact, "Failed to encrypt message with GPG", EVENTTYPE_MESSAGE, DBEF_SENT); + debuglog<<"info: Failed to encrypt message with GPG"; return CallService(MS_PROTO_CHAINRECV, w, (LPARAM)ccs); } // mir_free((void**)ccs->lParam); diff --git a/new_gpg.rc b/new_gpg.rc index 9e6e23f..290c690 100644 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -241,7 +241,7 @@ IDI_UNSECURED ICON "icons\\unsecured.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,0,5 + FILEVERSION 0,0,0,6 PRODUCTVERSION 0,8,0,1 FILEFLAGSMASK 0x17L #ifdef _DEBUG @@ -258,7 +258,7 @@ BEGIN BLOCK "041904b0" BEGIN VALUE "FileDescription", "new_gpg" - VALUE "FileVersion", "0, 0, 0, 5" + VALUE "FileVersion", "0, 0, 0, 6" VALUE "InternalName", "new_gpg" VALUE "LegalCopyright", "Copyright (C) 2010 sss" VALUE "OriginalFilename", "new_gpg" diff --git a/options.cpp b/options.cpp index c615cb8..9c1dce4 100644 --- a/options.cpp +++ b/options.cpp @@ -1048,8 +1048,14 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP tmp[size]= '\0'; key_buf.append(tmp); delete [] tmp; + f.close(); + } + if(key_buf.empty()) + { + key_buf.clear(); + debuglog<<"info: Failed to read key file\n"; + break; } - f.close(); if(((ws2 = key_buf.find(_T("-----END PGP PUBLIC KEY BLOCK-----"))) == wstring::npos) || ((ws1 = key_buf.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"))) == wstring::npos)) { MessageBox(0, _T("This is not public key"), _T("INFO"), MB_OK); diff --git a/utilities.cpp b/utilities.cpp index c78bc4a..9c07b89 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -409,6 +409,14 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU f<