diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2012-12-23 16:17:07 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2012-12-23 16:17:07 +0000 |
commit | af8c5b336e9609ed9c53b877dd7f57fb3d7194b9 (patch) | |
tree | f767b0911a71a12ddda0e3c1f85a775a4897b608 /plugins/New_GPG | |
parent | 7bc7638adb66dd6110dfcb98aa74225b4c9c719c (diff) |
fixed deadlock on new key
added accounts column to own key selection dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@2815 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/New_GPG')
-rwxr-xr-x | plugins/New_GPG/res/new_gpg.rc | 4 | ||||
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 36 | ||||
-rwxr-xr-x | plugins/New_GPG/src/messages.cpp | 9 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 3 |
4 files changed, 46 insertions, 6 deletions
diff --git a/plugins/New_GPG/res/new_gpg.rc b/plugins/New_GPG/res/new_gpg.rc index 3ff3cd418c..286665f363 100755 --- a/plugins/New_GPG/res/new_gpg.rc +++ b/plugins/New_GPG/res/new_gpg.rc @@ -370,8 +370,8 @@ IDD_OPT_GPG_ADVANCED DIALOGEX 0, 0, 286, 32 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 400, 0, 0x0
BEGIN
- CONTROL "Turn on presence signing (Jabber)",IDC_PRESCENSE_SUBSCRIPTION,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,9,190,10
+ CONTROL "Turn on presence signing (Jabber) (required by xep 0-27)",IDC_PRESCENSE_SUBSCRIPTION,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,9,268,10
END
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index b38d57c866..9918b66cc7 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -71,6 +71,12 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR col.fmt = LVCFMT_LEFT; col.cx = 30; ListView_InsertColumn(hwndList, 4, &col); + ZeroMemory(&col,sizeof(col));
+ col.pszText = TranslateT("Accounts");
+ col.mask = LVCF_TEXT | LVCF_WIDTH;
+ col.fmt = LVCFMT_LEFT;
+ col.cx = 30;
+ ListView_InsertColumn(hwndList, 5, &col);
ListView_SetExtendedListViewStyleEx(hwndList, 0, LVS_EX_FULLROWSELECT); int i = 1, iRow = 0; { @@ -121,6 +127,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR p = out.find(" ", p2); tmp = mir_wstrdup(toUTF16(out.substr(p2,p-p2)).c_str()); ListView_SetItemText(hwndList, iRow, 0, tmp); + std::wstring key_id = tmp;
mir_free(tmp); p = out.find("uid ", p); p2 = out.find_first_not_of(" ", p+5); @@ -144,6 +151,33 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); + { //get accounts
+ int count = 0;
+ PROTOACCOUNT **accounts;
+ ProtoEnumAccounts(&count, &accounts);
+ std::wstring accs;
+ for(int i = 0; i < count; i++)
+ {
+ std::string setting = toUTF8(accounts[i]->tszAccountName);
+ setting += "(";
+ setting += accounts[i]->szModuleName;
+ setting += ")" ;
+ setting += "_KeyID";
+ TCHAR *str = UniGetContactSettingUtf(NULL, szGPGModuleName, setting.c_str(), _T(""));
+ if(key_id == str)
+ {
+ if(accs.empty())
+ accs += accounts[i]->tszAccountName;
+ else
+ {
+ accs += _T(",");
+ accs += accounts[i]->tszAccountName;
+ }
+ }
+ }
+ ListView_SetItemText(hwndList, iRow, 5, (TCHAR*)accs.c_str());
+ ListView_SetColumnWidth(hwndList, 5, LVSCW_AUTOSIZE);
+ }
i++; } } @@ -1123,7 +1157,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara case WM_INITDIALOG: { hContact = new_key_hcnt; - new_key_hcnt_mutex.unlock(); + //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("")); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index db17333da6..292ad1062c 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -410,7 +410,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) _tcscpy(tmp2, ptmp); mir_free(ptmp); _tcscat(tmp2, _T("\\")); - _tcscat(tmp2, _T("temporary_exported.asc")); + TCHAR *tmp3 = mir_a2t(get_random(5).c_str()); + _tcscat(tmp2, tmp3); + _tcscat(tmp2, _T(".asc")); + mir_free(tmp3); + //_tcscat(tmp2, _T("temporary_exported.asc")); DeleteFile(tmp2); wfstream f(tmp2, std::ios::out); while(!f.is_open()) @@ -443,6 +447,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) } if(result == pxNotFound) return 1; + DeleteFile(tmp2); //TODO: check gpg output for errors { char *tmp = NULL; @@ -543,7 +548,7 @@ int RecvMsgSvc(WPARAM w, LPARAM l) s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----")); } new_key.append(str.substr(s1,s2-s1)); - new_key_hcnt_mutex.lock(); + //new_key_hcnt_mutex.lock(); new_key_hcnt = ccs->hContact; ShowNewKeyDialog(); HistoryLog(ccs->hContact, db_event(msg, 0, 0, dbflags)); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 3effa8aa48..5d9e9a2ecd 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -272,6 +272,7 @@ int onProtoAck(WPARAM w, LPARAM l) } if(_tcsstr(filename, _T(".gpg"))) //decrypt it { //process encrypted file + HistoryLog(ack->hContact, db_event("Recieved encrypted file, trying to decrypt", 0,0, 0));
if(_waccess(f->tszCurrentFile, 0) == -1) { if(errno == ENOENT) @@ -518,7 +519,7 @@ int onSendFile(WPARAM w, LPARAM l) CCSDATA *ccs=(CCSDATA*)l; if(isContactSecured(ccs->hContact)) { - + HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT));
DWORD flags = (DWORD)ccs->wParam; //check for PFTS_UNICODE here int i; // if(flags & PFTS_UNICODE) //this does not work .... |