From 1dbcb0630d8e5c61d528f0f6fb5dfcb3395615c2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Apr 2011 20:23:04 +0300 Subject: modified: main.cpp modified: messages.cpp --- main.cpp | 10 ++++++---- messages.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 7fdf27c..e75ec4d 100644 --- a/main.cpp +++ b/main.cpp @@ -989,14 +989,15 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); + HANDLE hContact = INVALID_HANDLE_VALUE; void ImportKey(); TCHAR *tmp = NULL; switch (msg) { case WM_INITDIALOG: { + hContact = new_key_hcnt; + new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); @@ -1622,12 +1623,13 @@ static BOOL CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); + HANDLE hContact = INVALID_HANDLE_VALUE; switch (msg) { case WM_INITDIALOG: { + hContact = new_key_hcnt; + new_key_hcnt_mutex.unlock(); SetWindowPos(hwndDlg, 0 , import_key_rect.left, import_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0); diff --git a/messages.cpp b/messages.cpp index 4b4a686..3c481f8 100644 --- a/messages.cpp +++ b/messages.cpp @@ -890,14 +890,15 @@ int HookSendMsg(WPARAM w, LPARAM l) static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); - new_key_hcnt_mutex.unlock(); - TCHAR *tmp = NULL; - + char *inkeyid = NULL; switch (msg) { case WM_INITDIALOG: { + char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); + new_key_hcnt_mutex.unlock(); + TCHAR *tmp = NULL; + SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); string questionstr = "Please enter password for key with ID: "; -- cgit v1.2.3 From cbfa2b64cdcfe881dd60d308b776b3c1792b79b1 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 29 Apr 2011 20:26:53 +0300 Subject: modified: messages.cpp --- messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages.cpp b/messages.cpp index 3c481f8..384f44b 100644 --- a/messages.cpp +++ b/messages.cpp @@ -895,7 +895,7 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L { case WM_INITDIALOG: { - char *inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); + inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); new_key_hcnt_mutex.unlock(); TCHAR *tmp = NULL; -- cgit v1.2.3 From 93ab5d7b53a3b4d5336aee2f3995b44aaad51b69 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 5 Jun 2011 09:37:18 +0300 Subject: modified: new_gpg.rc modified: options.cpp --- new_gpg.rc | 6 +++++- options.cpp | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/new_gpg.rc b/new_gpg.rc index 0d8f569..bd99e79 100644 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -57,7 +57,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "ÎÊ",ID_OK,7,169,50,14 PUSHBUTTON "Load from file",ID_LOAD_FROM_FILE,273,169,58,14 - EDITTEXT IDC_PUBLIC_KEY_EDIT,7,7,324,134,ES_MULTILINE | WS_VSCROLL,WS_EX_STATICEDGE + EDITTEXT IDC_PUBLIC_KEY_EDIT,7,7,324,134,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | WS_VSCROLL,WS_EX_STATICEDGE PUSHBUTTON "Select existing",IDC_SELECT_EXISTING,113,169,97,14 CONTROL "Turn on encryption",IDC_ENABLE_ENCRYPTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,143,196,10 PUSHBUTTON "Import key from keyserver",IDC_IMPORT,140,152,188,14,WS_DISABLED @@ -373,6 +373,10 @@ BEGIN IDD_OPT_GPG_BIN, DIALOG BEGIN END + + IDD_OPT_GPG_MESSAGES, DIALOG + BEGIN + END END #endif // APSTUDIO_INVOKED diff --git a/options.cpp b/options.cpp index 7eafe97..5bf050f 100644 --- a/options.cpp +++ b/options.cpp @@ -668,6 +668,8 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateW(_T("Turn on encryption"))); CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); } + RegisterHotKey(hwndDlg, 1, MOD_CONTROL | MOD_NOREPEAT, 0x43); + RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); if(hcnt) { tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); @@ -1240,6 +1242,21 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP } } break; + case WM_HOTKEY: + { + if(lParam & MOD_CONTROL) + { + if(wParam == 1) + { + MessageBoxA(NULL, "ctrl+c", "", MB_OK); + } + else if(wParam == 2) + { + MessageBoxA(NULL, "ctrl+a", "", MB_OK); + } + } + } + break; case WM_CLOSE: DestroyWindow(hwndDlg); break; -- cgit v1.2.3 From dfa458be4ac91bed6639d3fd0c3bf3902bdd8c0b Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 5 Jun 2011 13:10:43 +0300 Subject: modified: commonheaders.h modified: options.cpp --- commonheaders.h | 1 + options.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/commonheaders.h b/commonheaders.h index 1b7d8f1..f2416a8 100644 --- a/commonheaders.h +++ b/commonheaders.h @@ -22,6 +22,7 @@ #include #include #include +#include //c #include #include diff --git a/options.cpp b/options.cpp index 5bf050f..fe1c2c3 100644 --- a/options.cpp +++ b/options.cpp @@ -668,7 +668,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateW(_T("Turn on encryption"))); CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); } - RegisterHotKey(hwndDlg, 1, MOD_CONTROL | MOD_NOREPEAT, 0x43); +// RegisterHotKey(hwndDlg, 1, MOD_CONTROL | MOD_NOREPEAT, 0x43); //ctrl+c RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); if(hcnt) { @@ -1248,11 +1248,13 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP { if(wParam == 1) { - MessageBoxA(NULL, "ctrl+c", "", MB_OK); +// TCHAR sel[2048] = {0}; +// int c = SendMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_GETSELTEXT, 0, (LPARAM)&sel); +// MessageBoxA(NULL, "ctrl+c", "", MB_OK); } else if(wParam == 2) { - MessageBoxA(NULL, "ctrl+a", "", MB_OK); + SendMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); } } } -- cgit v1.2.3 From 9e5682f4955097bd090df3449a9f15b69a71bc84 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 5 Jul 2011 18:57:09 +0300 Subject: modified: Makefile modified: commonheaders.h --- Makefile | 9 +++++---- commonheaders.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ac67072..edb9668 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,14 @@ -CFLAGS=-g -mdll -mwindows -I../miranda-im/miranda/include/ -I./ -D DEBUG -D _UNICODE -D UNICODE +CFLAGS=-g -mdll -mwindows -I../miranda-im/miranda/include/ -I./ -I/home/sss/temp/windows/libs/utf8cpp/include -D DEBUG -D _UNICODE -D UNICODE CXXFLAGS=${CFLAGS} -LDFLAGS=-static-libgcc -Wl,-O1 -shared +LDFLAGS=-static-libgcc -Wl,-O1 -shared -s -Wl,--subsystem,windows,--kill-at CPPFLAGS = CC=i686-pc-mingw32-gcc CXX=i686-pc-mingw32-g++ STRIP=i686-pc-mingw32-strip LD=i686-pc-mingw32-ld -LNK_COMMON=-lkernel32 -lgpgme -lgcrypt -lgpg-error -lksba -lassuan -MAINOBJS=init.o utilities.o main.o options.o +LNK_COMMON=-lkernel32 + +MAINOBJS=init.o utilities.o main.o options.o clist.cpp clist.o srmm.o metacontacts.o messages.o log.o jabber_account.o icons.o gpg_wrapper.o WINDRES=i686-pc-mingw32-windres all: main diff --git a/commonheaders.h b/commonheaders.h index f2416a8..f881b9c 100644 --- a/commonheaders.h +++ b/commonheaders.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include //c #include #include -- cgit v1.2.3 From 090d8764c130f272b1a67f2eaeea1e0a9ddfe1cb Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 9 Jul 2011 15:48:12 +0300 Subject: modified: new_gpg.vcxproj --- new_gpg.vcxproj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj index 3a81c15..ee7f0aa 100644 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -477,15 +477,14 @@ Disabled - e:\temp\windows\libs\utf8cpp\include;e:\temp\windows\libs\Boost\include\boost-1_46;e:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + e:\temp\windows\libs\utf8cpp\include;E:\temp\windows\libs\Boost\include;e:\install\git\miranda\miranda-im\miranda\include;e:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug Use commonheaders.h c:\temp\new_gpg.pch - - + All .\Debug/ .\Debug/ .\Debug/ @@ -493,6 +492,10 @@ Level3 true ProgramDatabase + true + true + CompileAsCpp + true _DEBUG;%(PreprocessorDefinitions) @@ -504,12 +507,13 @@ e:\temp\windows\libs\Boost\lib-debug;%(AdditionalLibraryDirectories) true true - false + true false false .\Debug/testplug.lib + c:\debug\$(TargetName).pdb true -- cgit v1.2.3 From 7b4388cfbe8d7aa873e8aa6d3717ca301eeb59a3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 16:44:03 +0300 Subject: fixed end of line (will cause problems on non text data) --- messages.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 messages.cpp diff --git a/messages.cpp b/messages.cpp old mode 100644 new mode 100755 index 384f44b..2d48052 --- a/messages.cpp +++ b/messages.cpp @@ -593,6 +593,8 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) str.append(tmp); mir_free(tmp); } +/* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) + str.replace(i, 2, _T("\n")); */ string out; DWORD code; wstring cmd; @@ -612,7 +614,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) cmd += _T("--comment \"\" --no-version "); if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0)) cmd += _T("--trust-model always "); - cmd += _T("--batch --yes -e -a -r "); + cmd += _T("--batch --yes -e -a -t -r "); TCHAR *tmp2 = mir_a2t(tmp); mir_free(tmp); cmd += tmp2; -- cgit v1.2.3 From 823800856ab18c23357e108bb9d923cee497ea03 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:12:04 +0300 Subject: modified: messages.cpp modified: new_gpg.vcxproj modified: utilities.cpp --- messages.cpp | 6 +- new_gpg.vcxproj | 10 +-- utilities.cpp | 264 +++++++++++++++++++++++++++++--------------------------- 3 files changed, 148 insertions(+), 132 deletions(-) mode change 100644 => 100755 new_gpg.vcxproj mode change 100644 => 100755 utilities.cpp diff --git a/messages.cpp b/messages.cpp index 2d48052..44172df 100755 --- a/messages.cpp +++ b/messages.cpp @@ -23,6 +23,8 @@ boost::mutex new_key_hcnt_mutex; bool _terminate = false; int returnNoError(HANDLE hContact); +std::list sent_msgs; + int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp) { DWORD dbflags = DBEF_UTF; @@ -608,7 +610,9 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event("Failed to encrypt message with GPG", 0,0, DBEF_SENT)); hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG"); mir_free(msg); - return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + HANDLE h = (HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); + sent_msgs.push_back(h); + return (int)h; } if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself cmd += _T("--comment \"\" --no-version "); diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj old mode 100644 new mode 100755 index ee7f0aa..44dc517 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -477,7 +477,7 @@ Disabled - e:\temp\windows\libs\utf8cpp\include;E:\temp\windows\libs\Boost\include;e:\install\git\miranda\miranda-im\miranda\include;e:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;x:\temp\windows\libs\Boost\include;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -502,9 +502,9 @@ 0x0809 - shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_47.lib + shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_48.lib true - e:\temp\windows\libs\Boost\lib-debug;%(AdditionalLibraryDirectories) + x:\temp\windows\libs\Boost\lib;%(AdditionalLibraryDirectories) true true true @@ -689,7 +689,7 @@ Size true true - e:\temp\windows\libs\utf8cpp\include;e:\temp\windows\libs\Boost\include\boost-1_46;e:\install\git\miranda\miranda-im\miranda\include;e:\install\git\miranda\mim_plugs;../../include + x:\temp\windows\libs\utf8cpp\include;X:\temp\windows\libs\Boost\include;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE;%(PreprocessorDefinitions) true MultiThreaded @@ -712,7 +712,7 @@ shlwapi.lib;%(AdditionalDependencies) true - e:\temp\windows\libs\Boost\lib-release;%(AdditionalLibraryDirectories) + X:\temp\windows\libs\Boost\lib;%(AdditionalLibraryDirectories) false NotSet true diff --git a/utilities.cpp b/utilities.cpp old mode 100644 new mode 100755 index dbf8786..b7498e5 --- a/utilities.cpp +++ b/utilities.cpp @@ -282,164 +282,176 @@ int onProtoAck(WPARAM w, LPARAM l) if (ack->type!=ACKTYPE_FILE) return 0; - switch(ack->result) + if(ack->type == ACKTYPE_FILE) { - case ACKRESULT_DENIED: case ACKRESULT_FAILED: - break; - case ACKRESULT_SUCCESS: + switch(ack->result) { - PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*) ack->hProcess; - TCHAR *filename = NULL; - if(f->flags & PFTS_UNICODE) - { - if(f->tszCurrentFile && f->tszCurrentFile[0]) - filename = mir_wstrdup(f->tszCurrentFile); - if(!filename) - return 0; - } - else + case ACKRESULT_DENIED: case ACKRESULT_FAILED: + break; + case ACKRESULT_SUCCESS: { - if(f->szCurrentFile && f->szCurrentFile[0]) - filename = mir_utf8decodeT(f->szCurrentFile); - if(!filename) - return 0; - } - if(_tcsstr(filename, _T(".gpg"))) //decrypt it - { //process encrypted file - if(_waccess(f->tszCurrentFile, 0) == -1) + PROTOFILETRANSFERSTATUS *f = (PROTOFILETRANSFERSTATUS*) ack->hProcess; + TCHAR *filename = NULL; + if(f->flags & PFTS_UNICODE) { - if(errno == ENOENT) + if(f->tszCurrentFile && f->tszCurrentFile[0]) + filename = mir_wstrdup(f->tszCurrentFile); + if(!filename) return 0; } - string out; - DWORD code; - pxResult result; - wstring cmd = _T("-o "); - wstring file = filename; - wstring::size_type p1 = file.rfind(_T(".gpg")); - file.erase(p1, _tcslen(_T(".gpg"))); - if(_waccess(file.c_str(), 0) != -1) + else { - if(MessageBox(0, _T("Target file exists, do you want to replace it ?"), _T("Warning"), MB_YESNO) == IDNO) + if(f->szCurrentFile && f->szCurrentFile[0]) + filename = mir_utf8decodeT(f->szCurrentFile); + if(!filename) return 0; } - DeleteFile(file.c_str()); - file.insert(0, _T("\"")); - file.insert(file.length(), _T("\" ")); - cmd += file; - cmd += _T(" -d \""); - cmd += filename; - cmd += _T("\""); - extern TCHAR *password; - { // password - TCHAR *pass = NULL; - char *keyid = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "KeyID", ""); - if(strlen(keyid) > 0) - { - string dbsetting = "szKey_"; - dbsetting += keyid; - dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(_tcslen(pass) > 0) - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; - } - else - { - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); - if(_tcslen(pass) > 0) - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; - } - if(_tcslen(pass) > 0) + if(_tcsstr(filename, _T(".gpg"))) //decrypt it + { //process encrypted file + if(_waccess(f->tszCurrentFile, 0) == -1) { - cmd += _T("--passphrase \""); - cmd += pass; - cmd += _T("\" "); + if(errno == ENOENT) + return 0; } - else if(password) + string out; + DWORD code; + pxResult result; + wstring cmd = _T("-o "); + wstring file = filename; + wstring::size_type p1 = file.rfind(_T(".gpg")); + file.erase(p1, _tcslen(_T(".gpg"))); + if(_waccess(file.c_str(), 0) != -1) { - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; - cmd += _T("--passphrase \""); - cmd += password; - cmd += _T("\" "); + if(MessageBox(0, _T("Target file exists, do you want to replace it ?"), _T("Warning"), MB_YESNO) == IDNO) + return 0; } - else - debuglog<hContact, GCDNF_TCHAR)<<" with out password\n"; - mir_free(pass); - mir_free(keyid); - } - gpg_execution_params params; - params.cmd = &cmd; - params.useless = ""; - params.out = &out; - params.code = &code; - params.result = &result; - boost::thread *gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); - if(!gpg_thread->timed_join(boost::posix_time::minutes(15))) - { - delete gpg_thread; - TerminateProcess(params.hProcess, 1); - params.hProcess = NULL; - debuglog<hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n"; - if(_terminate) - break; - { //save inkey id - string::size_type s = out.find(" encrypted with "); - s = out.find(" ID ", s); - s += strlen(" ID "); - string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(metaGetMostOnline(ccs->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); - } - void ShowLoadKeyPasswordWindow(); - new_key_hcnt_mutex.lock(); - new_key_hcnt = ccs->hContact; - ShowLoadKeyPasswordWindow(); - wstring cmd2 = cmd; - if(password) - { - debuglog<hContact, GCDNF_TCHAR)<<"\n"; - wstring tmp = _T("--passphrase \""); - tmp += password; - tmp += _T("\" "); - cmd2.insert(0, tmp); + DeleteFile(file.c_str()); + file.insert(0, _T("\"")); + file.insert(file.length(), _T("\" ")); + cmd += file; + cmd += _T(" -d \""); + cmd += filename; + cmd += _T("\""); + extern TCHAR *password; + { // password + TCHAR *pass = NULL; + char *keyid = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "KeyID", ""); + if(strlen(keyid) > 0) + { + string dbsetting = "szKey_"; + dbsetting += keyid; + dbsetting += "_Password"; + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); + if(_tcslen(pass) > 0) + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + } + else + { + pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); + if(_tcslen(pass) > 0) + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + } + if(_tcslen(pass) > 0) + { + cmd += _T("--passphrase \""); + cmd += pass; + cmd += _T("\" "); + } + else if(password) + { + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + cmd += _T("--passphrase \""); + cmd += password; + cmd += _T("\" "); + } + else + debuglog<hContact, GCDNF_TCHAR)<<" with out password\n"; + mir_free(pass); + mir_free(keyid); } - out.clear(); gpg_execution_params params; - pxResult result; - params.cmd = &cmd2; + params.cmd = &cmd; params.useless = ""; params.out = &out; params.code = &code; params.result = &result; - gpg_thread = gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); - if(!gpg_thread->timed_join(boost::posix_time::seconds(15))) + boost::thread *gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); + if(!gpg_thread->timed_join(boost::posix_time::minutes(15))) { delete gpg_thread; TerminateProcess(params.hProcess, 1); params.hProcess = NULL; debuglog<hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n"; + if(_terminate) + break; + { //save inkey id + string::size_type s = out.find(" encrypted with "); + s = out.find(" ID ", s); + s += strlen(" ID "); + string::size_type s2 = out.find(",",s); + DBWriteContactSettingString(metaGetMostOnline(ccs->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + } + void ShowLoadKeyPasswordWindow(); + new_key_hcnt_mutex.lock(); + new_key_hcnt = ccs->hContact; + ShowLoadKeyPasswordWindow(); + wstring cmd2 = cmd; + if(password) + { + debuglog<hContact, GCDNF_TCHAR)<<"\n"; + wstring tmp = _T("--passphrase \""); + tmp += password; + tmp += _T("\" "); + cmd2.insert(0, tmp); + } + out.clear(); + gpg_execution_params params; + pxResult result; + params.cmd = &cmd2; + params.useless = ""; + params.out = &out; + params.code = &code; + params.result = &result; + gpg_thread = gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); + if(!gpg_thread->timed_join(boost::posix_time::seconds(15))) + { + delete gpg_thread; + TerminateProcess(params.hProcess, 1); + params.hProcess = NULL; + debuglog<type == ACKTYPE_MESSAGE) + { + extern std::list sent_msgs; + std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); + if(it != sent_msgs.end()) + { + HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + } + } return 0; } -- cgit v1.2.3 From 4df8492d1da4ce2d4fb075221c0baf79e91f1734 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:13:15 +0300 Subject: modified: utilities.cpp --- utilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities.cpp b/utilities.cpp index b7498e5..b066e22 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -443,7 +443,7 @@ int onProtoAck(WPARAM w, LPARAM l) break; } } - else if(ack->type == ACKTYPE_MESSAGE) + else if(ack->type == ACKTYPE_MESSAGE && ack->result == ACKRESULT_FAILED) { extern std::list sent_msgs; std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); -- cgit v1.2.3 From 16c7f7b357556eb8c38a3b265fbed5e67ac77789 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:15:35 +0300 Subject: modified: utilities.cpp --- utilities.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index b066e22..83e13da 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -446,10 +446,14 @@ int onProtoAck(WPARAM w, LPARAM l) else if(ack->type == ACKTYPE_MESSAGE && ack->result == ACKRESULT_FAILED) { extern std::list sent_msgs; - std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); - if(it != sent_msgs.end()) + if(!sent_msgs.empty()) { - HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); + if(it != sent_msgs.end()) + { + HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + sent_msgs.erase(it); + } } } return 0; -- cgit v1.2.3 From 34317b53102eb8d1cad310fec31922a85bf9add9 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 17:22:39 +0300 Subject: modified: utilities.cpp --- utilities.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index 83e13da..9356728 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -275,14 +275,10 @@ extern bool bFileTransfers; int onProtoAck(WPARAM w, LPARAM l) { - if(!bFileTransfers) - return 0; ACKDATA *ack=(ACKDATA*)l; CCSDATA *ccs=(CCSDATA*)ack->lParam; - if (ack->type!=ACKTYPE_FILE) - return 0; - if(ack->type == ACKTYPE_FILE) + if(ack->type == ACKTYPE_FILE && bFileTransfers) { switch(ack->result) { -- cgit v1.2.3 From 448c6ca661ec9c826cd18bd160e050cf21da112c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 12 Oct 2011 23:03:15 +0300 Subject: notification on failed delivery --- messages.cpp | 6 ++---- utilities.cpp | 24 +++++++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/messages.cpp b/messages.cpp index 44172df..ab6197c 100755 --- a/messages.cpp +++ b/messages.cpp @@ -610,9 +610,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event("Failed to encrypt message with GPG", 0,0, DBEF_SENT)); hcontact_data[hContact].msgs_to_pass.push_back("Failed to encrypt message with GPG"); mir_free(msg); - HANDLE h = (HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); - sent_msgs.push_back(h); - return (int)h; + return CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)msg); } if(!bJabberAPI || !bIsMiranda09) //force jabber to handle encrypted message by itself cmd += _T("--comment \"\" --no-version "); @@ -752,7 +750,7 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) HistoryLog(hContact, db_event((char*)str_event.c_str(), 0,0, dbflags|DBEF_SENT)); if(!(flags & PREF_UTF)) flags |= PREF_UTF; - CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)toUTF8(str).c_str()); + sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)flags, (LPARAM)toUTF8(str).c_str())); mir_free(msg); return 0; } diff --git a/utilities.cpp b/utilities.cpp index 9356728..9d2a9be 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -439,16 +439,25 @@ int onProtoAck(WPARAM w, LPARAM l) break; } } - else if(ack->type == ACKTYPE_MESSAGE && ack->result == ACKRESULT_FAILED) + else if(ack->type == ACKTYPE_MESSAGE) { extern std::list sent_msgs; if(!sent_msgs.empty()) { - std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); - if(it != sent_msgs.end()) + if(ack->result == ACKRESULT_FAILED) { - HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); - sent_msgs.erase(it); + std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); + if(it != sent_msgs.end()) + { + HistoryLog(ack->hContact, db_event("Failed to send encrypted message", 0,0, 0)); + + } + } + else if(ack->result == ACKRESULT_SUCCESS) + { + std::list::iterator it = std::find(sent_msgs.begin(), sent_msgs.end(), ack->hProcess); + if(it != sent_msgs.end()) + sent_msgs.erase(it); } } } @@ -1166,13 +1175,14 @@ void send_encrypted_msgs_thread(HANDLE hContact) { boost::this_thread::sleep(boost::posix_time::seconds(1)); list::iterator end = hcontact_data[hContact].msgs_to_send.end(); + extern std::list sent_msgs; for(list::iterator p = hcontact_data[hContact].msgs_to_send.begin(); p != end; ++p) { - CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)p->c_str()); - + sent_msgs.push_back((HANDLE)CallContactService(hContact, PSS_MESSAGE, (WPARAM)PREF_UTF, (LPARAM)p->c_str())); HistoryLog(hContact, db_event((char*)p->c_str(),0,0, DBEF_SENT)); boost::this_thread::sleep(boost::posix_time::seconds(1)); } + hcontact_data[hContact].msgs_to_send.clear(); return; } else -- cgit v1.2.3 From 8fb8b0899be13c561d7d9c5606fd4cf273d025ce Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 16 Oct 2011 13:03:14 +0300 Subject: modified: new_gpg.vcxproj --- new_gpg.vcxproj | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj index 44dc517..9c5d49b 100755 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -531,7 +531,7 @@ Disabled - e:\temp\windows\libs\utf8cpp\include;e:\temp\windows\libs\Boost\include\boost-1_46;e:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;X:\temp\windows\libs\Boost\include;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -555,7 +555,7 @@ shlwapi.lib;%(AdditionalDependencies) true - e:\temp\windows\libs\Boost\lib-debug-x64;%(AdditionalLibraryDirectories) + X:\temp\windows\libs\Boost\lib64;%(AdditionalLibraryDirectories) true true false @@ -564,6 +564,7 @@ .\Debug/testplug.lib + c:\debug\$(TargetName).pdb true @@ -713,7 +714,7 @@ shlwapi.lib;%(AdditionalDependencies) true X:\temp\windows\libs\Boost\lib;%(AdditionalLibraryDirectories) - false + true NotSet true true @@ -722,6 +723,7 @@ .\Release Unicode (static)/testplug.lib + c:\debug\$(TargetName).pdb true @@ -743,7 +745,7 @@ Size true true - e:\temp\windows\libs\utf8cpp\include;e:\temp\windows\libs\Boost\include\boost-1_46;e:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;x:\temp\windows\libs\Boost\include;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE;%(PreprocessorDefinitions) true MultiThreaded @@ -766,8 +768,8 @@ shlwapi.lib;%(AdditionalDependencies) true - e:\temp\windows\libs\Boost\lib-release-x64;%(AdditionalLibraryDirectories) - false + x:\temp\windows\libs\Boost\lib64;%(AdditionalLibraryDirectories) + true NotSet true true @@ -776,6 +778,7 @@ .\Release Unicode (static)/testplug.lib + c:\debug\$(TargetName).pdb true -- cgit v1.2.3 From 820307153b05c8ce93f5022c6772a748cca49909 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 19 Oct 2011 06:40:18 +0300 Subject: cipy to clipboard button, may not work yet --- new_gpg.rc | 5 +- options.cpp | 15 +++++- resource.h | 172 ++++++++++++++++++++++++++++++------------------------------ 3 files changed, 104 insertions(+), 88 deletions(-) mode change 100644 => 100755 new_gpg.rc mode change 100644 => 100755 options.cpp mode change 100644 => 100755 resource.h diff --git a/new_gpg.rc b/new_gpg.rc old mode 100644 new mode 100755 index bd99e79..50aa6c2 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -316,15 +316,16 @@ BEGIN CTEXT "Userlist:",IDC_STATIC,25,7,201,8 PUSHBUTTON "Export PubKey",IDC_SAVE_KEY_BUTTON,8,135,75,14 PUSHBUTTON "Delete key",IDC_DELETE_KEY_BUTTON,90,135,70,14 - PUSHBUTTON "Select own key",IDC_SELECT_KEY,170,193,109,14 + PUSHBUTTON "Select own key",IDC_SELECT_KEY,203,193,76,14 CONTROL "Turn on debug log",IDC_DEBUG_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,159,89,10 EDITTEXT IDC_LOG_FILE_EDIT,11,157,98,14,ES_AUTOHSCROLL PUSHBUTTON "Browse",IDC_LOG_FILE_SET,119,156,50,14 CONTROL "Use jabber api on Miranda IM >= 0.9 (recomended)",IDC_JABBER_API, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,175,251,10 - LTEXT "Current key",IDC_CURRENT_KEY,48,196,116,8 + LTEXT "Current key",IDC_CURRENT_KEY,12,196,116,8 CONTROL "Encrypt file transfers",IDC_FILE_TRANSFERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,185,137,10 CONTROL "Automatic key exchange",IDC_AUTO_EXCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,137,111,10 + PUSHBUTTON "Copy own key",IDC_COPY_KEY,137,193,62,14 END IDD_OPT_GPG_BIN DIALOGEX 0, 0, 282, 214 diff --git a/options.cpp b/options.cpp old mode 100644 new mode 100755 index fe1c2c3..4b68d63 --- a/options.cpp +++ b/options.cpp @@ -353,6 +353,19 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA f.close(); } break; + case IDC_COPY_KEY: + { + if(OpenClipboard(hwndDlg)) + { + char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); + EmptyClipboard(); + SetClipboardData(CF_OEMTEXT, szKey); + CloseClipboard(); + mir_free(szKey); + } + else + MessageBoxA(0, "Error", "Failed to open clipboard", MB_OK); + } case IDC_LOG_FILE_SET: { tmp = GetFilePath(_T("Set log file"), _T("*"), _T("LOG files"), 1); @@ -366,7 +379,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } - + case WM_NOTIFY: { EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && IsDlgButtonChecked(hwndDlg, IDC_JABBER_API))); diff --git a/resource.h b/resource.h old mode 100644 new mode 100755 index 9043ac1..b7900a0 --- a/resource.h +++ b/resource.h @@ -1,85 +1,87 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by new_gpg.rc -// -#define IDD_LOAD_PUBLIC_KEY 102 -#define IDD_FIRST_RUN 103 -#define IDD_OPT_GPG 104 -#define IDD_OPT_GPG_BIN 105 -#define IDD_BIN_PATH 106 -#define IDD_OPT_GPG_MESSAGES 107 -#define IDD_NEW_KEY 108 -#define IDD_KEY_GEN 109 -#define IDD_LOAD_EXISTING_KEY 110 -#define IDD_KEY_PASSWD 111 -#define IDI_SECURED 112 -#define IDD_IMPORT_KEY 112 -#define IDI_UNSECURED 113 -#define IDC_SET_BIN_PATH 1016 -#define IDC_SET_HOME_DIR 1017 -#define IDC_BIN_PATH 1018 -#define IDC_HOME_DIR 1019 -#define IDC_USERLIST 1020 -#define IDC_LOAD_KEY_BUTTON 1022 -#define ID_OK 1023 -#define ID_LOD_FROM_FILE 1024 -#define ID_LOAD_FROM_FILE 1024 -#define IDC_EDIT1 1025 -#define IDC_PUBLIC_KEY_EDIT 1025 -#define IDC_KEY_PASSWORD 1025 -#define IDC_IN_OPEN_TAG 1025 -#define IDC_KEY_PASSWD 1025 -#define IDC_PASSWORD 1025 -#define IDC_LOG_FILE_EDIT 1025 -#define IDC_BUTTON1 1026 -#define IDC_SAVE_KEY_BUTTON 1026 -#define IDC_GENERATE_KEY 1026 -#define IDC_IGNORE_KEY 1026 -#define IDC_SELECT_EXISTING 1026 -#define IDC_KEY_EMAIL 1026 -#define IDC_DELETE_KEY_BUTTON 1027 -#define IDC_IN_CLOSE_TAG 1027 -#define IDC_KEY_REAL_NAME 1027 -#define IDC_KEY_LIST 1028 -#define IDC_KEY_COMMENT 1028 -#define IDC_OUT_OPEN_TAG 1029 -#define IDC_APPEND_TAGS 1030 -#define IDC_OUT_CLOSE_TAG 1031 -#define IDC_SELECT_KEY 1033 -#define IDC_MESSAGE 1034 -#define ID_IMPORT 1035 -#define IDC_IMPORT_AND_USE 1036 -#define IDC_KEY_TYPE 1039 -#define IDC_KEY_LENGTH 1040 -#define IDC_KEY_EXPIRE_DATE 1043 -#define IDC_EXISTING_KEY_LIST 1045 -#define IDC_BUTTON2 1046 -#define IDC_OTHER 1046 -#define IDC_LOG_FILE_SET 1046 -#define IDC_IMPORT 1046 -#define IDC_SAVE_PASSWORD 1047 -#define IDC_DEBUG_LOG 1048 -#define IDC_JABBER_API 1049 -#define IDC_ENABLE_ENCRYPTION 1050 -#define IDC_KEY_FROM 1051 -#define IDC_DELETE_KEY 1052 -#define IDC_KEYID 1053 -#define IDC_CURRENT_KEY 1054 -#define IDC_DEFAULT_PASSWORD 1055 -#define IDC_KEYSERVER 1058 -#define IDC_FILE_TRANSFERS 1061 -#define IDC_REMOVE_FILTERS 1062 -#define IDC_GENERATE_RANDOM 1063 -#define IDC_AUTO_EXCHANGE 1064 -#define IDC_AUT_EXCHANGE 1065 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 114 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1066 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by new_gpg.rc +// +#define IDD_LOAD_PUBLIC_KEY 102 +#define IDD_FIRST_RUN 103 +#define IDD_OPT_GPG 104 +#define IDD_OPT_GPG_BIN 105 +#define IDD_BIN_PATH 106 +#define IDD_OPT_GPG_MESSAGES 107 +#define IDD_NEW_KEY 108 +#define IDD_KEY_GEN 109 +#define IDD_LOAD_EXISTING_KEY 110 +#define IDD_KEY_PASSWD 111 +#define IDI_SECURED 112 +#define IDD_IMPORT_KEY 112 +#define IDI_UNSECURED 113 +#define IDC_SET_BIN_PATH 1016 +#define IDC_SET_HOME_DIR 1017 +#define IDC_BIN_PATH 1018 +#define IDC_HOME_DIR 1019 +#define IDC_USERLIST 1020 +#define IDC_LOAD_KEY_BUTTON 1022 +#define ID_OK 1023 +#define ID_LOD_FROM_FILE 1024 +#define ID_LOAD_FROM_FILE 1024 +#define IDC_EDIT1 1025 +#define IDC_PUBLIC_KEY_EDIT 1025 +#define IDC_KEY_PASSWORD 1025 +#define IDC_IN_OPEN_TAG 1025 +#define IDC_KEY_PASSWD 1025 +#define IDC_PASSWORD 1025 +#define IDC_LOG_FILE_EDIT 1025 +#define IDC_BUTTON1 1026 +#define IDC_SAVE_KEY_BUTTON 1026 +#define IDC_GENERATE_KEY 1026 +#define IDC_IGNORE_KEY 1026 +#define IDC_SELECT_EXISTING 1026 +#define IDC_KEY_EMAIL 1026 +#define IDC_DELETE_KEY_BUTTON 1027 +#define IDC_IN_CLOSE_TAG 1027 +#define IDC_KEY_REAL_NAME 1027 +#define IDC_KEY_LIST 1028 +#define IDC_KEY_COMMENT 1028 +#define IDC_OUT_OPEN_TAG 1029 +#define IDC_APPEND_TAGS 1030 +#define IDC_OUT_CLOSE_TAG 1031 +#define IDC_SELECT_KEY 1033 +#define IDC_MESSAGE 1034 +#define ID_IMPORT 1035 +#define IDC_IMPORT_AND_USE 1036 +#define IDC_KEY_TYPE 1039 +#define IDC_KEY_LENGTH 1040 +#define IDC_KEY_EXPIRE_DATE 1043 +#define IDC_EXISTING_KEY_LIST 1045 +#define IDC_BUTTON2 1046 +#define IDC_OTHER 1046 +#define IDC_LOG_FILE_SET 1046 +#define IDC_IMPORT 1046 +#define IDC_SAVE_PASSWORD 1047 +#define IDC_DEBUG_LOG 1048 +#define IDC_JABBER_API 1049 +#define IDC_ENABLE_ENCRYPTION 1050 +#define IDC_KEY_FROM 1051 +#define IDC_DELETE_KEY 1052 +#define IDC_KEYID 1053 +#define IDC_CURRENT_KEY 1054 +#define IDC_DEFAULT_PASSWORD 1055 +#define IDC_KEYSERVER 1058 +#define IDC_FILE_TRANSFERS 1061 +#define IDC_REMOVE_FILTERS 1062 +#define IDC_GENERATE_RANDOM 1063 +#define IDC_AUTO_EXCHANGE 1064 +#define IDC_AUT_EXCHANGE 1065 +#define IDC_BUTTON3 1066 +#define IDC_COPY_KEY 1066 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 114 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1067 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif -- cgit v1.2.3 From 3dad33945b29e49469d70d04b4ecc95a43c7b283 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 19 Oct 2011 07:53:24 +0300 Subject: modified: options.cpp --- options.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/options.cpp b/options.cpp index 4b68d63..8fcae69 100755 --- a/options.cpp +++ b/options.cpp @@ -366,6 +366,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else MessageBoxA(0, "Error", "Failed to open clipboard", MB_OK); } + break; case IDC_LOG_FILE_SET: { tmp = GetFilePath(_T("Set log file"), _T("*"), _T("LOG files"), 1); -- cgit v1.2.3 From b12986a6163f7634a20e34761b9b32776b64c226 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 19 Oct 2011 08:39:19 +0300 Subject: modified: options.cpp --- options.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/options.cpp b/options.cpp index 8fcae69..b067cb3 100755 --- a/options.cpp +++ b/options.cpp @@ -359,9 +359,12 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); EmptyClipboard(); - SetClipboardData(CF_OEMTEXT, szKey); + if(!SetClipboardData(CF_OEMTEXT, szKey)) + { + mir_free(szKey); + MessageBoxA(0, "Error", "Failed to write to clipboard", MB_OK); + } CloseClipboard(); - mir_free(szKey); } else MessageBoxA(0, "Error", "Failed to open clipboard", MB_OK); -- cgit v1.2.3 From f9f50a5ce2120ca30100dcbc47b5b4cea6b44b77 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 19 Oct 2011 08:59:25 +0300 Subject: modified: options.cpp --- options.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/options.cpp b/options.cpp index b067cb3..5f0c99f 100755 --- a/options.cpp +++ b/options.cpp @@ -358,6 +358,14 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if(OpenClipboard(hwndDlg)) { char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); + TCHAR *buf = mir_utf8decodeT(szKey); + mir_free(szKey); + std::wstring str = buf; + mir_free(buf); + for(std::wstring::size_type i = str.find(_T("\n")); i != std::wstring::npos; i = str.find(_T("\n"), i+2)) + str.replace(i, 1, _T("\r\n")); + szKey = mir_utf8encodeW(str.c_str()); + str.clear(); EmptyClipboard(); if(!SetClipboardData(CF_OEMTEXT, szKey)) { -- cgit v1.2.3 From cae60e6558eac18ed90f5e9b1793b9c940597f32 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 19 Oct 2011 09:15:20 +0300 Subject: modified: options.cpp --- options.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/options.cpp b/options.cpp index 5f0c99f..fe81e36 100755 --- a/options.cpp +++ b/options.cpp @@ -358,13 +358,11 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if(OpenClipboard(hwndDlg)) { char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); - TCHAR *buf = mir_utf8decodeT(szKey); - mir_free(szKey); - std::wstring str = buf; - mir_free(buf); - for(std::wstring::size_type i = str.find(_T("\n")); i != std::wstring::npos; i = str.find(_T("\n"), i+2)) + std::string str = szKey;; + mir_free(szKey); + for(std::string::size_type i = str.find(_T("\n")); i != std::string::npos; i = str.find(_T("\n"), i+2)) str.replace(i, 1, _T("\r\n")); - szKey = mir_utf8encodeW(str.c_str()); + szKey = mir_strdup(str.c_str()); str.clear(); EmptyClipboard(); if(!SetClipboardData(CF_OEMTEXT, szKey)) -- cgit v1.2.3 From 30af6ed7fb8d41eada477241d47efc320d72ea79 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 21 Oct 2011 02:39:14 +0300 Subject: modified: ../options.cpp --- options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/options.cpp b/options.cpp index fe81e36..0371caf 100755 --- a/options.cpp +++ b/options.cpp @@ -359,11 +359,11 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { char *szKey = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); std::string str = szKey;; - mir_free(szKey); - for(std::string::size_type i = str.find(_T("\n")); i != std::string::npos; i = str.find(_T("\n"), i+2)) - str.replace(i, 1, _T("\r\n")); - szKey = mir_strdup(str.c_str()); - str.clear(); + mir_free(szKey); + for(std::string::size_type i = str.find("\n"); i != std::string::npos; i = str.find("\n", i+2)) + str.replace(i, 1, "\r\n"); + szKey = mir_strdup(str.c_str()); + str.clear(); EmptyClipboard(); if(!SetClipboardData(CF_OEMTEXT, szKey)) { -- cgit v1.2.3 From 4951c262631885820d1bbde0ed1c3ceb8cb285b6 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 21 Oct 2011 03:28:37 +0300 Subject: modified: ../options.cpp --- options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options.cpp b/options.cpp index 0371caf..440e1be 100755 --- a/options.cpp +++ b/options.cpp @@ -365,7 +365,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA szKey = mir_strdup(str.c_str()); str.clear(); EmptyClipboard(); - if(!SetClipboardData(CF_OEMTEXT, szKey)) + if(!SetClipboardData(CF_TEXT, szKey)) { mir_free(szKey); MessageBoxA(0, "Error", "Failed to write to clipboard", MB_OK); -- cgit v1.2.3 From d94de204ce513b7be134ed7a1aa83295b89719ec Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 22 Oct 2011 23:07:11 +0300 Subject: copy key to clipboard button --- options.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/options.cpp b/options.cpp index 440e1be..825bd00 100755 --- a/options.cpp +++ b/options.cpp @@ -362,18 +362,40 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_free(szKey); for(std::string::size_type i = str.find("\n"); i != std::string::npos; i = str.find("\n", i+2)) str.replace(i, 1, "\r\n"); - szKey = mir_strdup(str.c_str()); + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, str.size() +1); + if(!hMem) + { + MessageBoxA(0, "Failed to alocate memory", "Error", MB_OK); + break; + } + szKey = (char*)GlobalLock(hMem); + if(!szKey) + { + char msg[64]; + mir_snprintf(msg, 127, "Failed to lock memory with error %d", GetLastError()); + MessageBoxA(0, msg, "Error", MB_OK); + GlobalFree(hMem); + } + memcpy(szKey, str.c_str(), str.size()); + szKey[str.size()] = '\0'; str.clear(); EmptyClipboard(); - if(!SetClipboardData(CF_TEXT, szKey)) + GlobalUnlock(hMem); + if(!SetClipboardData(CF_OEMTEXT, hMem)) { - mir_free(szKey); - MessageBoxA(0, "Error", "Failed to write to clipboard", MB_OK); + GlobalFree(hMem); + char msg[64]; + mir_snprintf(msg, 127, "Failed write to clipboard with error %d", GetLastError()); + MessageBoxA(0, msg, "Error", MB_OK); } CloseClipboard(); } else - MessageBoxA(0, "Error", "Failed to open clipboard", MB_OK); + { + char msg[64]; + mir_snprintf(msg, 127, "Failed to open clipboard with error %d", GetLastError()); + MessageBoxA(0, msg, "Error", MB_OK); + } } break; case IDC_LOG_FILE_SET: -- cgit v1.2.3 From 2fb715f5ca9dd2c51b05e4974b644942c79440f9 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 22 Oct 2011 23:30:30 +0300 Subject: modified: options.cpp --- options.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/options.cpp b/options.cpp index 825bd00..aab7884 100755 --- a/options.cpp +++ b/options.cpp @@ -1314,7 +1314,12 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); } break; - + case WM_KEYDOWN: + { + if(wParam == 'A' && GetKeyState(VK_CONTROL)) + SendMessage(GetWindow(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); + } + break; } return FALSE; -- cgit v1.2.3 From ff1a66311d278da49fd5fe39597b3bfdbd668fbd Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 22 Oct 2011 23:45:23 +0300 Subject: modified: options.cpp --- options.cpp | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/options.cpp b/options.cpp index aab7884..2535c83 100755 --- a/options.cpp +++ b/options.cpp @@ -1287,23 +1287,6 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP } } break; - case WM_HOTKEY: - { - if(lParam & MOD_CONTROL) - { - if(wParam == 1) - { -// TCHAR sel[2048] = {0}; -// int c = SendMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_GETSELTEXT, 0, (LPARAM)&sel); -// MessageBoxA(NULL, "ctrl+c", "", MB_OK); - } - else if(wParam == 2) - { - SendMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); - } - } - } - break; case WM_CLOSE: DestroyWindow(hwndDlg); break; -- cgit v1.2.3 From 5292cc0aea09b39be626f14e199d765cca896883 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 23 Oct 2011 20:31:12 +0300 Subject: fixed ctrl+a --- options.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/options.cpp b/options.cpp index 2535c83..3fffe3a 100755 --- a/options.cpp +++ b/options.cpp @@ -713,7 +713,6 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateW(_T("Turn on encryption"))); CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); } -// RegisterHotKey(hwndDlg, 1, MOD_CONTROL | MOD_NOREPEAT, 0x43); //ctrl+c RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); if(hcnt) { @@ -1297,10 +1296,10 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); } break; - case WM_KEYDOWN: + case WM_HOTKEY: { - if(wParam == 'A' && GetKeyState(VK_CONTROL)) - SendMessage(GetWindow(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); + if(wParam == 2) + PostMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); } break; } -- cgit v1.2.3 From 4d8b70aaee170fa46116f10ef3eed3eb30ceffea Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:27:21 +0300 Subject: fixed crash on key password enter --- messages.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/messages.cpp b/messages.cpp index ab6197c..1d7e555 100755 --- a/messages.cpp +++ b/messages.cpp @@ -924,20 +924,23 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L if(_tcslen(tmp) > 0) { extern TCHAR *password; - if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) + if(password && password[0]) { - if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) { - string dbsetting = "szKey_"; - dbsetting += inkeyid; - dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) + { + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); + } + else + DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); } - else - DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); + if(password) + delete [] password; } - if(password) - delete [] password; password = new TCHAR [_tcslen(tmp)+1]; _tcscpy(password, tmp); } -- cgit v1.2.3 From ab62cd41fab9a0c941d035041df98f4ae3346339 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:52:42 +0300 Subject: fixed crash in password enter dialog again --- messages.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/messages.cpp b/messages.cpp index 1d7e555..dc249da 100755 --- a/messages.cpp +++ b/messages.cpp @@ -924,23 +924,20 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L if(_tcslen(tmp) > 0) { extern TCHAR *password; - if(password && password[0]) + if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) { - if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) + if(inkeyid && inkeyid[0] && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) { - if((strlen(inkeyid) > 0) && !IsDlgButtonChecked(hwndDlg, IDC_DEFAULT_PASSWORD)) - { - string dbsetting = "szKey_"; - dbsetting += inkeyid; - dbsetting += "_Password"; - DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); - } - else - DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); + string dbsetting = "szKey_"; + dbsetting += inkeyid; + dbsetting += "_Password"; + DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), tmp); } - if(password) - delete [] password; + else + DBWriteContactSettingTString(NULL, szGPGModuleName, "szKeyPassword", tmp); } + if(password) + delete [] password; password = new TCHAR [_tcslen(tmp)+1]; _tcscpy(password, tmp); } -- cgit v1.2.3 From ae82ea7b5c3177c8ad6934a01985a17603162972 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 26 Oct 2011 12:53:50 +0300 Subject: modified: ../messages.cpp --- messages.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages.cpp b/messages.cpp index dc249da..c563e78 100755 --- a/messages.cpp +++ b/messages.cpp @@ -921,7 +921,7 @@ static BOOL CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, L { TCHAR tmp[64]; GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); - if(_tcslen(tmp) > 0) + if(tmp[0]) { extern TCHAR *password; if(IsDlgButtonChecked(hwndDlg, IDC_SAVE_PASSWORD)) -- cgit v1.2.3 From 16a477058f150f46a99e2f60cd51502c04a1ed9c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 3 Nov 2011 07:38:25 +0200 Subject: fixed default password loading --- init.cpp | 1 + messages.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 init.cpp diff --git a/init.cpp b/init.cpp old mode 100644 new mode 100755 index 6f591ac..04a198a --- a/init.cpp +++ b/init.cpp @@ -91,6 +91,7 @@ void init_vars() outclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutCloseTag", _T("")); bDebugLog = DBGetContactSettingByte(NULL, szGPGModuleName, "bDebugLog", 0); bAutoExchange = DBGetContactSettingByte(NULL, szGPGModuleName, "bAutoExchange", 0); + password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); debuglog.init(); bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0); bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1); diff --git a/messages.cpp b/messages.cpp index c563e78..e64fd53 100755 --- a/messages.cpp +++ b/messages.cpp @@ -101,28 +101,28 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D { char *inkeyid = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", ""); TCHAR *pass = NULL; - if(strlen(inkeyid) > 0) + if(inkeyid[0]) { string dbsetting = "szKey_"; dbsetting += inkeyid; dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(_tcslen(pass) > 0) + if(pass[0]) debuglog< 0) + if(pass[0]) debuglog< 0) + if(pass && pass[0]) { cmd += _T("--passphrase \""); cmd += pass; cmd += _T("\" "); } - else if(password) + else if(password && password[0]) { debuglog< Date: Thu, 3 Nov 2011 20:37:56 +0200 Subject: basic utf8cpp exceptions handling --- utilities.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/utilities.cpp b/utilities.cpp index 9d2a9be..b651558 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1138,7 +1138,14 @@ int returnNoError(HANDLE hContact) { string toUTF8(wstring str) { string ustr; + try{ utf8::utf16to8(str.begin(), str.end(), back_inserter(ustr)); + } + catch(const utf8::exception& e) + { + debuglog< Date: Mon, 7 Nov 2011 02:46:59 +0200 Subject: removed old warning about gpg version small ui corrections possible translation fixes --- main.cpp | 6 +++--- new_gpg.rc | 6 +++--- options.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) mode change 100644 => 100755 main.cpp diff --git a/main.cpp b/main.cpp old mode 100644 new mode 100755 index e75ec4d..913ecbf --- a/main.cpp +++ b/main.cpp @@ -1803,14 +1803,14 @@ void InitCheck() mir_free(home_dir); tmp_dir += _T("\\tmp"); _wmkdir(tmp_dir.c_str()); - string question = "Your secret key whith id: "; + string question = Translate("Your secret key whith id: "); char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); question += keyid; mir_free(keyid); - question += " deleted from gpg secret keyring\nDo you want to set another key ?"; + question += Translate(" deleted from gpg secret keyring\nDo you want to set another key ?"); void ShowFirstRunDialog(); if(out.find(keyid) == string::npos) - if(MessageBoxA(0, question.c_str(), "Own secret key warning", MB_YESNO) == IDYES) + if(MessageBoxA(0, question.c_str(), Translate("Own secret key warning"), MB_YESNO) == IDYES) ShowFirstRunDialog(); } { diff --git a/new_gpg.rc b/new_gpg.rc index 50aa6c2..c40b0c5 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -316,16 +316,16 @@ BEGIN CTEXT "Userlist:",IDC_STATIC,25,7,201,8 PUSHBUTTON "Export PubKey",IDC_SAVE_KEY_BUTTON,8,135,75,14 PUSHBUTTON "Delete key",IDC_DELETE_KEY_BUTTON,90,135,70,14 - PUSHBUTTON "Select own key",IDC_SELECT_KEY,203,193,76,14 + PUSHBUTTON "Select own key",IDC_SELECT_KEY,205,193,74,14 CONTROL "Turn on debug log",IDC_DEBUG_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,181,159,89,10 EDITTEXT IDC_LOG_FILE_EDIT,11,157,98,14,ES_AUTOHSCROLL PUSHBUTTON "Browse",IDC_LOG_FILE_SET,119,156,50,14 CONTROL "Use jabber api on Miranda IM >= 0.9 (recomended)",IDC_JABBER_API, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,175,251,10 - LTEXT "Current key",IDC_CURRENT_KEY,12,196,116,8 + LTEXT "Current key",IDC_CURRENT_KEY,12,196,110,8 CONTROL "Encrypt file transfers",IDC_FILE_TRANSFERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,185,137,10 CONTROL "Automatic key exchange",IDC_AUTO_EXCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,137,111,10 - PUSHBUTTON "Copy own key",IDC_COPY_KEY,137,193,62,14 + PUSHBUTTON "Copy own key",IDC_COPY_KEY,127,193,74,14 END IDD_OPT_GPG_BIN DIALOGEX 0, 0, 282, 214 diff --git a/options.cpp b/options.cpp index 3fffe3a..6079dae 100755 --- a/options.cpp +++ b/options.cpp @@ -526,10 +526,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); } - if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); +/* if(bad_version) //looks like working fine with gpg2 + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); */ } } char mir_path[MAX_PATH]; -- cgit v1.2.3 From 3dff6b71bb4ea90129d9b9721cb862a85c696fc4 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 11 Feb 2012 07:20:23 +0200 Subject: fixed date field on keygen dialog --- new_gpg.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/new_gpg.rc b/new_gpg.rc index c40b0c5..6bf6f49 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -126,7 +126,7 @@ BEGIN EDITTEXT IDC_KEY_EMAIL,120,76,55,14,ES_AUTOHSCROLL | WS_GROUP EDITTEXT IDC_KEY_REAL_NAME,120,61,55,14,ES_AUTOHSCROLL | WS_GROUP EDITTEXT IDC_KEY_COMMENT,120,91,55,14,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_KEY_EXPIRE_DATE,120,106,55,14,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP + EDITTEXT IDC_KEY_EXPIRE_DATE,120,106,55,14,ES_AUTOHSCROLL | WS_GROUP LTEXT "ex.: 2010-08-15",IDC_STATIC,182,108,75,8 EDITTEXT IDC_KEY_LENGTH,120,30,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP LTEXT "From 1024 to 4096",IDC_STATIC,168,33,89,8 -- cgit v1.2.3 From 1abe0e83270a64e2a51e7c2cbb66b76bc406a5a0 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 11 Feb 2012 14:12:04 +0200 Subject: fix possible export key problem --- main.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index 913ecbf..c5a8847 100755 --- a/main.cpp +++ b/main.cpp @@ -1568,10 +1568,25 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, { out.erase(s, 1); } - TCHAR *tmp = mir_a2t(out.c_str()); + std::string::size_type p1 = 0, p2 = 0; + p1 = out.find("-----BEGIN PGP PUBLIC KEY BLOCK-----"); + if(p1 != std::string::npos) + { + p2 = out.find("-----END PGP PUBLIC KEY BLOCK-----", p1); + if(p2 != std::string::npos) + { + p2 += strlen("-----END PGP PUBLIC KEY BLOCK-----"); + out = out.substr(p1, p2-p1); + TCHAR *tmp = mir_a2t(out.c_str()); + SetWindowText(hPubKeyEdit, tmp); + mir_free(tmp); + } + else + MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + } + else + MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); // SetDlgItemText(hPubKeyEdit, IDC_PUBLIC_KEY_EDIT, tmp); - SetWindowText(hPubKeyEdit, tmp); - mir_free(tmp); } DestroyWindow(hwndDlg); break; -- cgit v1.2.3 From 9e02dc6e39a6073f496cb920394c6396596bb1a3 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 14:51:02 +0200 Subject: translation support for some messageboxes --- main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index c5a8847..56ec91e 100755 --- a/main.cpp +++ b/main.cpp @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBox(0, _T("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateW("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, _T("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in wollowing diallog."), _T("Info"), MB_OK); + MessageBox(0, TranslateW("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in following diallog."), _T("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From 6a42053a9796fb2a2cdc0ef795fda101a0167247 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 15:01:50 +0200 Subject: modified: main.cpp --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 56ec91e..14a93a7 100755 --- a/main.cpp +++ b/main.cpp @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, TranslateW("You have supported version of gpg binary, and gpg language file in place!\ngpg plugin should work fine on your installation!\njust press ok in following diallog."), _T("Info"), MB_OK); + MessageBox(0, TranslateW("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), _T("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From bb5528246b71975133456bc5e54ed84b4ff4a4a8 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 25 Feb 2012 16:56:52 +0200 Subject: modified: main.cpp --- main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.cpp b/main.cpp index 14a93a7..588fa03 100755 --- a/main.cpp +++ b/main.cpp @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBox(0, TranslateW("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), "Warning", MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, TranslateW("wrong gpg binary location found in system.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("wrong gpg binary location found in system.\nplease choose another location"), "Warning", MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, TranslateW("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); } if(bad_version) - MessageBox(0, TranslateW("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBoxA(0, Translate("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBox(0, TranslateW("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), _T("Info"), MB_OK); + MessageBoxA(0, Translate("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), "Info", MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; -- cgit v1.2.3 From b854bd5561c7101a03d4cb0f14b31ef640e0e913 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 16:45:19 +0200 Subject: translation support fixes --- main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 588fa03..3fee85e 100755 --- a/main.cpp +++ b/main.cpp @@ -1001,9 +1001,9 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?_T("There is existing key for contact, would you like to replace with new key ?"):_T("New public key was received, do you want to import it?")); + SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); - SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?_T("Replace"):_T("Accept")); + SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); mir_free(tmp); tmp = new TCHAR [256]; _tcscpy(tmp, _T("Received key from ")); -- cgit v1.2.3 From f92386e190df0a638aadc90afbc3d0bed01716f6 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 17:21:43 +0200 Subject: translations fixes --- main.cpp | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/main.cpp b/main.cpp index 3fee85e..f6a5e77 100755 --- a/main.cpp +++ b/main.cpp @@ -389,7 +389,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, _T("Failed to open file"), _T("Error"), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: RSA"; @@ -552,7 +552,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(gpg_lang_path, 0) != -1) lang_exists = true; if(gpg_exists && !lang_exists) //TODO: check gpg version - MessageBoxA(0, Translate("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), "Warning", MB_OK); + MessageBox(0, TranslateT("gpg binary found in miranda folder, but english locale does not exists.\nit's highly recommended to place \\gnupg.nls\\en@quot.mo in gnupg folder under miranda root.\nwithout this file you may expirense many problem with gpg output on non english systems.\nand plugin may completely do not work.\nyou have beed warned."), TranslateT("Warning"), MB_OK); mir_free(gpg_path); mir_free(gpg_lang_path); } @@ -570,7 +570,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBoxA(0, Translate("wrong gpg binary location found in system.\nplease choose another location"), "Warning", MB_OK); + MessageBox(0, TranslateT("wrong gpg binary location found in system.\nplease choose another location"), TranslateT("Warning"), MB_OK); } } } @@ -614,10 +614,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBoxA(0, Translate("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBoxA(0, Translate("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), "Warning", MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } mir_free(tmp); if(!gpg_exists) @@ -629,7 +629,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_HOME_DIR, !gpg_exists?tmp:_T("gpg")); mir_free(tmp); if(gpg_exists && lang_exists && !bad_version) - MessageBoxA(0, Translate("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), "Info", MB_OK); + MessageBox(0, TranslateT("Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue."), TranslateT("Info"), MB_OK); extern bool bIsMiranda09; EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), bIsMiranda09); return TRUE; @@ -690,14 +690,14 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("gpg binary does not exists.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("gpg binary does not exists.\nplease choose another location"), TranslateT("Warning"), MB_OK); break; } } } else { - MessageBox(0, _T("please choose gpg binary location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please choose gpg binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -734,10 +734,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); @@ -745,7 +745,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) { - MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); @@ -779,14 +779,14 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { if(errno == ENOENT) { - MessageBox(0, _T("gpg binary does not exists.\nplease choose another location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("gpg binary does not exists.\nplease choose another location"), TranslateT("Warning"), MB_OK); break; } } } else { - MessageBox(0, _T("please choose gpg binary location"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please choose gpg binary location"), TranslateT("Warning"), MB_OK); break; } { @@ -823,10 +823,10 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else { bad_version = false; - MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } if(bad_version) - MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), TranslateT("Warning"), MB_OK); } DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); @@ -834,7 +834,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) { - MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); + MessageBox(0, TranslateT("please set keyring's home directory"), TranslateT("Warning"), MB_OK); break; } DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); @@ -859,7 +859,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, _T("Failed to open file"), _T("Error"), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: RSA"; @@ -1006,7 +1006,7 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); mir_free(tmp); tmp = new TCHAR [256]; - _tcscpy(tmp, _T("Received key from ")); + _tcscpy(tmp, TranslateT("Received key from ")); _tcscat(tmp, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR)); SetDlgItemText(hwndDlg, IDC_KEY_FROM, tmp); delete [] tmp; @@ -1073,7 +1073,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { SetWindowPos(hwndDlg, 0, key_gen_rect.left, key_gen_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); - SetWindowText(hwndDlg, TranslateW(_T("Key Generation dialog"))); + SetWindowText(hwndDlg, TranslateT("Key Generation dialog")); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("RSA"), 0); ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1); SendDlgItemMessage(hwndDlg, IDC_KEY_TYPE, CB_SETCURSEL, (WPARAM)1, 0); @@ -1099,7 +1099,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, if(_tcslen(tmp) < 3) { mir_free(tmp); - MessageBox(0, TranslateW(_T("You must set encryption algorythm first")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("You must set encryption algorythm first"), TranslateT("Error"), MB_OK); break; } mir_free(tmp); @@ -1109,14 +1109,14 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, mir_free(tmp); if(length < 1024 || length > 4096) { - MessageBox(0, TranslateW(_T("Key length must be of length from 1024 to 4096 bits")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Key length must be of length from 1024 to 4096 bits"), TranslateT("Error"), MB_OK); break; } tmp = new TCHAR [12]; GetDlgItemText(hwndDlg, IDC_KEY_EXPIRE_DATE, tmp, 12); if(_tcslen(tmp) != 10 && tmp[0] != '0') { - MessageBox(0, TranslateW(_T("Invalid date")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Invalid date"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1125,13 +1125,13 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_KEY_REAL_NAME, tmp, 128); if(_tcslen(tmp) < 5) { - MessageBox(0, TranslateW(_T("Name must contain at least 5 characters")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Name must contain at least 5 characters"), TranslateT("Error"), MB_OK); delete [] tmp; break; } else if (_tcschr(tmp, _T('(')) || _tcschr(tmp, _T(')'))) { - MessageBox(0, TranslateW(_T("Name cannot contain '(' or ')'")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Name cannot contain '(' or ')'"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1140,7 +1140,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_KEY_EMAIL, tmp, 128); if((_tcslen(tmp)) < 5 || (!_tcschr(tmp, _T('@'))) || (!_tcschr(tmp, _T('.')))) { - MessageBox(0, TranslateW(_T("Invalid Email")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Invalid Email"), TranslateT("Error"), MB_OK); delete [] tmp; break; } @@ -1156,7 +1156,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, wfstream f(path.c_str(), std::ios::out); if(!f.is_open()) { - MessageBox(0, TranslateW(_T("Failed to open file")), TranslateW(_T("Error")), MB_OK); + MessageBox(0, TranslateT("Failed to open file"), TranslateT("Error"), MB_OK); break; } f<<"Key-Type: "; @@ -1582,10 +1582,10 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, mir_free(tmp); } else - MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); } else - MessageBoxA(NULL, Translate("Failed to export public key."), Translate("Error"), MB_OK); + MessageBox(NULL, TranslateT("Failed to export public key."), TranslateT("Error"), MB_OK); // SetDlgItemText(hPubKeyEdit, IDC_PUBLIC_KEY_EDIT, tmp); } DestroyWindow(hwndDlg); @@ -1859,7 +1859,7 @@ void ImportKey() new_key_hcnt_mutex.unlock(); bool for_all_sub = false; if(metaIsProtoMetaContacts(hContact)) - if(MessageBox(0, _T("Do you want load key for all subcontacts ?"), _T("Metacontact detected"), MB_YESNO) == IDYES) + if(MessageBox(0, TranslateT("Do you want load key for all subcontacts ?"), TranslateT("Metacontact detected"), MB_YESNO) == IDYES) for_all_sub = true; if(metaIsProtoMetaContacts(hContact)) { -- cgit v1.2.3 From 8f104752a2373b6ef330f31e5aa4653ad5ba5622 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 22:31:11 +0200 Subject: modified: ../main.cpp modified: ../new_gpg.rc modified: ../new_gpg.sln modified: ../options.cpp --- main.cpp | 3 ++- new_gpg.rc | 2 +- new_gpg.sln | 0 options.cpp | 3 ++- 4 files changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 new_gpg.sln diff --git a/main.cpp b/main.cpp index f6a5e77..55b4d25 100755 --- a/main.cpp +++ b/main.cpp @@ -217,7 +217,8 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd); } { - wstring keyinfo = _T("Current private key id: "); + wstring keyinfo = TranslateT("Current private key id"); + keyinfo += _T(": "); keyinfo += (fp[0])?fp:_T("not set"); extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, keyinfo.c_str()); diff --git a/new_gpg.rc b/new_gpg.rc index 6bf6f49..e2705d7 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -150,7 +150,7 @@ CAPTION "Enter password for your secret key" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "ÎÊ",IDOK,7,87,50,14 - PUSHBUTTON "Îòìåíà",IDCANCEL,150,87,50,14 + PUSHBUTTON "Cancel",IDCANCEL,150,87,50,14 EDITTEXT IDC_PASSWORD,13,38,179,14,ES_PASSWORD | ES_AUTOHSCROLL LTEXT "Password:",IDC_STATIC,14,28,34,8 CONTROL "Save password to database",IDC_SAVE_PASSWORD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,56,124,10 diff --git a/new_gpg.sln b/new_gpg.sln old mode 100644 new mode 100755 diff --git a/options.cpp b/options.cpp index 6079dae..271a637 100755 --- a/options.cpp +++ b/options.cpp @@ -180,7 +180,8 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && bJabberAPI)); { - string keyinfo = Translate("Current private key id: "); + string keyinfo = Translate("Current private key id"); + keyinfo += ": "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); keyinfo += (strlen(keyid) > 0)?keyid:"not set"; mir_free(keyid); -- cgit v1.2.3 From 7b1295922d0becc00b6d1b8c0c91654603beb0e1 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 26 Feb 2012 23:05:39 +0200 Subject: russian translation by zummer --- new_gpg_lang_ru.txt | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 new_gpg_lang_ru.txt diff --git a/new_gpg_lang_ru.txt b/new_gpg_lang_ru.txt new file mode 100644 index 0000000..4cf3659 --- /dev/null +++ b/new_gpg_lang_ru.txt @@ -0,0 +1,115 @@ +;============================================================ +; File: new_gpg.dll +; Module: new GPG encryption plugin +; Versions: 0.0.0.11 +; URL: http://addons.miranda-im.org/details.php?action=viewfile&id=958 +; Source: git://sss.chaoslab.ru/mim_plugs.git (checkout new_gpg) +; Authors: sss +;============================================================ + +[Your GPG version is supported. The language file was found.\nGPG plugin should work fine.\nPress OK to continue.] +Âàøà âåðñèÿ GPG ïîääåðæèâàåòñÿ. ßçûêîâûå ôàéëû íàéäåíû.\nGPG Äîëæåí ðàáîòàòü íîðìàëüíî.\nÍàæìèòå ÎÊ. +[Copy own key] +Êîïèð. ñâîé êëþ÷ +[Select own key] +Âûáðàòü ñâîé êëþ÷ +[Export PubKey] +Ñîõðàíèòü êëþ÷ +[GnuPG Variables] +Ïóòè ê GPG +[Turn on debug log] +Âêë. çàïèñü îòëàäêè +[Accept] +Ïðèíÿòü +[Accept and enable encryption] +Ïðèíÿòü è âêëþ÷èòü øèôðîâàíèå +[Replace] +Çàìåíèòü +[Import key] +Èìïîðò êëþ÷à +[Load from file] +Èìïîðò èç ôàéëà +[Load other] +Çàãðóçèòü +[Delete key] +Óäàëèòü êëþ÷ +[Select existing] +Âûáðàòü ñóùåñòâóþùèé +[Turn on encryption] +Âêëþ÷èòü øèôðîâàíèå +[Import key from keyserver] +Èìïîðò êëþ÷à ñ ñåðâåðà êëþ÷åé +[New public key was received, do you want to import it?] +Ïîëó÷åí íîâûé îòðûòûé êëþ÷. Âû õîòèòå åãî ïðèíÿòü? +[There is existing key for contact, would you like to replace with new key ?] +Ïîëó÷åí êëþ÷, íî ó êîíòàêòà óæå åñòü êëþ÷. Âû õîòèòå åãî çàìåíèòü íîâûì? +[The new public key was recieved] +Ïîëó÷åí íîâûé îòðûòûé êëþ÷. +[Received key from] +Ïîëó÷åí êëþ÷ îò +[Do you want to remove key from entire metacontact (all subcontacts) ?] +Âû õîòèòå óáðàòü êëþ÷ äëÿ ìåòàêîíòàêòà (âñåõ ñóáêîíòàêòîâ)? +[Select existing public key from list] +Âûáðàòü îòêðûòûé êëþ÷ èç ñïèñêà +[Encrypt file transfers] +Øèôðîâàííàÿ ïåðåäà÷à ôàéëîâ +[Use jabber api on Miranda IM >= 0.9 (recomended)] +Èñïîëüçîâàòü jabber api åñëè Miranda IM >= 0.9 (Ðåêîìåíäóåòñÿ) +[Current private key id] +Çàêðûòûé êëþ÷ +[This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn.] +Âûáðàííûé âàìè exe íå GnuPG!\nÐåêîìåíäóåòñÿ èñïîëüçîâàòü GnuPG v1.x.x ñ ýòèì ïëàãèíîì. +[Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn.] +Âàøà âåðñèÿ GnuPG íå ïîääåðæèâàåòñÿ è ìîæåò ðàáîòàòü íå ïðàâèëüíî!\nÐåêîìåíäóåòñÿ èñïîëüçîâàòü GnuPG v1.x.x ñ ýòèì ïëàãèíîì. +[Generate key] +Ñãåíåðèðîâàòü +[Select key for use] +Âûáðàòü êëþ÷ +[Generate and use random key] +Ñãåíåðèðîâàòü è èñïîëüçîâàòü êëþ÷ +[GnuPG binary:] +Ïóòü ê exe: +[Home directory:] +Äîìàøíèé êàòàëîã: +[Turn on key autoexchange] +Âêëþ÷èòü àâòîîáìåí êëþ÷àìè +[Key type:] +Òèï êëþ÷à: +[Key length:] +Äëèííà êëþ÷à +[Key password:] +Ïàðîëü êëþ÷à: +[Real name:] +Èìÿ/Íèê: +[Comment:] +Êîììåíòàðèé: +[Expire date:] +Îêîí÷àíèå äåéñòâèÿ êëþ÷à: +[ex.: 2010-08-15] +ïðèìåð: 2010-08-15 +[From 1024 to 4096] +îò 1024 äî 4096 +[It can take a long time, be patient] +* Ýòî ìîæåò çàíÿòü íåñêîëüêî ìèíóò. +[0 - does not expire] +0 - íèêîãäà íå çàêàí÷èâàåòñÿ +[Save password to database] +Ñîõðàíèòü ïàðîëü â áàçó +[Default password] +Ïàðîëü ïî óìîë÷àíèþ +[Import] +Èìïîðòèðîâàòü +[Select keyserver for key search:] +Âûáðàòü ñåðâåð êëþ÷åé äëÿ ïîèñêà: +[Userlist:] +Ëèñò ïîëüçîâàòåëåé: +[Add tags to encoded and decoded messages] +Äîáàâëÿòü ìåòêè ê ñîîáùåíèÿì +[Incomming message tags:] +Äîáàâëÿòü ìåòêè ê âõîäÿùèì ñîîáùåíèÿì: +[Outgoing message tags:] +Äîáàâëÿòü ìåòêè èñõîäÿùèì ñîîáùåíèÿñ: +[Open:] +Íà÷àëî +[Close:] +Êîíåö -- cgit v1.2.3 From a45e3de7abee4256f415b9bb6b21d8c313d39390 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 28 Feb 2012 14:20:09 +0200 Subject: added notification "Unable to decrypt PGP encrypted message" --- messages.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/messages.cpp b/messages.cpp index e64fd53..58603a2 100755 --- a/messages.cpp +++ b/messages.cpp @@ -164,6 +164,11 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D debuglog< Date: Wed, 29 Feb 2012 04:51:39 +0200 Subject: psi gpg error handling code (not working) --- utilities.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/utilities.cpp b/utilities.cpp index b651558..efebcfb 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -970,6 +970,61 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData) { + HXML local_node = node; + HANDLE hContact = NULL; + for(int n = 0; n <= xi.getChildCount(node); n++) + { + LPCTSTR str = xi.getText(local_node); + LPCTSTR nodename = xi.getName(local_node); + if(nodename) + { + if(!_tcscmp(nodename, _T("message"))) + { + for(int n = 0; n < xi.getAttrCount(local_node); n++) + { + LPCTSTR name = xi.getAttrName(local_node, n); + LPCTSTR value = xi.getAttrValue(local_node, name); + if(!_tcscmp(name, _T("from"))) + { + hContact = ji->Sys()->ContactFromJID(value); + if(!hContact) + return FALSE; + } + if(!_tcscmp(name, _T("type"))) + { + if(_tcscmp(value, _T("error"))) + return FALSE; + } + } + } + if(!_tcscmp(nodename, _T("error"))) + { + for(int n = 0; n < xi.getAttrCount(local_node); n++) + { + LPCTSTR name = xi.getAttrName(local_node, n); + LPCTSTR value = xi.getAttrValue(local_node, name); + if(!_tcscmp(name, _T("type"))) + { + if(_tcscmp(value, _T("modify"))) + return FALSE; + } + if(!_tcscmp(name, _T("code"))) + { + if(_tcscmp(value, _T("406"))) + return FALSE; + } + } + } + if(!_tcscmp(nodename, _T("text"))) + { + LPCTSTR msg = xi.getText(local_node); + if(hContact) + HistoryLog(hContact, (char*)toUTF8(msg).c_str()); + return FALSE; + } + } + local_node = xi.getChild(node, n); + } return FALSE; } @@ -989,7 +1044,7 @@ void AddHandlers() if((*p)->getPrescenseHandler() == INVALID_HANDLE_VALUE) (*p)->setPrescenseHandler((*p)->getJabberInterface()->Net()->AddPresenceHandler((JABBER_HANDLER_FUNC)PrescenseHandler)); if((*p)->getMessageHandler() == INVALID_HANDLE_VALUE) - (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ERROR,0 ,0)); + (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ANY ,NULL,NULL)); if(bAutoExchange) { (*p)->getJabberInterface()->Net()->RegisterFeature(_T("GPG_Key_Auto_Exchange:0"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg Miranda IM plugin)")); -- cgit v1.2.3 From a1263e7ff1d2d2eecaa06c7c906cf1a15270b8f1 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Thu, 1 Mar 2012 03:41:02 +0200 Subject: modified: utilities.cpp --- utilities.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index efebcfb..f0a36fb 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -970,7 +970,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData) { - HXML local_node = node; +/* HXML local_node = node; HANDLE hContact = NULL; for(int n = 0; n <= xi.getChildCount(node); n++) { @@ -1024,7 +1024,7 @@ static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void } } local_node = xi.getChild(node, n); - } + }*/ return FALSE; } @@ -1043,8 +1043,8 @@ void AddHandlers() (*p)->setSendHandler((*p)->getJabberInterface()->Net()->AddSendHandler((JABBER_HANDLER_FUNC)SendHandler)); if((*p)->getPrescenseHandler() == INVALID_HANDLE_VALUE) (*p)->setPrescenseHandler((*p)->getJabberInterface()->Net()->AddPresenceHandler((JABBER_HANDLER_FUNC)PrescenseHandler)); - if((*p)->getMessageHandler() == INVALID_HANDLE_VALUE) - (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ANY ,NULL,NULL)); +// if((*p)->getMessageHandler() == INVALID_HANDLE_VALUE) +// (*p)->setMessageHandler((*p)->getJabberInterface()->Net()->AddMessageHandler((JABBER_HANDLER_FUNC)MessageHandler, JABBER_MESSAGE_TYPE_ANY ,NULL,NULL)); if(bAutoExchange) { (*p)->getJabberInterface()->Net()->RegisterFeature(_T("GPG_Key_Auto_Exchange:0"), _T("Indicates that gpg installed and configured to public key auto exchange (currently implemented in new_gpg Miranda IM plugin)")); -- cgit v1.2.3 From ffef21cd7a2a48d51ed40c71993b5810616d96d6 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 4 Mar 2012 17:12:13 +0200 Subject: modified: utilities.cpp --- utilities.cpp | 55 ------------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index f0a36fb..78bbca5 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -970,61 +970,6 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData) { -/* HXML local_node = node; - HANDLE hContact = NULL; - for(int n = 0; n <= xi.getChildCount(node); n++) - { - LPCTSTR str = xi.getText(local_node); - LPCTSTR nodename = xi.getName(local_node); - if(nodename) - { - if(!_tcscmp(nodename, _T("message"))) - { - for(int n = 0; n < xi.getAttrCount(local_node); n++) - { - LPCTSTR name = xi.getAttrName(local_node, n); - LPCTSTR value = xi.getAttrValue(local_node, name); - if(!_tcscmp(name, _T("from"))) - { - hContact = ji->Sys()->ContactFromJID(value); - if(!hContact) - return FALSE; - } - if(!_tcscmp(name, _T("type"))) - { - if(_tcscmp(value, _T("error"))) - return FALSE; - } - } - } - if(!_tcscmp(nodename, _T("error"))) - { - for(int n = 0; n < xi.getAttrCount(local_node); n++) - { - LPCTSTR name = xi.getAttrName(local_node, n); - LPCTSTR value = xi.getAttrValue(local_node, name); - if(!_tcscmp(name, _T("type"))) - { - if(_tcscmp(value, _T("modify"))) - return FALSE; - } - if(!_tcscmp(name, _T("code"))) - { - if(_tcscmp(value, _T("406"))) - return FALSE; - } - } - } - if(!_tcscmp(nodename, _T("text"))) - { - LPCTSTR msg = xi.getText(local_node); - if(hContact) - HistoryLog(hContact, (char*)toUTF8(msg).c_str()); - return FALSE; - } - } - local_node = xi.getChild(node, n); - }*/ return FALSE; } -- cgit v1.2.3 From bf88761455597a47f1074d01c4a29c41e0fe270c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 10 Mar 2012 21:13:22 +0200 Subject: copyrights --- clist.cpp | 2 +- commonheaders.h | 2 +- globals.h | 2 +- gpg_wrapper.cpp | 2 +- gpg_wrapper.h | 17 +++++++++++++++++ icons.cpp | 2 +- init.cpp | 4 ++-- jabber_account.cpp | 2 +- jabber_account.h | 2 +- log.cpp | 2 +- log.h | 2 +- main.cpp | 2 +- main.h | 2 +- messages.cpp | 2 +- metacontacts.cpp | 2 +- metacontacts.h | 2 +- options.cpp | 2 +- srmm.cpp | 2 +- utilities.cpp | 2 +- utilities.h | 2 +- 20 files changed, 37 insertions(+), 20 deletions(-) mode change 100644 => 100755 clist.cpp mode change 100644 => 100755 commonheaders.h mode change 100644 => 100755 globals.h mode change 100644 => 100755 gpg_wrapper.cpp mode change 100644 => 100755 gpg_wrapper.h mode change 100644 => 100755 icons.cpp mode change 100644 => 100755 jabber_account.cpp mode change 100644 => 100755 jabber_account.h mode change 100644 => 100755 log.cpp mode change 100644 => 100755 log.h mode change 100644 => 100755 main.h mode change 100644 => 100755 metacontacts.cpp mode change 100644 => 100755 metacontacts.h mode change 100644 => 100755 srmm.cpp mode change 100644 => 100755 utilities.h diff --git a/clist.cpp b/clist.cpp old mode 100644 new mode 100755 index 25c5a24..c64fb17 --- a/clist.cpp +++ b/clist.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 SecureIM developers (baloo and others), sss +// Copyright © 2010-2012 SecureIM developers (baloo and others), sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/commonheaders.h b/commonheaders.h old mode 100644 new mode 100755 index f881b9c..459d76e --- a/commonheaders.h +++ b/commonheaders.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/globals.h b/globals.h old mode 100644 new mode 100755 index cafedab..334e535 --- a/globals.h +++ b/globals.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp old mode 100644 new mode 100755 index 0a50667..a36926e --- a/gpg_wrapper.cpp +++ b/gpg_wrapper.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/gpg_wrapper.h b/gpg_wrapper.h old mode 100644 new mode 100755 index 77f84f8..87b5a55 --- a/gpg_wrapper.h +++ b/gpg_wrapper.h @@ -1,3 +1,20 @@ +// Copyright © 2010-2012 sss +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + #ifndef GPG_WRAPPER_H #define GPG_WRAPPER_H typedef enum { diff --git a/icons.cpp b/icons.cpp old mode 100644 new mode 100755 index 882f58b..58e93de --- a/icons.cpp +++ b/icons.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 SecureIM developers (baloo and others), sss +// Copyright © 2010-2012 SecureIM developers (baloo and others), sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/init.cpp b/init.cpp index 04a198a..97bc30c 100755 --- a/init.cpp +++ b/init.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010-2011 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -46,7 +46,7 @@ PLUGININFOEX pluginInfo={ "new GPG encryption support plugin, based on code from old gpg plugin and secureim", "sss", "sss123next@list.ru", - "© 2010-2011 sss", + "© 2010-2012 sss", "http://sss.chaoslab.ru/tracker/mim_plugs/", 1, //unicode 0, //doesn't replace anything built-in diff --git a/jabber_account.cpp b/jabber_account.cpp old mode 100644 new mode 100755 index 9dedd56..6a264a4 --- a/jabber_account.cpp +++ b/jabber_account.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/jabber_account.h b/jabber_account.h old mode 100644 new mode 100755 index 766f571..b643ed1 --- a/jabber_account.h +++ b/jabber_account.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/log.cpp b/log.cpp old mode 100644 new mode 100755 index 39fa89d..7618914 --- a/log.cpp +++ b/log.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/log.h b/log.h old mode 100644 new mode 100755 index 2acf09d..ed19509 --- a/log.h +++ b/log.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/main.cpp b/main.cpp index 55b4d25..abd6982 100755 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010-2011 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/main.h b/main.h old mode 100644 new mode 100755 index e4ff5f2..23627a4 --- a/main.h +++ b/main.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/messages.cpp b/messages.cpp index 58603a2..fc52aea 100755 --- a/messages.cpp +++ b/messages.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010-2011 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/metacontacts.cpp b/metacontacts.cpp old mode 100644 new mode 100755 index 46185e4..6e96ebe --- a/metacontacts.cpp +++ b/metacontacts.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 SecureIM developers (baloo and others), sss +// Copyright © 2010-2012 SecureIM developers (baloo and others), sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/metacontacts.h b/metacontacts.h old mode 100644 new mode 100755 index f7dcfe7..8b8873e --- a/metacontacts.h +++ b/metacontacts.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/options.cpp b/options.cpp index 271a637..c3c2d95 100755 --- a/options.cpp +++ b/options.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/srmm.cpp b/srmm.cpp old mode 100644 new mode 100755 index af21f8f..dd2b9d2 --- a/srmm.cpp +++ b/srmm.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 SecureIM developers (baloo and others), sss +// Copyright © 2010-2012 SecureIM developers (baloo and others), sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/utilities.cpp b/utilities.cpp index 78bbca5..f6a0290 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License diff --git a/utilities.h b/utilities.h old mode 100644 new mode 100755 index 5922311..3d9d693 --- a/utilities.h +++ b/utilities.h @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2012 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License -- cgit v1.2.3 From 05b357725cb6b52eaeea808c8570d7c7540dd059 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 14 Mar 2012 14:49:47 +0200 Subject: modified: Makefile --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index edb9668..1833903 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -CFLAGS=-g -mdll -mwindows -I../miranda-im/miranda/include/ -I./ -I/home/sss/temp/windows/libs/utf8cpp/include -D DEBUG -D _UNICODE -D UNICODE +CFLAGS=-g -mdll -mwindows -I../miranda-im/miranda/include -I./ -I/home/sss/temp/windows/libs/utf8cpp/include -D DEBUG -D _UNICODE -D UNICODE -DBOOST_SYSTEM_STATIC_LINK=1 -DBOOST_THREAD_USE_LIB CXXFLAGS=${CFLAGS} -LDFLAGS=-static-libgcc -Wl,-O1 -shared -s -Wl,--subsystem,windows,--kill-at +LDFLAGS=-static-libgcc -Wl,-O1 -shared -s -Wl,--subsystem,windows,--kill-at -lshlwapi -lcomdlg32 -lboost_system-mt -lboost_thread_win32-mt -lboost_random-mt -lboost_date_time-mt CPPFLAGS = CC=i686-pc-mingw32-gcc CXX=i686-pc-mingw32-g++ @@ -8,15 +8,16 @@ STRIP=i686-pc-mingw32-strip LD=i686-pc-mingw32-ld LNK_COMMON=-lkernel32 -MAINOBJS=init.o utilities.o main.o options.o clist.cpp clist.o srmm.o metacontacts.o messages.o log.o jabber_account.o icons.o gpg_wrapper.o +MAINOBJS=jabber_account.o clist.o init.o options.o gpg_wrapper.o srmm.o messages.o utilities.o metacontacts.o main.o log.o icons.o + WINDRES=i686-pc-mingw32-windres all: main main: $(MAINOBJS) $(WINDRES) -i new_gpg.rc -o resources.o $(CXX) $(MAINOBJS) resources.o $(LNK_COMMON) $(LDFLAGS) -o new_gpg.dll - #$(STRIP) new_gpg.dll - #upx -9 new_gpg.dll + $(STRIP) new_gpg.dll + upx --best --compress-icons=0 new_gpg.dll clean: rm *.o rm new_gpg.dll -- cgit v1.2.3 From 570935ac486f2e1f5d36ecd07216e1474603c8ce Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 18 May 2012 18:26:13 +0300 Subject: =?UTF-8?q?fixed=20(#32=20=09=D0=9D=D0=B0=D1=80=D1=83=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/options.cpp b/options.cpp index c3c2d95..71e7c0c 100755 --- a/options.cpp +++ b/options.cpp @@ -152,12 +152,12 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); - tmp = mir_a2t(tmp2); + tmp = mir_utf8decodeT(tmp2); mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); - tmp = mir_a2t(tmp2); + tmp = mir_utf8decodeT(tmp2); mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); -- cgit v1.2.3 From 365d949d8ec2712fbdec479e73e78cbbe80b3399 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 18 May 2012 22:28:05 +0300 Subject: fixed (#33 Settings) --- globals.h | 2 +- gpg_wrapper.cpp | 2 +- init.cpp | 2 +- main.cpp | 54 ++++++++++++++++++++++++++------------------ messages.cpp | 6 ++--- utilities.cpp | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- utilities.h | 3 ++- 7 files changed, 109 insertions(+), 30 deletions(-) diff --git a/globals.h b/globals.h index 334e535..e62ab24 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, gpg_configured; +extern bool bAppendTags, gpg_valid, gpg_keyexist; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/gpg_wrapper.cpp b/gpg_wrapper.cpp index a36926e..410a0d5 100755 --- a/gpg_wrapper.cpp +++ b/gpg_wrapper.cpp @@ -24,7 +24,7 @@ pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result, HANDLE hProcess, PROCESS_INFORMATION *pr) { // gpg_mutex.lock(); - if(!gpg_configured) + if(!gpg_valid) return pxNotConfigured; extern logtofile debuglog; BOOL success; diff --git a/init.cpp b/init.cpp index 97bc30c..0d2fb4b 100755 --- a/init.cpp +++ b/init.cpp @@ -33,7 +33,7 @@ UTF8_INTERFACE utfi = {0}; RECT key_from_keyserver_rect = {0}, firstrun_rect = {0}, new_key_rect = {0}, key_gen_rect = {0}, load_key_rect = {0}, import_key_rect = {0}, key_password_rect = {0}, load_existing_key_rect = {0}; XML_API xi = {0}; logtofile debuglog; -bool gpg_configured = false; +bool gpg_valid = false, gpg_keyexist = false; std::map hcontact_data; diff --git a/main.cpp b/main.cpp index abd6982..36a037f 100755 --- a/main.cpp +++ b/main.cpp @@ -226,7 +226,8 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM delete [] name; } bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange"); - gpg_configured = isGPGConfigured(); + gpg_valid = isGPGValid(); + gpg_keyexist = isGPGKeyExist(); DestroyWindow(hwndDlg); break; case IDC_OTHER: @@ -570,9 +571,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP if(_waccess(tmp, 0) == -1) { if(errno == ENOENT) - { MessageBox(0, TranslateT("wrong gpg binary location found in system.\nplease choose another location"), TranslateT("Warning"), MB_OK); - } } } } @@ -594,7 +593,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP params.out = &out; params.code = &code; params.result = &result; - gpg_configured = true; + gpg_valid = true; boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::seconds(10))) { @@ -603,7 +602,7 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP params.hProcess = NULL; debuglog<hContact, db_event(msg, 0, 0, dbflags)); return 0; } - if(bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && isGPGConfigured()) + if(bAutoExchange && strstr(msg, "-----PGP KEY REQUEST-----") && gpg_valid && gpg_keyexist) { char *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); if(tmp[0]) @@ -557,7 +557,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) DBWriteContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 1); } mir_free(tmp); - if(!isContactHaveKey(ccs->hContact) && bAutoExchange && isGPGConfigured()) + if(!isContactHaveKey(ccs->hContact) && bAutoExchange && gpg_valid && gpg_keyexist) { LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); DWORD uin = DBGetContactSettingDword(ccs->hContact, proto, "UIN", 0); @@ -802,7 +802,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); if(!isContactHaveKey(ccs->hContact)) { - if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && isGPGConfigured()) + if(bAutoExchange && !strstr(msg, "-----PGP KEY REQUEST-----") && !strstr(msg, "-----BEGIN PGP PUBLIC KEY BLOCK-----") && gpg_valid) { void send_encrypted_msgs_thread(HANDLE hContact); LPSTR proto = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)ccs->hContact, 0); diff --git a/utilities.cpp b/utilities.cpp index f6a0290..0648c37 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1033,7 +1033,7 @@ bool isContactHaveKey(HANDLE hContact) return false; } -bool isGPGConfigured() +bool isGPGKeyExist() { TCHAR *id = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", _T("")); char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); @@ -1047,6 +1047,74 @@ bool isGPGConfigured() mir_free(key); return false; } +bool isGPGValid() +{ + TCHAR *tmp; + bool gpg_exists = false, is_valid = true; + tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("")); + if(_waccess(tmp, 0) != -1) + gpg_exists = true; + else + { + mir_free(tmp); + TCHAR *path = new TCHAR [MAX_PATH]; + char *mir_path = new char [MAX_PATH]; + CallService(MS_UTILS_PATHTOABSOLUTE, (WPARAM)"\\", (LPARAM)mir_path); + SetCurrentDirectoryA(mir_path); + tmp = mir_a2t(mir_path); + mir_free(mir_path); + mir_realloc(path, (_tcslen(path)+128)*sizeof(TCHAR)); + TCHAR *gpg_path = new TCHAR [MAX_PATH]; + _tcscpy(gpg_path, tmp); + _tcscat(gpg_path, _T("\\GnuPG\\gpg.exe")); + mir_free(tmp); + if(_waccess(gpg_path, 0) != -1) + { + gpg_exists = true; + _tcscpy(path, _T("GnuPG\\gpg.exe")); + } + mir_free(gpg_path); + tmp = mir_wstrdup(path); + delete [] path; + } + DWORD len = MAX_PATH; + if(gpg_exists) + { + DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp); + string out; + DWORD code; + wstring cmd = _T("--version"); + gpg_execution_params params; + pxResult result; + params.cmd = &cmd; + params.useless = ""; + params.out = &out; + params.code = &code; + params.result = &result; + gpg_valid = true; + boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); + if(!gpg_thread.timed_join(boost::posix_time::seconds(10))) + { + gpg_thread.~thread(); + TerminateProcess(params.hProcess, 1); + params.hProcess = NULL; + debuglog< Date: Sat, 19 May 2012 00:49:42 +0300 Subject: =?UTF-8?q?fixed=20(#32=20=D0=9D=D0=B0=D1=80=D1=83=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=B4=D0=B8=D1=80=D0=BE=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0)=20again=20...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/options.cpp b/options.cpp index 71e7c0c..45f56d5 100755 --- a/options.cpp +++ b/options.cpp @@ -151,14 +151,10 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); - tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); - tmp = mir_utf8decodeT(tmp2); - mir_free(tmp2); + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); - tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); - tmp = mir_utf8decodeT(tmp2); - mir_free(tmp2); + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); if(DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) -- cgit v1.2.3 From 9026615fea720ca69d3a3480a69e32e5432db69b Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 19 May 2012 01:43:48 +0300 Subject: fixed one more metacontacts problem added option to remove own tags in outgoing messages (useful to quote) --- globals.h | 2 +- init.cpp | 3 ++- messages.cpp | 12 ++++++++++++ metacontacts.cpp | 6 +++--- new_gpg.rc | 2 ++ options.cpp | 2 ++ resource.h | 4 +++- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/globals.h b/globals.h index e62ab24..1d7c9e4 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, gpg_valid, gpg_keyexist; +extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/init.cpp b/init.cpp index 0d2fb4b..5c1f11d 100755 --- a/init.cpp +++ b/init.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" //global variables -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false; +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false; TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; list Accounts; @@ -85,6 +85,7 @@ int SendKey(WPARAM w, LPARAM l); void init_vars() { bAppendTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bAppendTags", 0); + bStripTags = DBGetContactSettingByte(NULL, szGPGModuleName, "bStripTags", 0); inopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("")); inclosetag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInCloseTag", _T("")); outopentag = UniGetContactSettingUtf(NULL, szGPGModuleName, "szOutOpenTag", _T("")); diff --git a/messages.cpp b/messages.cpp index 74d0c44..6e69a2a 100755 --- a/messages.cpp +++ b/messages.cpp @@ -627,6 +627,18 @@ int SendMsgSvc_func(HANDLE hContact, char *msg, DWORD flags) str.append(tmp); mir_free(tmp); } + if(bStripTags && bAppendTags) + { + std::wstring::size_type p; + for(p = str.find(inopentag); p != std::wstring::npos; p = str.find(inopentag)) + str.erase(p, _tcslen(inopentag)); + for(p = str.find(inclosetag); p != std::wstring::npos; p = str.find(inclosetag)) + str.erase(p, _tcslen(inclosetag)); + for(p = str.find(outopentag); p != std::wstring::npos; p = str.find(outopentag)) + str.erase(p, _tcslen(outopentag)); + for(p = str.find(outclosetag); p != std::wstring::npos; p = str.find(outclosetag)) + str.erase(p, _tcslen(outclosetag)); + } /* for(std::wstring::size_type i = str.find(_T("\r\n")); i != std::wstring::npos; i = str.find(_T("\r\n"), i+1)) str.replace(i, 2, _T("\n")); */ string out; diff --git a/metacontacts.cpp b/metacontacts.cpp index 6e96ebe..1abc2aa 100755 --- a/metacontacts.cpp +++ b/metacontacts.cpp @@ -44,7 +44,7 @@ HANDLE metaGetContact(HANDLE hContact) if(bMetaContacts) if(metaIsSubcontact(hContact)) return (HANDLE)CallService(MS_MC_GETMETACONTACT,(WPARAM)hContact,0); - return hContact; + return NULL; } bool metaIsSubcontact(HANDLE hContact) { @@ -60,7 +60,7 @@ HANDLE metaGetMostOnline(HANDLE hContact) if(bMetaContacts) if(metaIsProtoMetaContacts(hContact)) return (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT,(WPARAM)hContact,0); - return hContact; + return NULL; } HANDLE metaGetDefault(HANDLE hContact) { @@ -68,7 +68,7 @@ HANDLE metaGetDefault(HANDLE hContact) if(bMetaContacts) if(metaIsProtoMetaContacts(hContact)) return (HANDLE)CallService(MS_MC_GETDEFAULTCONTACT,(WPARAM)hContact,0); - return hContact; + return NULL; } diff --git a/new_gpg.rc b/new_gpg.rc index e2705d7..6ebf7ad 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -356,6 +356,8 @@ BEGIN EDITTEXT IDC_OUT_CLOSE_TAG,151,46,90,14,ES_AUTOHSCROLL RTEXT "Open:",IDC_STATIC,13,49,26,8 RTEXT "Close:",IDC_STATIC,127,49,23,8 + CONTROL "Strip all tags in outgoing messages",IDC_STRIP_TAGS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,76,233,10 END diff --git a/options.cpp b/options.cpp index 45f56d5..8efc0c2 100755 --- a/options.cpp +++ b/options.cpp @@ -599,6 +599,7 @@ static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { TranslateDialogDefault(hwndDlg); CheckStateLoadDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags", 0); + CheckStateLoadDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags", 0); { TCHAR *tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szInOpenTag", _T("")); SetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp); @@ -639,6 +640,7 @@ static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case PSN_APPLY: { bAppendTags = CheckStateStoreDB(hwndDlg, IDC_APPEND_TAGS, "bAppendTags"); + bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags"); { TCHAR tmp[128]; GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128); diff --git a/resource.h b/resource.h index b7900a0..332e2d3 100755 --- a/resource.h +++ b/resource.h @@ -74,6 +74,8 @@ #define IDC_AUT_EXCHANGE 1065 #define IDC_BUTTON3 1066 #define IDC_COPY_KEY 1066 +#define IDC_CHECK1 1067 +#define IDC_STRIP_TAGS 1067 // Next default values for new objects // @@ -81,7 +83,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 114 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1067 +#define _APS_NEXT_CONTROL_VALUE 1068 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3 From 093731d35e605ede9798ace4ac73c77a51012a6c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 20 May 2012 07:24:29 +0300 Subject: metacontacts fixes --- icons.cpp | 4 ++-- messages.cpp | 10 +++++----- srmm.cpp | 8 ++++---- utilities.cpp | 7 +++++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/icons.cpp b/icons.cpp index 58e93de..58a24c9 100755 --- a/icons.cpp +++ b/icons.cpp @@ -104,9 +104,9 @@ void setClistIcon(HANDLE hContact) } } -void setSrmmIcon(HANDLE hContact) +void setSrmmIcon(HANDLE h) { - hContact = metaGetMostOnline(hContact); + HANDLE hContact = metaIsProtoMetaContacts(h)?metaGetMostOnline(h):h; bool enabled = isContactSecured(hContact); HANDLE hMC = hContact; if(metaIsSubcontact(hContact)) diff --git a/messages.cpp b/messages.cpp index 6e69a2a..db4e404 100755 --- a/messages.cpp +++ b/messages.cpp @@ -54,13 +54,13 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D } else { - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } if(isContactHaveKey(hContact)) { - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 1); setSrmmIcon(hContact); setClistIcon(hContact); } @@ -99,7 +99,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D wstring cmd; cmd += _T("--batch "); { - char *inkeyid = UniGetContactSettingUtf(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", ""); + char *inkeyid = UniGetContactSettingUtf(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", ""); TCHAR *pass = NULL; if(inkeyid[0]) { @@ -195,7 +195,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(metaGetMostOnline(hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + DBWriteContactSettingString(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); @@ -352,7 +352,7 @@ int RecvMsgSvc_func(HANDLE hContact, std::wstring str, char *msg, DWORD flags, D } } } - if(DBGetContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", 0)) + if(DBGetContactSettingByte(metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact, szGPGModuleName, "GPGEncryption", 0)) { if(metaIsSubcontact(hContact)) { diff --git a/srmm.cpp b/srmm.cpp index dd2b9d2..763134a 100755 --- a/srmm.cpp +++ b/srmm.cpp @@ -34,7 +34,7 @@ int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; - HANDLE hMeta = hContact; + HANDLE hMeta = NULL; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå else if(metaIsSubcontact(hContact)) @@ -50,7 +50,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { if(enc) { DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); - DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 0); + hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 0):0; setSrmmIcon(hContact); setClistIcon(hContact); } @@ -68,7 +68,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { else { DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); - DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1); + hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0; setSrmmIcon(hContact); setClistIcon(hContact); return 0; @@ -76,7 +76,7 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { if(isContactHaveKey(hContact)) { DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); - DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1); + hMeta?DBWriteContactSettingByte(hMeta, szGPGModuleName, "GPGEncryption", 1):0; setSrmmIcon(hContact); setClistIcon(hContact); } diff --git a/utilities.cpp b/utilities.cpp index 0648c37..67e0238 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -234,7 +234,7 @@ int ToggleEncryption(WPARAM w, LPARAM l) } } else - DBWriteContactSettingByte(metaGetMostOnline(hContact), szGPGModuleName, "GPGEncryption", enc?0:1); + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", enc?0:1); void setSrmmIcon(HANDLE hContact); void setClistIcon(HANDLE hContact); setSrmmIcon(hContact); @@ -393,7 +393,10 @@ int onProtoAck(WPARAM w, LPARAM l) s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - DBWriteContactSettingString(metaGetMostOnline(ccs->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + if(metaIsProtoMetaContacts(ccs->hContact)) + DBWriteContactSettingString(metaGetMostOnline(ccs->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + else + DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); -- cgit v1.2.3 From bad201c5132117e8b227021b12ff9e5377a98496 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 20 May 2012 15:48:24 +0300 Subject: fixed utf8 encoding in key list (finally ...) --- options.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/options.cpp b/options.cpp index 8efc0c2..0e952b7 100755 --- a/options.cpp +++ b/options.cpp @@ -151,10 +151,20 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 1, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); - tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); + char *tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", ""); + if(!toUTF16(tmp2).empty()) + tmp = mir_wstrdup(toUTF16(tmp2).c_str()); + else + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainName", _T("")); + mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 2, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); - tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); + tmp2 = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", ""); + if(!toUTF16(tmp2).empty()) + tmp = mir_wstrdup(toUTF16(tmp2).c_str()); + else + tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyMainEmail", _T("")); + mir_free(tmp2); ListView_SetItemText(hwndList, iRow, 3, (_tcslen(tmp) > 1)?tmp:_T("not set")); mir_free(tmp); if(DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)) -- cgit v1.2.3 From 829c3778ac700f2d64e7032d0727f860196e4417 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 21 May 2012 00:38:28 +0300 Subject: fixed another metacontacts problem --- globals.h | 2 +- init.cpp | 5 +++-- srmm.cpp | 3 +++ utilities.cpp | 25 +++++++++++++++++++++++++ utilities.h | 1 + 5 files changed, 33 insertions(+), 3 deletions(-) diff --git a/globals.h b/globals.h index 1d7c9e4..f531cf1 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist; +extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/init.cpp b/init.cpp index 5c1f11d..49f372a 100755 --- a/init.cpp +++ b/init.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" //global variables -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false; +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; list Accounts; @@ -110,16 +110,17 @@ void init_vars() new_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "NewKeyWindowY", 0); load_existing_key_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowX", 0); load_existing_key_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "LoadExistingKeyWindowY", 0); + tabsrmm_used = isTabsrmmUsed(); } extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) { pluginLink=link; - init_vars(); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); mir_getMMI(&mmi); mir_getUTFI(&utfi); mir_getXI(&xi); //TODO: check if we have access to api + init_vars(); CreateServiceFunction("/LoadPubKey",(MIRANDASERVICE)LoadKey); CreateServiceFunction("/ToggleEncryption",(MIRANDASERVICE)ToggleEncryption); CreateServiceFunction("/SendKey",(MIRANDASERVICE)SendKey); diff --git a/srmm.cpp b/srmm.cpp index 763134a..6fc204a 100755 --- a/srmm.cpp +++ b/srmm.cpp @@ -36,7 +36,10 @@ int __cdecl onIconPressed(WPARAM wParam, LPARAM lParam) { HANDLE hContact = (HANDLE)wParam; HANDLE hMeta = NULL; if(metaIsProtoMetaContacts(hContact)) + { + hMeta = hContact; hContact = metaGetMostOnline(hContact); // âîçüìåì òîò, ÷åðåç êîòîðûé ïîéäåò ñîîáùåíèå + } else if(metaIsSubcontact(hContact)) hMeta = metaGetContact(hContact); StatusIconClickData *sicd = (StatusIconClickData *)lParam; diff --git a/utilities.cpp b/utilities.cpp index 67e0238..c52edde 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1280,3 +1280,28 @@ string time_str() boost::posix_time::ptime now = boost::posix_time::second_clock::local_time(); return (string)boost::posix_time::to_simple_string(now); } + +int handleEnum(const char *szSetting, LPARAM lParam) +{ + if(szSetting[0] && StriStr(szSetting, "tabsrmm")) + { + bool f = false, *found = (bool*)lParam; + f = !DBGetContactSettingByte(NULL, "PluginDisable", szSetting, 0); + if(f) + *found = f; + } + return 0; +} + +bool isTabsrmmUsed() +{ + DBCONTACTENUMSETTINGS enm = {0}; + bool found = false; + enm.lParam = (LPARAM)&found; + enm.pfnEnumProc = (DBSETTINGENUMPROC)&handleEnum; + enm.szModule = "PluginDisable"; + if(CallService(MS_DB_CONTACT_ENUMSETTINGS, (WPARAM)NULL, (LPARAM)&enm) == -1) + return false; + + return found; +} diff --git a/utilities.h b/utilities.h index f27dfca..30e9f68 100755 --- a/utilities.h +++ b/utilities.h @@ -27,6 +27,7 @@ void storeOutput(HANDLE ahandle, string *output); int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data); bool isContactSecured(HANDLE hContact); bool isContactHaveKey(HANDLE hContact); +bool isTabsrmmUsed(); bool isGPGKeyExist(); bool isGPGValid(); const bool StriStr(const char *str, const char *substr); -- cgit v1.2.3 From 9f3797b01596d50ad2df063c1860eb3a5eb0b8e0 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 25 May 2012 17:42:34 +0300 Subject: fixed tabsrmm detection --- utilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities.cpp b/utilities.cpp index c52edde..1d0cde2 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1283,7 +1283,7 @@ string time_str() int handleEnum(const char *szSetting, LPARAM lParam) { - if(szSetting[0] && StriStr(szSetting, "tabsrmm")) + if(!*(bool*)lParam && szSetting[0] && StriStr(szSetting, "tabsrmm")) { bool f = false, *found = (bool*)lParam; f = !DBGetContactSettingByte(NULL, "PluginDisable", szSetting, 0); -- cgit v1.2.3 From 072e6741acb7323279beaf516107a5d09d91cf09 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 28 May 2012 02:54:36 +0300 Subject: keys export //TODO: keys import --- init.cpp | 23 ++++++- utilities.cpp | 193 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 215 insertions(+), 1 deletion(-) diff --git a/init.cpp b/init.cpp index 49f372a..5388f0f 100755 --- a/init.cpp +++ b/init.cpp @@ -23,7 +23,7 @@ TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = list Accounts; HINSTANCE hInst; -HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL; +HANDLE hLoadPubKey = NULL, hToggleEncryption = NULL, hOnPreBuildContactMenu = NULL, hSendKey = NULL, g_hCLIcon = NULL, hExportGpgKeys = NULL, hImportGpgKeys = NULL; PLUGINLINK *pluginLink; IconExtraColumn g_IEC = {0}; static int OnModulesLoaded(WPARAM wParam,LPARAM lParam); @@ -81,6 +81,8 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) int LoadKey(WPARAM w, LPARAM l); int ToggleEncryption(WPARAM w, LPARAM l); int SendKey(WPARAM w, LPARAM l); +int ExportGpGKeys(WPARAM w, LPARAM l); +int ImportGpGKeys(WPARAM w, LPARAM l); void init_vars() { @@ -124,6 +126,8 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) CreateServiceFunction("/LoadPubKey",(MIRANDASERVICE)LoadKey); CreateServiceFunction("/ToggleEncryption",(MIRANDASERVICE)ToggleEncryption); CreateServiceFunction("/SendKey",(MIRANDASERVICE)SendKey); + CreateServiceFunction("/ExportGPGKeys",(MIRANDASERVICE)ExportGpGKeys); + CreateServiceFunction("/ImportGPGKeys",(MIRANDASERVICE)ImportGpGKeys); CLISTMENUITEM mi = {0}; mi.cbSize=sizeof(mi); mi.position=-0x7FFFFFFF; @@ -148,6 +152,23 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) mi.pszName="Send public key"; mi.pszService="/SendKey"; hSendKey = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM,0,(LPARAM)&mi); + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFF; + mi.flags=0; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.pszName="Export GPG Public keys from all users"; + mi.pszService="/ExportGPGKeys"; + hExportGpgKeys = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + ZeroMemory(&mi,sizeof(mi)); + mi.cbSize=sizeof(mi); + mi.position=-0x7FFFFFFF; + mi.flags=0; + mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + mi.pszName="Import GPG Public keys from all users"; + mi.pszService="/ImportGPGKeys"; + hImportGpgKeys = (HANDLE)CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); + return 0; } diff --git a/utilities.cpp b/utilities.cpp index 1d0cde2..af4eb3b 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1305,3 +1305,196 @@ bool isTabsrmmUsed() return found; } + + +int ExportGpGKeys(WPARAM w, LPARAM l) +{ + TCHAR *p = GetFilePath(_T("Choose file to export public keys"), _T("*"), _T("Any file"), true); + if(!p || !p[0]) + { + delete [] p; + //TODO: handle error + return 1; + } + char *path = mir_t2a(p); + delete [] p; + std::ofstream file; + file.open(path, std::ios::trunc | std::ios::out); + mir_free(path); + if(!file.is_open()) + return 1; //TODO: handle error + for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + { + char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); + if(!k[0]) + { + mir_free(k); + continue; + } + std::string key = k; + mir_free(k); + + const char* proto = (const char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + std::string id = "Comment: login "; + const char * uid = (const char*)CallProtoService(proto, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + DBVARIANT dbv = {0}; + DBCONTACTGETSETTING dbcgs = {0}; + dbcgs.pValue = &dbv; + dbcgs.szModule = proto; + dbcgs.szSetting = uid; + CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&dbcgs); + switch(dbcgs.pValue->type) + { + case DBVT_DELETED: + continue; + break; + case DBVT_BYTE: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->bVal); + id += _id; + } + break; + case DBVT_WORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->wVal); + id += _id; + } + break; + case DBVT_DWORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->dVal); + id += _id; + } + break; + case DBVT_ASCIIZ: + { + id += dbcgs.pValue->pszVal; + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + } + break; + case DBVT_UTF8: + { + char *tmp = mir_utf8decodeA(dbcgs.pValue->pszVal); + if(tmp[0]) + id += tmp; + mir_free(tmp); + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + } + break; + case DBVT_BLOB: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + case DBVT_WCHAR: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + } + id += " contact_id "; + ZeroMemory(&dbv, sizeof(dbv)); + ZeroMemory(&dbcgs, sizeof(dbcgs)); + dbcgs.pValue = &dbv; + dbcgs.szModule = proto; + dbcgs.szSetting = uid; + CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs); + switch(dbcgs.pValue->type) + { + case DBVT_DELETED: + continue; + break; + case DBVT_BYTE: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->bVal); + id += _id; + } + break; + case DBVT_WORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->wVal); + id += _id; + } + break; + case DBVT_DWORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->dVal); + id += _id; + } + break; + case DBVT_ASCIIZ: + { + id += dbcgs.pValue->pszVal; + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + } + break; + case DBVT_UTF8: + { + char *tmp = mir_utf8decodeA(dbcgs.pValue->pszVal); + if(tmp[0]) + id += tmp; + mir_free(tmp); + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + } + break; + case DBVT_BLOB: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + case DBVT_WCHAR: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + } + + std::string::size_type p1 = key.find("-----BEGIN PGP PUBLIC KEY BLOCK-----"); + if(p1 == std::string::npos) + continue; + p1 += strlen("-----BEGIN PGP PUBLIC KEY BLOCK-----"); + p1 ++; + id += '\n'; + key.insert(p1, id); + file< Date: Mon, 28 May 2012 02:58:17 +0300 Subject: modified: utilities.cpp --- utilities.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utilities.cpp b/utilities.cpp index af4eb3b..1353ae0 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1487,10 +1487,12 @@ int ImportGpGKeys(WPARAM w, LPARAM l) return 1; //TODO: handle error std::string key, login, contact; key += line; + key += '\n'; while(file.is_open()) { file.getline(line, 255); key += line; + key += '\n'; if(strstr(line, "-----END PGP PUBLIC KEY BLOCK-----")) { //TODO: parse key key.clear(); -- cgit v1.2.3 From 31321966cc6b6008ba84236ba87748aa46a347ed Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 28 May 2012 13:53:01 +0300 Subject: keys import in progress --- utilities.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index 1353ae0..25d29c1 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1468,7 +1468,7 @@ int ExportGpGKeys(WPARAM w, LPARAM l) int ImportGpGKeys(WPARAM w, LPARAM l) { - TCHAR *p = GetFilePath(_T("Choose file to export import keys from"), _T("*"), _T("Any file")); + TCHAR *p = GetFilePath(_T("Choose file to import keys from"), _T("*"), _T("Any file")); if(!p || !p[0]) { delete [] p; @@ -1485,18 +1485,34 @@ int ImportGpGKeys(WPARAM w, LPARAM l) file.getline(line, 255); if(!strstr(line, "-----BEGIN PGP PUBLIC KEY BLOCK-----")) return 1; //TODO: handle error - std::string key, login, contact; + std::string key, login, contact_id; key += line; key += '\n'; - while(file.is_open()) + while(file.is_open() && !file.eof()) { file.getline(line, 255); key += line; key += '\n'; if(strstr(line, "-----END PGP PUBLIC KEY BLOCK-----")) { //TODO: parse key + std::string::size_type p1 = 0, p2 = 0; + p1 = key.find("Comment: login "); + p1 += strlen("Comment: login "); + p2 = key.find(" contact_id "); + login = key.substr(p1, p2-p1); + p2 += strlen(" contact_id "); + p1 = key.find("\n", p2); + contact_id = key.substr(p2, p1-p2); + p1 = key.find("Comment: login "); + p2 = key.find("\n", p1); + p2++; + key.erase(p1, p2-p1); + + key.clear(); } } + if(file.is_open()) + file.close(); return 0; } \ No newline at end of file -- cgit v1.2.3 From e321f6795124cc95aab0e194600f88d97aca5f45 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 28 May 2012 20:34:08 +0300 Subject: working key export/import --- utilities.cpp | 323 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 300 insertions(+), 23 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index 25d29c1..26354ea 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -1321,9 +1321,10 @@ int ExportGpGKeys(WPARAM w, LPARAM l) std::ofstream file; file.open(path, std::ios::trunc | std::ios::out); mir_free(path); + int exported_keys = 0; if(!file.is_open()) return 1; //TODO: handle error - for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) { char *k = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", ""); if(!k[0]) @@ -1400,7 +1401,7 @@ int ExportGpGKeys(WPARAM w, LPARAM l) dbcgs.szModule = proto; dbcgs.szSetting = uid; CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs); - switch(dbcgs.pValue->type) + switch(dbcgs.pValue->type) { case DBVT_DELETED: continue; @@ -1450,7 +1451,6 @@ int ExportGpGKeys(WPARAM w, LPARAM l) CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); break; } - std::string::size_type p1 = key.find("-----BEGIN PGP PUBLIC KEY BLOCK-----"); if(p1 == std::string::npos) continue; @@ -1460,9 +1460,13 @@ int ExportGpGKeys(WPARAM w, LPARAM l) key.insert(p1, id); file<szModuleName, PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + DBVARIANT dbv = {0}; + DBCONTACTGETSETTING dbcgs = {0}; + dbcgs.pValue = &dbv; + dbcgs.szModule = accs[i]->szModuleName; + dbcgs.szSetting = uid; + CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&dbcgs); + std::string id; + switch(dbcgs.pValue->type) + { + case DBVT_DELETED: + continue; + break; + case DBVT_BYTE: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->bVal); + id += _id; + if(id == login) + acc = accs[i]->szModuleName; + } + break; + case DBVT_WORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->wVal); + id += _id; + if(id == login) + acc = accs[i]->szModuleName; + } + break; + case DBVT_DWORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->dVal); + id += _id; + if(id == login) + acc = accs[i]->szModuleName; + } + break; + case DBVT_ASCIIZ: + { + id += dbcgs.pValue->pszVal; + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + if(id == login) + acc = accs[i]->szModuleName; + } + break; + case DBVT_UTF8: + { + char *tmp = mir_utf8decodeA(dbcgs.pValue->pszVal); + if(tmp[0]) + id += tmp; + mir_free(tmp); + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + if(id == login) + acc = accs[i]->szModuleName; + } + break; + case DBVT_BLOB: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + case DBVT_WCHAR: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + } } + if(acc.length()) + { + const char * uid = (const char*)CallProtoService(acc.c_str(), PS_GETCAPS, (WPARAM)PFLAG_UNIQUEIDSETTING, 0); + for(HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, (LPARAM)acc.c_str()); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, (LPARAM)acc.c_str())) + { + DBVARIANT dbv = {0}; + DBCONTACTGETSETTING dbcgs = {0}; + dbcgs.pValue = &dbv; + dbcgs.szModule = acc.c_str(); + dbcgs.szSetting = uid; + CallService(MS_DB_CONTACT_GETSETTING, (WPARAM)hContact, (LPARAM)&dbcgs); + std::string id; + bool found = false; + switch(dbcgs.pValue->type) + { + case DBVT_DELETED: + continue; + break; + case DBVT_BYTE: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->bVal); + id += _id; + if(id == contact_id) + found = true; + } + break; + case DBVT_WORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->wVal); + id += _id; + if(id == contact_id) + found = true; + } + break; + case DBVT_DWORD: + { + char _id[64]; + mir_snprintf(_id, 63, "%d", dbcgs.pValue->dVal); + id += _id; + if(id == contact_id) + found = true; + } + break; + case DBVT_ASCIIZ: + { + id += dbcgs.pValue->pszVal; + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + if(id == contact_id) + found = true; + } + break; + case DBVT_UTF8: + { + char *tmp = mir_utf8decodeA(dbcgs.pValue->pszVal); + if(tmp[0]) + id += tmp; + mir_free(tmp); + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + if(id == contact_id) + found = true; + } + break; + case DBVT_BLOB: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + case DBVT_WCHAR: + //TODO + CallService(MS_DB_CONTACT_FREEVARIANT, 0, (LPARAM)&dbv); + break; + } + if(found) + { + wstring cmd; + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + string output; + DWORD exitcode; + { + HANDLE hcnt = hContact; + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + _tcscpy(tmp2, ptmp); + mir_free(ptmp); + _tcscat(tmp2, _T("\\")); + _tcscat(tmp2, _T("temporary_exported.asc")); + DeleteFile(tmp2); + wfstream f(tmp2, std::ios::out); + f< output.find("<", s)) + s2 = output.find("<", s); + if(s2 != string::npos) + { + tmp2 = new char [output.substr(s,s2-s-1).length()+1]; + strcpy(tmp2, output.substr(s,s2-s-1).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + mir_free(tmp2); + if((s = output.find(")", s2)) == string::npos) + s = output.find(">", s2); + else if(s > output.find(">", s2)) + s = output.find(">", s2); + s2++; + if(output[s] == ')') + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + s+=3; + s2 = output.find(">", s); + tmp2 = new char [output.substr(s,s2-s).length()+1]; + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + mir_free(tmp2); + } + else + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + } + } + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str()); + } + DeleteFile(tmp2); + break; + } + } + } + key.clear(); + } } if(file.is_open()) file.close(); + char msg[512]; + mir_snprintf(msg, 511, "we have succesfully processed %d keys", processed_keys); + MessageBoxA(NULL, msg, Translate("Keys import result"), MB_OK); return 0; } \ No newline at end of file -- cgit v1.2.3 From 7b7229fd6fa8df0fbe52f82aa7b08354ddda76ba Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 06:54:03 +0300 Subject: option to disable prescense subscription metacontacts fix --- globals.h | 2 +- init.cpp | 3 +- messages.cpp | 4 +- new_gpg.rc | 13 ++++ options.cpp | 51 +++++++++++++ resource.h | 6 +- utilities.cpp | 231 +++++++++++++++++++++++++++++----------------------------- 7 files changed, 189 insertions(+), 121 deletions(-) diff --git a/globals.h b/globals.h index f531cf1..3aeb8ad 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; +extern bool bAppendTags, bPrescenseSubscription, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/init.cpp b/init.cpp index 5388f0f..8da20b2 100755 --- a/init.cpp +++ b/init.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" //global variables -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; +bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPrescenseSubscription = false, bIsMiranda09 = false, bMetaContacts = false, bFileTransfers = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; list Accounts; @@ -97,6 +97,7 @@ void init_vars() password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); debuglog.init(); bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0); + bPrescenseSubscription = DBGetContactSettingByte(NULL, szGPGModuleName, "bPrescenseSubscription", 1); bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1); firstrun_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", 0); firstrun_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", 0); diff --git a/messages.cpp b/messages.cpp index db4e404..18b2378 100755 --- a/messages.cpp +++ b/messages.cpp @@ -875,7 +875,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) return CallService(MS_PROTO_CHAINSEND, w, l); } } - if(metaIsProtoMetaContacts(ccs->hContact) || !isContactSecured(ccs->hContact)) + if(!isContactSecured(ccs->hContact) || metaIsProtoMetaContacts(ccs->hContact)) { mir_free(msg); return CallService(MS_PROTO_CHAINSEND, w, l); @@ -917,6 +917,8 @@ int HookSendMsg(WPARAM w, LPARAM l) } event_processing_mutex.unlock(); } + if(metaIsProtoMetaContacts(hContact) && !isContactSecured(metaGetMostOnline(hContact))) + return 0; return 1; } if(!isContactSecured(hContact)) diff --git a/new_gpg.rc b/new_gpg.rc index 6ebf7ad..66dda83 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -360,6 +360,14 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,3,76,233,10 END +IDD_OPT_GPG_ADVANCED DIALOGEX 0, 0, 286, 214 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +FONT 8, "MS Shell Dlg", 400, 0, 0x0 +BEGIN + CONTROL "Turn on prescense subscription (Jabber)",IDC_PRESCENSE_SUBSCRIPTION, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,9,190,10 +END + ///////////////////////////////////////////////////////////////////////////// // @@ -380,6 +388,11 @@ BEGIN IDD_OPT_GPG_MESSAGES, DIALOG BEGIN END + + IDD_OPT_GPG_ADVANCED, DIALOG + BEGIN + VERTGUIDE, 12 + END END #endif // APSTUDIO_INVOKED diff --git a/options.cpp b/options.cpp index 0e952b7..2b8fce1 100755 --- a/options.cpp +++ b/options.cpp @@ -21,6 +21,7 @@ extern HINSTANCE hInst; static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); +static BOOL CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); BOOL CheckStateLoadDB(HWND hwndDlg, int idCtrl, const char* szSetting, BYTE bDef) { @@ -74,6 +75,18 @@ int GpgOptInit(WPARAM wParam,LPARAM lParam) odp.pfnDlgProc = (DLGPROC)DlgProcGpgMsgOpts; CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp); + ZeroMemory(&odp, sizeof(odp)); + + odp.cbSize = sizeof(odp); + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GPG_ADVANCED); + odp.pszTitle = szGPGModuleName; + odp.pszGroup = "Services"; + odp.pszTab = "Advanced"; + odp.flags=ODPF_BOLDGROUPS | ODPF_EXPERTONLY; + odp.pfnDlgProc = (DLGPROC)DlgProcGpgAdvOpts; + CallService(MS_OPT_ADDPAGE,wParam,(LPARAM)&odp); + return 0; } @@ -683,6 +696,44 @@ static BOOL CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP return FALSE; } +static BOOL CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + extern bool bJabberAPI; + TranslateDialogDefault(hwndDlg); + CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPrescenseSubscription", 1); + EnableWindow(GetDlgItem(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION), bJabberAPI); + + return TRUE; + } + + + case WM_COMMAND: + { + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + } + + case WM_NOTIFY: + { + switch (((LPNMHDR)lParam)->code) + { + + case PSN_APPLY: + { + bPrescenseSubscription = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPrescenseSubscription"); + return TRUE; + } + } + } + break; + } + return FALSE; +} + HWND hPubKeyEdit = NULL; diff --git a/resource.h b/resource.h index 332e2d3..77189f8 100755 --- a/resource.h +++ b/resource.h @@ -15,6 +15,7 @@ #define IDI_SECURED 112 #define IDD_IMPORT_KEY 112 #define IDI_UNSECURED 113 +#define IDD_OPT_GPG_ADVANCED 113 #define IDC_SET_BIN_PATH 1016 #define IDC_SET_HOME_DIR 1017 #define IDC_BIN_PATH 1018 @@ -74,8 +75,9 @@ #define IDC_AUT_EXCHANGE 1065 #define IDC_BUTTON3 1066 #define IDC_COPY_KEY 1066 -#define IDC_CHECK1 1067 #define IDC_STRIP_TAGS 1067 +#define IDC_CHECK1 1068 +#define IDC_PRESCENSE_SUBSCRIPTION 1068 // Next default values for new objects // @@ -83,7 +85,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 114 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1068 +#define _APS_NEXT_CONTROL_VALUE 1069 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/utilities.cpp b/utilities.cpp index 26354ea..56f7ccb 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -716,7 +716,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU return FALSE; } } - if(nodename) + if(bPrescenseSubscription && nodename) { if(_tcsstr(nodename, _T("status"))) { @@ -1663,121 +1663,120 @@ int ImportGpGKeys(WPARAM w, LPARAM l) break; } if(found) - { - wstring cmd; - TCHAR tmp2[MAX_PATH] = {0}; - TCHAR *ptmp; - string output; - DWORD exitcode; - { - HANDLE hcnt = hContact; - ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcscpy(tmp2, ptmp); - mir_free(ptmp); - _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); - DeleteFile(tmp2); - wfstream f(tmp2, std::ios::out); - f< output.find("<", s)) - s2 = output.find("<", s); - if(s2 != string::npos) - { - tmp2 = new char [output.substr(s,s2-s-1).length()+1]; - strcpy(tmp2, output.substr(s,s2-s-1).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - { - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); - } - mir_free(tmp2); - if((s = output.find(")", s2)) == string::npos) - s = output.find(">", s2); - else if(s > output.find(">", s2)) - s = output.find(">", s2); - s2++; - if(output[s] == ')') - { - tmp2 = new char [output.substr(s2,s-s2).length()+1]; - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); - mir_free(tmp2); - s+=3; - s2 = output.find(">", s); - tmp2 = new char [output.substr(s,s2-s).length()+1]; - strcpy(tmp2, output.substr(s,s2-s).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); - mir_free(tmp2); - } - else - { - tmp2 = new char [output.substr(s2,s-s2).length()+1]; - strcpy(tmp2, output.substr(s2,s-s2).c_str()); - mir_utf8decode(tmp2, 0); - if(hContact) - DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); - mir_free(tmp2); - } - } - DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); - DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str()); - } + { + wstring cmd; + TCHAR tmp2[MAX_PATH] = {0}; + TCHAR *ptmp; + string output; + DWORD exitcode; + { + HANDLE hcnt = hContact; + ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + _tcscpy(tmp2, ptmp); + mir_free(ptmp); + _tcscat(tmp2, _T("\\")); + _tcscat(tmp2, _T("temporary_exported.asc")); + DeleteFile(tmp2); + wfstream f(tmp2, std::ios::out); + f< output.find("<", s)) + s2 = output.find("<", s); + if(s2 != string::npos) + { + tmp2 = new char [output.substr(s,s2-s-1).length()+1]; + strcpy(tmp2, output.substr(s,s2-s-1).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + { + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainName", output.substr(s,s2-s-1).c_str()); + } + mir_free(tmp2); + if((s = output.find(")", s2)) == string::npos) + s = output.find(">", s2); + else if(s > output.find(">", s2)) + s = output.find(">", s2); + s2++; + if(output[s] == ')') + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyComment", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + s+=3; + s2 = output.find(">", s); + tmp2 = new char [output.substr(s,s2-s).length()+1]; + strcpy(tmp2, output.substr(s,s2-s).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s,s2-s).c_str()); + mir_free(tmp2); + } + else + { + tmp2 = new char [output.substr(s2,s-s2).length()+1]; + strcpy(tmp2, output.substr(s2,s-s2).c_str()); + mir_utf8decode(tmp2, 0); + if(hContact) + DBWriteContactSettingString(hContact, szGPGModuleName, "KeyMainEmail", output.substr(s2,s-s2).c_str()); + mir_free(tmp2); + } + } + DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 1); + DBWriteContactSettingTString(hContact, szGPGModuleName, "GPGPubKey", toUTF16(key).c_str()); + } DeleteFile(tmp2); break; } -- cgit v1.2.3 From 75dbad3f16853a91e2176bc5b5337206b7856d88 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 08:00:48 +0300 Subject: removed unneeded key warning on first run --- main.cpp | 2 +- new_gpg.rc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main.cpp b/main.cpp index 36a037f..9444dd6 100755 --- a/main.cpp +++ b/main.cpp @@ -1823,7 +1823,7 @@ void InitCheck() char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); char *key = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); void ShowFirstRunDialog(); - if(!keyid[0] || !key[0]) + if(!DBGetContactSettingByte(NULL, szGPGModuleName, "FirstRun", 1) && (!keyid[0] || !key[0])) { question = Translate("You have not set public key for gpg, it's recommended to do it.\nDo you want to do it now ?"); if(MessageBoxA(0, question.c_str(), Translate("Own public key warning"), MB_YESNO) == IDYES) diff --git a/new_gpg.rc b/new_gpg.rc index 66dda83..4c04666 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -84,15 +84,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPT CAPTION "Set GPG bin path and keyring home dir." FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "ÎÊ",ID_OK,7,87,50,14 + DEFPUSHBUTTON "Continue",ID_OK,7,87,50,14 LTEXT "Home directory:",IDC_STATIC,9,34,325,8 LTEXT "GnuPG binary:",IDC_STATIC,10,7,147,8 PUSHBUTTON "Browse",IDC_SET_BIN_PATH,293,18,54,14 PUSHBUTTON "Browse",IDC_SET_HOME_DIR,293,44,54,14 EDITTEXT IDC_HOME_DIR,7,44,277,14,ES_AUTOHSCROLL EDITTEXT IDC_BIN_PATH,7,17,277,14,ES_AUTOHSCROLL - PUSHBUTTON "Generate and use random key",IDC_GENERATE_RANDOM,7,66,118,14 - CONTROL "Turn on key autoexchange",IDC_AUTO_EXCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,133,68,191,10 + PUSHBUTTON "Generate and use random key",IDC_GENERATE_RANDOM,166,87,118,14 + CONTROL "Turn on key autoexchange",IDC_AUTO_EXCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,64,277,10 END IDD_NEW_KEY DIALOGEX 0, 0, 427, 68 -- cgit v1.2.3 From dd580e5cae07351821fa52c24fe7ac254bc8004f Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 08:58:30 +0300 Subject: typo fixes --- globals.h | 2 +- init.cpp | 6 +++--- main.cpp | 4 ++-- new_gpg.rc | 2 +- options.cpp | 6 +++--- utilities.cpp | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/globals.h b/globals.h index 3aeb8ad..e84ae1e 100755 --- a/globals.h +++ b/globals.h @@ -16,7 +16,7 @@ #ifndef GLOBALS_H #define GLOBALS_H -extern bool bAppendTags, bPrescenseSubscription, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; +extern bool bAppendTags, bPresenceSigning, bStripTags, gpg_valid, gpg_keyexist, tabsrmm_used; extern TCHAR *inopentag, *inclosetag, *outopentag, *outclosetag; extern logtofile debuglog; #endif diff --git a/init.cpp b/init.cpp index 8da20b2..d04c437 100755 --- a/init.cpp +++ b/init.cpp @@ -17,7 +17,7 @@ #include "commonheaders.h" //global variables -bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPrescenseSubscription = 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, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; TCHAR *inopentag = NULL, *inclosetag = NULL, *outopentag = NULL, *outclosetag = NULL, *password = NULL; list Accounts; @@ -97,8 +97,8 @@ void init_vars() password = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); debuglog.init(); bJabberAPI = DBGetContactSettingByte(NULL, szGPGModuleName, "bJabberAPI", bIsMiranda09?1:0); - bPrescenseSubscription = DBGetContactSettingByte(NULL, szGPGModuleName, "bPrescenseSubscription", 1); - bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 1); + bPresenceSigning = DBGetContactSettingByte(NULL, szGPGModuleName, "bPresenceSigning", 0); + bFileTransfers = DBGetContactSettingByte(NULL, szGPGModuleName, "bFileTransfers", 0); firstrun_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowX", 0); firstrun_rect.top = DBGetContactSettingDword(NULL, szGPGModuleName, "FirstrunWindowY", 0); key_password_rect.left = DBGetContactSettingDword(NULL, szGPGModuleName, "PasswordWindowX", 0); diff --git a/main.cpp b/main.cpp index 9444dd6..cbc36a9 100755 --- a/main.cpp +++ b/main.cpp @@ -396,7 +396,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } f<<"Key-Type: RSA"; f<<"\n"; - f<<"Key-Length: 2048"; + f<<"Key-Length: 4096"; f<<"\n"; f<<"Subkey-Type: RSA"; f<<"\n"; @@ -1078,7 +1078,7 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEY_TYPE), _T("DSA"), 1); SendDlgItemMessage(hwndDlg, IDC_KEY_TYPE, CB_SETCURSEL, (WPARAM)1, 0); SetDlgItemInt(hwndDlg, IDC_KEY_EXPIRE_DATE, 0, 0); - SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 2048, 0); + SetDlgItemInt(hwndDlg, IDC_KEY_LENGTH, 4096, 0); return TRUE; } diff --git a/new_gpg.rc b/new_gpg.rc index 4c04666..04cc77e 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -364,7 +364,7 @@ IDD_OPT_GPG_ADVANCED DIALOGEX 0, 0, 286, 214 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x0 BEGIN - CONTROL "Turn on prescense subscription (Jabber)",IDC_PRESCENSE_SUBSCRIPTION, + CONTROL "Turn on presence signing (Jabber)",IDC_PRESCENSE_SUBSCRIPTION, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,9,190,10 END diff --git a/options.cpp b/options.cpp index 2b8fce1..c91f30f 100755 --- a/options.cpp +++ b/options.cpp @@ -208,7 +208,7 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA } if(bIsMiranda09) CheckStateLoadDB(hwndDlg, IDC_JABBER_API, "bJabberAPI", 1); - CheckStateLoadDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers", 1); + CheckStateLoadDB(hwndDlg, IDC_FILE_TRANSFERS, "bFileTransfers", 0); CheckStateLoadDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange", 0); return TRUE; } @@ -704,7 +704,7 @@ static BOOL CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { extern bool bJabberAPI; TranslateDialogDefault(hwndDlg); - CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPrescenseSubscription", 1); + CheckStateLoadDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning", 0); EnableWindow(GetDlgItem(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION), bJabberAPI); return TRUE; @@ -724,7 +724,7 @@ static BOOL CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP case PSN_APPLY: { - bPrescenseSubscription = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPrescenseSubscription"); + bPresenceSigning = CheckStateStoreDB(hwndDlg, IDC_PRESCENSE_SUBSCRIPTION, "bPresenceSigning"); return TRUE; } } diff --git a/utilities.cpp b/utilities.cpp index 56f7ccb..114f2dc 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -716,7 +716,7 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU return FALSE; } } - if(bPrescenseSubscription && nodename) + if(bPresenceSigning && nodename) { if(_tcsstr(nodename, _T("status"))) { -- cgit v1.2.3 From 0711166b41c6e4f0b788ab34ef15289e98e46a31 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 2 Jun 2012 14:54:56 +0300 Subject: fixed "accept and turn on encryption" on key inport --- main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.cpp b/main.cpp index cbc36a9..5e4034e 100755 --- a/main.cpp +++ b/main.cpp @@ -989,7 +989,7 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, { extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - HANDLE hContact = INVALID_HANDLE_VALUE; + static HANDLE hContact = INVALID_HANDLE_VALUE; void ImportKey(); TCHAR *tmp = NULL; switch (msg) @@ -1001,9 +1001,9 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, SetWindowPos(hwndDlg, 0, new_key_rect.left, new_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); TCHAR *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "GPGPubKey", _T("")); - SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); + SetDlgItemText(hwndDlg, IDC_MESSAGE, tmp[0]?TranslateT("There is existing key for contact, would you like to replace with new key ?"):TranslateT("New public key was received, do you want to import it?")); EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0)?0:1); - SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?TranslateT("Replace"):_T("Accept")); + SetDlgItemText(hwndDlg, ID_IMPORT, tmp[0]?TranslateT("Replace"):TranslateT("Accept")); mir_free(tmp); tmp = new TCHAR [256]; _tcscpy(tmp, TranslateT("Received key from ")); -- cgit v1.2.3 From ad52d967c7f67428bf7c6aea6c376a1a43c65735 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 4 Jun 2012 23:56:26 +0300 Subject: fixed filetransfers #21 (tested only with jabber) --- utilities.cpp | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/utilities.cpp b/utilities.cpp index 114f2dc..6b2261d 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -277,7 +277,7 @@ int onProtoAck(WPARAM w, LPARAM l) { ACKDATA *ack=(ACKDATA*)l; CCSDATA *ccs=(CCSDATA*)ack->lParam; - + if(ack->type == ACKTYPE_FILE && bFileTransfers) { switch(ack->result) @@ -312,7 +312,7 @@ int onProtoAck(WPARAM w, LPARAM l) string out; DWORD code; pxResult result; - wstring cmd = _T("-o "); + wstring cmd = _T(" -o "); wstring file = filename; wstring::size_type p1 = file.rfind(_T(".gpg")); file.erase(p1, _tcslen(_T(".gpg"))); @@ -325,13 +325,10 @@ int onProtoAck(WPARAM w, LPARAM l) file.insert(0, _T("\"")); file.insert(file.length(), _T("\" ")); cmd += file; - cmd += _T(" -d \""); - cmd += filename; - cmd += _T("\""); extern TCHAR *password; { // password TCHAR *pass = NULL; - char *keyid = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "KeyID", ""); + char *keyid = UniGetContactSettingUtf(ack->hContact, szGPGModuleName, "KeyID", ""); if(strlen(keyid) > 0) { string dbsetting = "szKey_"; @@ -339,13 +336,13 @@ int onProtoAck(WPARAM w, LPARAM l) dbsetting += "_Password"; pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); if(_tcslen(pass) > 0) - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; } else { pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); if(_tcslen(pass) > 0) - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; } if(_tcslen(pass) > 0) { @@ -355,16 +352,19 @@ int onProtoAck(WPARAM w, LPARAM l) } else if(password) { - debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; + debuglog<hContact, GCDNF_TCHAR)<<" with password\n"; cmd += _T("--passphrase \""); cmd += password; cmd += _T("\" "); } else - debuglog<hContact, GCDNF_TCHAR)<<" with out password\n"; + debuglog<hContact, GCDNF_TCHAR)<<" with out password\n"; mir_free(pass); mir_free(keyid); } + cmd += _T(" -d \""); + cmd += filename; + cmd += _T("\""); gpg_execution_params params; params.cmd = &cmd; params.useless = ""; @@ -385,7 +385,7 @@ int onProtoAck(WPARAM w, LPARAM l) extern bool _terminate; extern HANDLE new_key_hcnt; extern boost::mutex new_key_hcnt_mutex; - debuglog<hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n"; + debuglog<hContact, GCDNF_TCHAR)<<" password needed, trying to get one\n"; if(_terminate) break; { //save inkey id @@ -393,19 +393,19 @@ int onProtoAck(WPARAM w, LPARAM l) s = out.find(" ID ", s); s += strlen(" ID "); string::size_type s2 = out.find(",",s); - if(metaIsProtoMetaContacts(ccs->hContact)) - DBWriteContactSettingString(metaGetMostOnline(ccs->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + if(metaIsProtoMetaContacts(ack->hContact)) + DBWriteContactSettingString(metaGetMostOnline(ack->hContact), szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); else - DBWriteContactSettingString(ccs->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); + DBWriteContactSettingString(ack->hContact, szGPGModuleName, "InKeyID", out.substr(s, s2-s).c_str()); } void ShowLoadKeyPasswordWindow(); new_key_hcnt_mutex.lock(); - new_key_hcnt = ccs->hContact; + new_key_hcnt = ack->hContact; ShowLoadKeyPasswordWindow(); wstring cmd2 = cmd; if(password) { - debuglog<hContact, GCDNF_TCHAR)<<"\n"; + debuglog<hContact, GCDNF_TCHAR)<<"\n"; wstring tmp = _T("--passphrase \""); tmp += password; tmp += _T("\" "); @@ -472,10 +472,9 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) string out; DWORD code; pxResult result; + HANDLE hcnt = metaIsProtoMetaContacts(hContact)?metaGetMostOnline(hContact):hContact; wstring cmd = _T("--batch --yes -r "); - char *keyid = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID", ""); - if(DBGetContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 0)) - cmd += _T("--trust-model always "); + char *keyid = UniGetContactSettingUtf(hcnt, szGPGModuleName, "KeyID", ""); TCHAR *szKeyid = mir_a2t(keyid); TCHAR *name = _tcsrchr(filename,_T('\\')); if( !name ) @@ -485,6 +484,8 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) TCHAR *file_out = new TCHAR [_tcslen(filename)+4]; mir_sntprintf(file_out, _tcslen(name)+7, _T("%s.gpg"), name); cmd += szKeyid; + if(DBGetContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 0)) + cmd += _T(" --trust-model always "); mir_free(szKeyid); mir_free(keyid); cmd += _T(" -o \""); @@ -523,7 +524,7 @@ std::wstring encrypt_file(HANDLE hContact, TCHAR *filename) out.clear(); if(MessageBox(0, _T("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), _T("Warning"), MB_YESNO) == IDYES) { - DBWriteContactSettingByte(hContact, szGPGModuleName, "bAlwaysTrust", 1); + DBWriteContactSettingByte(hcnt, szGPGModuleName, "bAlwaysTrust", 1); cmd.insert(0, _T("--trust-model always ")); gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread->timed_join(boost::posix_time::seconds(180))) @@ -552,7 +553,8 @@ int onSendFile(WPARAM w, LPARAM l) DWORD flags = (DWORD)ccs->wParam; //check for PFTS_UNICODE here int i; - if(flags & PFTS_UNICODE) +// if(flags & PFTS_UNICODE) //this does not work .... + if(StriStr(ccs->szProtoService, "/sendfilew")) { TCHAR **file=(TCHAR **)ccs->lParam; for(i = 0; file[i]; i++) -- cgit v1.2.3 From 9d905146c450baed1ecb180652cca904879ab9c8 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 6 Jun 2012 00:05:40 +0300 Subject: implemented #44 (access rights checking) --- main.cpp | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index 5e4034e..23d486b 100755 --- a/main.cpp +++ b/main.cpp @@ -1787,6 +1787,45 @@ void InitCheck() { {//parse gpg output gpg_valid = isGPGValid(); + bool home_dir_access = false, temp_access = false; + TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + std::wstring test_path = home_dir; + mir_free(home_dir); + test_path += _T("/"); + test_path += toUTF16(get_random(13)); + wfstream test_file; + test_file.open(test_path, std::ios::trunc | std::ios::out); + if(test_file.is_open() && test_file.good()) + { + test_file<<_T("access_test\n"); + if(test_file.good()) + home_dir_access = true; + test_file.close(); + DeleteFile(test_path.c_str()); + } + home_dir = _tgetenv(_T("TEMP")); + test_path = home_dir; + test_path += _T("/"); + test_path += toUTF16(get_random(13)); + test_file.open(test_path, std::ios::trunc | std::ios::out); + if(test_file.is_open() && test_file.good()) + { + test_file<<_T("access_test\n"); + if(test_file.good()) + temp_access = true; + test_file.close(); + DeleteFile(test_path.c_str()); + } + if(!home_dir_access || !temp_access || !gpg_valid) + { + char buf[4096]; + strcpy(buf, gpg_valid?Translate("GPG binary is set and valid (this is good).\n"):Translate("GPG binary unset or invalid (plugin will not work).\n")); + strcat(buf, home_dir_access?Translate("Home dir write access granted (this is good).\n"):Translate("Home dir have not write access (plugin most probably will not work).\n")); + strcat(buf, temp_access?Translate("Temp dir write access granted (this is good).\n"):Translate("Temp dir have not write access (plugin should work, but may have some problems, filetransfers will not work).")); + if(!gpg_valid) + strcat(buf, Translate("\nGPG will be disabled until you solve this problems")); + MessageBoxA(0, buf, Translate("GPG plugin problems"), MB_OK); + } if(!gpg_valid) return; gpg_keyexist = isGPGKeyExist(); @@ -1814,7 +1853,7 @@ void InitCheck() if(result == pxNotFound) return; } - TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); wstring tmp_dir = home_dir; mir_free(home_dir); tmp_dir += _T("\\tmp"); -- cgit v1.2.3 From 7ca9ddf39c89968fbaa81e61598a7d3f8d09d2ac Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 6 Jun 2012 21:40:16 +0300 Subject: fixed #48 (key generation tab order) implemented #49 (key generation notification) --- main.cpp | 16 ++++++++++++++++ new_gpg.rc | 15 ++++++++------- new_gpg.vcxproj | 5 +++++ resource.h | 4 +++- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/main.cpp b/main.cpp index 23d486b..dce18cd 100755 --- a/main.cpp +++ b/main.cpp @@ -426,6 +426,12 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM params.out = &out; params.code = &code; params.result = &result; + SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_KEY), Translate("Generating new random key, please wait")); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENERATE_KEY), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_OTHER), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_DELETE_KEY), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_LIST), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_GENERATE_RANDOM), 0); boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) { @@ -1248,6 +1254,16 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, params.out = &out; params.code = &code; params.result = &result; + SetWindowTextA(GetDlgItem(hwndDlg, IDC_GENERATING_TEXT), Translate("Generating new key, please wait...")); + EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), 0); + EnableWindow(GetDlgItem(hwndDlg, IDOK), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_TYPE), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_LENGTH), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_PASSWD), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_REAL_NAME), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_EMAIL), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_COMMENT), 0); + EnableWindow(GetDlgItem(hwndDlg, IDC_KEY_EXPIRE_DATE), 0); boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) { diff --git a/new_gpg.rc b/new_gpg.rc index 04cc77e..2804693 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -77,6 +77,7 @@ BEGIN PUSHBUTTON "Load other",IDC_OTHER,83,131,64,14 PUSHBUTTON "Delete key",IDC_DELETE_KEY,149,131,70,14 PUSHBUTTON "Generate and use random key",IDC_GENERATE_RANDOM,99,163,118,14 + LTEXT "",IDC_GENERATING_KEY,82,186,174,8 END IDD_BIN_PATH DIALOGEX 0, 0, 354, 108 @@ -115,22 +116,22 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,7,148,50,14 PUSHBUTTON "Cancel",IDCANCEL,227,148,50,14 COMBOBOX IDC_KEY_TYPE,120,14,48,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP + EDITTEXT IDC_KEY_LENGTH,120,30,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP + EDITTEXT IDC_KEY_PASSWD,120,46,55,14,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_KEY_REAL_NAME,120,61,55,14,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_KEY_EMAIL,120,76,55,14,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_KEY_COMMENT,120,91,55,14,ES_AUTOHSCROLL | WS_GROUP + EDITTEXT IDC_KEY_EXPIRE_DATE,120,106,55,14,ES_AUTOHSCROLL | WS_GROUP LTEXT "Key type:",IDC_STATIC,8,16,96,8 LTEXT "Key length:",IDC_STATIC,7,32,106,8 LTEXT "Key password:",IDC_STATIC,7,49,105,8 - EDITTEXT IDC_KEY_PASSWD,120,46,55,14,ES_AUTOHSCROLL | WS_GROUP LTEXT "Real name:",IDC_STATIC,7,63,105,8 LTEXT "Email:",IDC_STATIC,7,79,108,8 LTEXT "Comment:",IDC_STATIC,7,92,107,8 LTEXT "Expire date:",IDC_STATIC,7,109,111,8 - EDITTEXT IDC_KEY_EMAIL,120,76,55,14,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_KEY_REAL_NAME,120,61,55,14,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_KEY_COMMENT,120,91,55,14,ES_AUTOHSCROLL | WS_GROUP - EDITTEXT IDC_KEY_EXPIRE_DATE,120,106,55,14,ES_AUTOHSCROLL | WS_GROUP LTEXT "ex.: 2010-08-15",IDC_STATIC,182,108,75,8 - EDITTEXT IDC_KEY_LENGTH,120,30,40,14,ES_AUTOHSCROLL | ES_NUMBER | WS_GROUP LTEXT "From 1024 to 4096",IDC_STATIC,168,33,89,8 - LTEXT "It can take a long time, be patient",IDC_STATIC,15,132,246,8 + LTEXT "It can take a long time, be patient",IDC_GENERATING_TEXT,15,132,246,8 LTEXT "0 - does not expire",IDC_STATIC,122,122,141,8 END diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj index 9c5d49b..e98a996 100755 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -1344,4 +1344,9 @@ + + + + + \ No newline at end of file diff --git a/resource.h b/resource.h index 77189f8..d531f12 100755 --- a/resource.h +++ b/resource.h @@ -78,6 +78,8 @@ #define IDC_STRIP_TAGS 1067 #define IDC_CHECK1 1068 #define IDC_PRESCENSE_SUBSCRIPTION 1068 +#define IDC_GENERATING_KEY 1069 +#define IDC_GENERATING_TEXT 1070 // Next default values for new objects // @@ -85,7 +87,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 114 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1069 +#define _APS_NEXT_CONTROL_VALUE 1071 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3 From 166017ac72e412afef52e42ac5c31679211c8b55 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 13 Jun 2012 20:55:48 +0300 Subject: use WM_KEYDOWN instead ofr registering hotkey for ctrl+a handling on edit control --- options.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/options.cpp b/options.cpp index c91f30f..fb2da74 100755 --- a/options.cpp +++ b/options.cpp @@ -736,10 +736,27 @@ static BOOL CALLBACK DlgProcGpgAdvOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP HWND hPubKeyEdit = NULL; +LONG_PTR default_edit_proc = NULL; + +static BOOL CALLBACK editctrl_ctrl_a(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) +{ + LRESULT ret = 0; + switch(msg) + { + case WM_KEYDOWN: + if(wParam == 0x41 && GetKeyState(VK_CONTROL)< 0 ) + SendMessage(hwndDlg, EM_SETSEL, 0, -1); + break; + default: + ret = CallWindowProc((WNDPROC)default_edit_proc, hwndDlg, msg, wParam, lParam); + break; + } + return ret; +} static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) { - HANDLE hContact = user_data[item_num+1]; + static HANDLE hContact = user_data[item_num+1]; TCHAR *tmp = NULL; @@ -750,7 +767,9 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP { case WM_INITDIALOG: { + default_edit_proc = GetWindowLong(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), GWLP_WNDPROC); SetWindowPos(hwndDlg, 0, load_key_rect.left, load_key_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), GWLP_WNDPROC, (LONG_PTR)editctrl_ctrl_a); HANDLE hcnt = hContact; if(metaIsProtoMetaContacts(hcnt)) hcnt = metaGetMostOnline(hcnt); @@ -773,7 +792,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateW(_T("Turn on encryption"))); CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); } - RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); +// RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); if(hcnt) { tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); @@ -867,7 +886,6 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP return TRUE; } - case WM_COMMAND: { switch (LOWORD(wParam)) @@ -1356,11 +1374,11 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); } break; - case WM_HOTKEY: +/* case WM_HOTKEY: { if(wParam == 2) PostMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); - } + } */ break; } -- cgit v1.2.3 From e0db8851abe880553f48a0b2454dde293ffb22b2 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 2 Jul 2012 23:26:17 +0300 Subject: =?UTF-8?q?added=20ability=20to=20set=20private=20key=20for=20each?= =?UTF-8?q?=20protocol=20(#50=20=09=D0=A1=D0=B2=D0=BE=D0=B9=20=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=20=D0=B4=D0=BB=D1=8F=20=D0=BA=D0=B0=D0=B6=D0=B4?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=83=D1=87=D0=B5=D1=82=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=BF=D0=B8=D1=81=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gpg_wrapper.h | 68 ++++++++++++------------- main.cpp | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++------- new_gpg.rc | 31 +++++++----- options.cpp | 11 +---- resource.h | 5 +- utilities.cpp | 33 +++++++++++-- 6 files changed, 225 insertions(+), 79 deletions(-) diff --git a/gpg_wrapper.h b/gpg_wrapper.h index 87b5a55..5501297 100755 --- a/gpg_wrapper.h +++ b/gpg_wrapper.h @@ -13,38 +13,38 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - - -#ifndef GPG_WRAPPER_H -#define GPG_WRAPPER_H -typedef enum { - pxSuccess, - pxSuccessExitCodeInvalid, - pxCreatePipeFailed, - pxDuplicateHandleFailed, - pxCloseHandleFailed, - pxCreateProcessFailed, - pxThreadWaitFailed, - pxReadFileFailed, - pxBufferOverflow, - pxNotFound, - pxNotConfigured -} -pxResult; - -pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result); - -struct gpg_execution_params -{ - wstring *cmd; - char *useless; - string *out; - LPDWORD code; - pxResult *result; - HANDLE hProcess; - PROCESS_INFORMATION *proc; -}; - -void pxEexcute_thread(void *param); - + + +#ifndef GPG_WRAPPER_H +#define GPG_WRAPPER_H +typedef enum { + pxSuccess, + pxSuccessExitCodeInvalid, + pxCreatePipeFailed, + pxDuplicateHandleFailed, + pxCloseHandleFailed, + pxCreateProcessFailed, + pxThreadWaitFailed, + pxReadFileFailed, + pxBufferOverflow, + pxNotFound, + pxNotConfigured +} +pxResult; + +pxResult pxExecute(wstring *acommandline, char *ainput, string *aoutput, LPDWORD aexitcode, pxResult *result); + +struct gpg_execution_params +{ + wstring *cmd; + char *useless; + string *out; + LPDWORD code; + pxResult *result; + HANDLE hProcess; + PROCESS_INFORMATION *proc; +}; + +void pxEexcute_thread(void *param); + #endif \ No newline at end of file diff --git a/main.cpp b/main.cpp index dce18cd..dcb0384 100755 --- a/main.cpp +++ b/main.cpp @@ -148,7 +148,27 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } } } - + { + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)Translate("Default")); + int count = 0; + PROTOACCOUNT **accounts; + ProtoEnumAccounts(&count, &accounts); + for(int i = 0; i < count; i++) + { + if(StriStr(accounts[i]->szModuleName, "metacontacts")) + continue; + if(StriStr(accounts[i]->szModuleName, "weather")) + continue; + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)accounts[i]->szModuleName); + } + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } return TRUE; } @@ -201,10 +221,30 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBWriteContactSettingString(NULL, szGPGModuleName, setting, out.c_str()); + strcpy(setting, buf); + strcat(setting, "_KeyMainName"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, name); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, fp); + } } - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyMainName", name); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); TCHAR passwd[64]; GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, 64); if(passwd[0]) @@ -217,7 +257,7 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DBWriteContactSettingTString(NULL, szGPGModuleName, dbsetting.c_str(), passwd); } { - wstring keyinfo = TranslateT("Current private key id"); + wstring keyinfo = TranslateT("Default private key id"); keyinfo += _T(": "); keyinfo += (fp[0])?fp:_T("not set"); extern HWND hwndCurKey_p; @@ -371,13 +411,42 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } if(result == pxNotFound) break; + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail"); + DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType"); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyMainName"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyComment"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyMainEmail"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + strcpy(setting, buf); + strcat(setting, "_KeyType"); + DBDeleteContactSetting(NULL, szGPGModuleName, setting); + } } - DBDeleteContactSetting(NULL, szGPGModuleName, "GPGPubKey"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyID"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyComment"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainName"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyMainEmail"); - DBDeleteContactSetting(NULL, szGPGModuleName, "KeyType"); ListView_DeleteItem(hwndList, itemnum); break; case IDC_GENERATE_RANDOM: @@ -479,15 +548,60 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); + DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", fp); + } + else + { + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_GPGPubKey"); + DBWriteContactSettingString(NULL, szGPGModuleName, setting, out.c_str()); + strcpy(setting, buf); + strcat(setting, "_KeyID"); + DBWriteContactSettingTString(NULL, szGPGModuleName, setting, fp); + } } - DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); - DBWriteContactSettingTString(NULL, szGPGModuleName, "KeyID", path.c_str()); extern HWND hwndCurKey_p; SetWindowText(hwndCurKey_p, path.c_str()); } } DestroyWindow(hwndDlg); break; + case IDC_ACCOUNT: + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } + else + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_KeyID"); + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + mir_free(keyid); + SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); + } + } + break; + } break; } @@ -502,12 +616,16 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM itemnum = hdr->iItem; } } -// switch (((LPNMHDR)lParam)->code) - // { -// default: -// break; - -// } +/* switch(LOWORD(wParam)) + { + default: + break; + }; */ +/* switch (((LPNMHDR)lParam)->code) + { + default: + break; + } */ } break; case WM_CLOSE: diff --git a/new_gpg.rc b/new_gpg.rc index 2804693..fadafdc 100755 --- a/new_gpg.rc +++ b/new_gpg.rc @@ -63,21 +63,24 @@ BEGIN PUSHBUTTON "Import key from keyserver",IDC_IMPORT,140,152,188,14,WS_DISABLED END -IDD_FIRST_RUN DIALOGEX 0, 0, 291, 205 +IDD_FIRST_RUN DIALOGEX 0, 0, 291, 230 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Set own key" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "ÎÊ",ID_OK,12,184,50,14,WS_DISABLED - CONTROL "",IDC_KEY_LIST,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,23,277,105 - PUSHBUTTON "Generate key",IDC_GENERATE_KEY,8,131,74,14 - LTEXT "Select key for use",IDC_STATIC,16,12,186,8 - EDITTEXT IDC_KEY_PASSWORD,94,147,77,14,ES_PASSWORD | ES_AUTOHSCROLL - RTEXT "Key password:",IDC_STATIC,12,149,76,8 - PUSHBUTTON "Load other",IDC_OTHER,83,131,64,14 - PUSHBUTTON "Delete key",IDC_DELETE_KEY,149,131,70,14 - PUSHBUTTON "Generate and use random key",IDC_GENERATE_RANDOM,99,163,118,14 - LTEXT "",IDC_GENERATING_KEY,82,186,174,8 + DEFPUSHBUTTON "ÎÊ",ID_OK,12,209,50,14,WS_DISABLED + CONTROL "",IDC_KEY_LIST,"SysListView32",LVS_REPORT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,44,277,105 + PUSHBUTTON "Generate key",IDC_GENERATE_KEY,8,152,74,14 + LTEXT "Select key for use",IDC_STATIC,16,33,186,8 + EDITTEXT IDC_KEY_PASSWORD,94,168,77,14,ES_PASSWORD | ES_AUTOHSCROLL + RTEXT "Key password:",IDC_STATIC,12,170,76,8 + PUSHBUTTON "Load other",IDC_OTHER,83,152,64,14 + PUSHBUTTON "Delete key",IDC_DELETE_KEY,149,152,70,14 + PUSHBUTTON "Generate and use random key",IDC_GENERATE_RANDOM,99,184,118,14 + LTEXT "",IDC_GENERATING_KEY,82,207,174,8 + LTEXT "Account:",IDC_STATIC,15,12,42,8 + LTEXT "key id: ",IDC_KEY_ID,178,12,99,8 + COMBOBOX IDC_ACCOUNT,66,9,104,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_BIN_PATH DIALOGEX 0, 0, 354, 108 @@ -190,8 +193,10 @@ BEGIN BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 284 + VERTGUIDE, 15 TOPMARGIN, 7 - BOTTOMMARGIN, 198 + BOTTOMMARGIN, 223 + HORZGUIDE, 20 END IDD_BIN_PATH, DIALOG @@ -323,7 +328,7 @@ BEGIN PUSHBUTTON "Browse",IDC_LOG_FILE_SET,119,156,50,14 CONTROL "Use jabber api on Miranda IM >= 0.9 (recomended)",IDC_JABBER_API, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,175,251,10 - LTEXT "Current key",IDC_CURRENT_KEY,12,196,110,8 + LTEXT "Default key",IDC_CURRENT_KEY,12,196,110,8 CONTROL "Encrypt file transfers",IDC_FILE_TRANSFERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,11,185,137,10 CONTROL "Automatic key exchange",IDC_AUTO_EXCHANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,137,111,10 PUSHBUTTON "Copy own key",IDC_COPY_KEY,127,193,74,14 diff --git a/options.cpp b/options.cpp index fb2da74..109d54c 100755 --- a/options.cpp +++ b/options.cpp @@ -199,10 +199,10 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA EnableWindow(GetDlgItem(hwndDlg, IDC_JABBER_API), bIsMiranda09); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTO_EXCHANGE), (bIsMiranda09 && bJabberAPI)); { - string keyinfo = Translate("Current private key id"); + string keyinfo = Translate("Default private key id"); keyinfo += ": "; char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:"not set"; + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_CURRENT_KEY, keyinfo.c_str()); } @@ -792,7 +792,6 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP SetDlgItemText(hwndDlg, IDC_ENABLE_ENCRYPTION, TranslateW(_T("Turn on encryption"))); CheckDlgButton(hwndDlg, IDC_ENABLE_ENCRYPTION, 1); } -// RegisterHotKey(hwndDlg, 2, MOD_CONTROL | MOD_NOREPEAT, 0x41); if(hcnt) { tmp = UniGetContactSettingUtf(hcnt, szGPGModuleName, "GPGPubKey", _T("")); @@ -1374,12 +1373,6 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP DBWriteContactSettingDword(NULL, szGPGModuleName, "LoadKeyWindowY", load_key_rect.top); } break; -/* case WM_HOTKEY: - { - if(wParam == 2) - PostMessage(GetDlgItem(hwndDlg, IDC_PUBLIC_KEY_EDIT), EM_SETSEL, 0, -1); - } */ - break; } return FALSE; diff --git a/resource.h b/resource.h index d531f12..027e279 100755 --- a/resource.h +++ b/resource.h @@ -80,6 +80,9 @@ #define IDC_PRESCENSE_SUBSCRIPTION 1068 #define IDC_GENERATING_KEY 1069 #define IDC_GENERATING_TEXT 1070 +#define IDC_KEY_ID 1071 +#define IDC_COMBO1 1072 +#define IDC_ACCOUNT 1072 // Next default values for new objects // @@ -87,7 +90,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 114 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1071 +#define _APS_NEXT_CONTROL_VALUE 1073 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/utilities.cpp b/utilities.cpp index 6b2261d..2207213 100755 --- a/utilities.cpp +++ b/utilities.cpp @@ -195,8 +195,23 @@ int SendKey(WPARAM w, LPARAM l) HANDLE hContact = (HANDLE)w; if(metaIsProtoMetaContacts(hContact)) hContact = metaGetMostOnline(hContact); - char *szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); - if(strlen(szMessage) > 1) + char *szMessage; + { + char *proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + char setting[64]; + if(proto) + { + strcpy(setting, proto); + strcat(setting, "_GPGPubKey"); + szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + } + if(!szMessage[0]) + { + mir_free(szMessage); + szMessage = UniGetContactSettingUtf(NULL, szGPGModuleName, "GPGPubKey", ""); + } + } + if(szMessage[0]) { BYTE enc = DBGetContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); DBWriteContactSettingByte(hContact, szGPGModuleName, "GPGEncryption", 0); @@ -746,7 +761,19 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU DWORD code; wstring cmd; { - char *inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + char *inkeyid; + { + char *proto = ji->Sys()->GetModuleName(); + char setting[64]; + strcpy(setting, proto); + strcat(setting, "_KeyID"); + inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + if(!inkeyid[0]) + { + mir_free(inkeyid); + inkeyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + } + } TCHAR *pass = NULL; if(inkeyid[0]) { -- cgit v1.2.3 From 64c6452c697a05ab0b0d4bbbda167ddc35215397 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 14 Jul 2012 22:10:58 +0300 Subject: hz ... --- main.cpp | 60 ++++++++++++++++++++++++++++----------------------------- new_gpg.vcxproj | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/main.cpp b/main.cpp index dcb0384..3857f38 100755 --- a/main.cpp +++ b/main.cpp @@ -161,10 +161,10 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM continue; SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_ADDSTRING, 0, (LPARAM)accounts[i]->szModuleName); } - SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); - string keyinfo = Translate("key id"); - keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + SendMessageA(GetDlgItem(hwndDlg, IDC_ACCOUNT), CB_SELECTSTRING, 0, (LPARAM)Translate("Default")); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); @@ -221,10 +221,10 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); - } - { - char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + } + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { DBWriteContactSettingString(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -411,9 +411,9 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM } if(result == pxNotFound) break; - } - { - char buf[64]; + } + { + char buf[64]; GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { @@ -548,9 +548,9 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM while((s = out.find("\r", s)) != string::npos) { out.erase(s, 1); - } - { - char buf[64]; + } + { + char buf[64]; GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); if(!strcmp(buf, Translate("Default"))) { @@ -575,27 +575,27 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DestroyWindow(hwndDlg); break; case IDC_ACCOUNT: - { - char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); - if(!strcmp(buf, Translate("Default"))) - { - string keyinfo = Translate("key id"); - keyinfo += ": "; - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + { + char buf[64]; + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + if(!strcmp(buf, Translate("Default"))) + { + string keyinfo = Translate("key id"); + keyinfo += ": "; + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } else { - string keyinfo = Translate("key id"); - keyinfo += ": "; - char setting[64]; - strcpy(setting, buf); - strcat(setting, "_KeyID"); - char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); - keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); + string keyinfo = Translate("key id"); + keyinfo += ": "; + char setting[64]; + strcpy(setting, buf); + strcat(setting, "_KeyID"); + char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, setting, ""); + keyinfo += (strlen(keyid) > 0)?keyid:Translate("not set"); mir_free(keyid); SetDlgItemTextA(hwndDlg, IDC_KEY_ID, keyinfo.c_str()); } diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj index e98a996..0dad1bc 100755 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -502,7 +502,7 @@ 0x0809 - shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_48.lib + shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_51.lib true x:\temp\windows\libs\Boost\lib;%(AdditionalLibraryDirectories) true -- cgit v1.2.3