From 4d9fce6f544f0c6782a7ade4900afd3e1c6c9c52 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 29 Jan 2011 15:17:51 +0300 Subject: Better metacontacts handling\nFixed subkey length in keygen --- main.cpp | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index eca2698..9af1f5d 100644 --- a/main.cpp +++ b/main.cpp @@ -723,15 +723,15 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); break; } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); - { - TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - DWORD dwFileAttr = GetFileAttributes(path); - if (dwFileAttr != INVALID_FILE_ATTRIBUTES) - { - dwFileAttr &=~ FILE_ATTRIBUTE_READONLY; - SetFileAttributes(path, dwFileAttr); - } + DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); + { + TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + DWORD dwFileAttr = GetFileAttributes(path); + if (dwFileAttr != INVALID_FILE_ATTRIBUTES) + { + dwFileAttr &=~ FILE_ATTRIBUTE_READONLY; + SetFileAttributes(path, dwFileAttr); + } mir_free(path); } gpg_configured = true; @@ -806,15 +806,15 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP { MessageBox(0, _T("please set keyring's home directory"), _T("Warning"), MB_OK); break; - } - DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); - { - TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - DWORD dwFileAttr = GetFileAttributes(path); - if (dwFileAttr != INVALID_FILE_ATTRIBUTES) - { - dwFileAttr &=~ FILE_ATTRIBUTE_READONLY; - SetFileAttributes(path, dwFileAttr); + } + DBWriteContactSettingTString(NULL, szGPGModuleName, "szHomePath", tmp); + { + TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + DWORD dwFileAttr = GetFileAttributes(path); + if (dwFileAttr != INVALID_FILE_ATTRIBUTES) + { + dwFileAttr &=~ FILE_ATTRIBUTE_READONLY; + SetFileAttributes(path, dwFileAttr); } mir_free(path); } @@ -1144,6 +1144,9 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, delete [] tmp; f< Date: Thu, 3 Feb 2011 02:35:33 +0300 Subject: "Select existing key list fixes" --- main.cpp | 52 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 13 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 9af1f5d..1287be5 100644 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,4 @@ -// Copyright © 2010 sss +// Copyright © 2010-2011 sss // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -1376,11 +1376,17 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, col.cx = 30; ListView_InsertColumn(hwndList, 3, &col); ZeroMemory(&col,sizeof(col)); - col.pszText = _T("Key length"); + col.pszText = _T("Expiration date"); col.mask = LVCF_TEXT | LVCF_WIDTH; col.fmt = LVCFMT_LEFT; col.cx = 30; ListView_InsertColumn(hwndList, 4, &col); + ZeroMemory(&col,sizeof(col)); + col.pszText = _T("Key length"); + 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; { @@ -1423,30 +1429,49 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, TCHAR *tmp = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); item.pszText = tmp; iRow = ListView_InsertItem(hwndList, &item); - ListView_SetItemText(hwndList, iRow, 4, tmp); + ListView_SetItemText(hwndList, iRow, 5, tmp); mir_free(tmp); p2+=2; p = out.find(" ", p2); tmp = mir_wstrdup(toUTF16(out.substr(p2,p-p2)).c_str()); ListView_SetItemText(hwndList, iRow, 0, tmp); mir_free(tmp); - p++; p2 = out.find("\n", p); + string::size_type p3 = out.substr(p, p2-p).find("["); + if(p3 != string::npos) + { + p3+=p; + p2 = p3; + p2--; + p3++; + p3+=strlen("expires: "); + string::size_type p4 = out.find("]", p3); + tmp = mir_wstrdup(toUTF16(out.substr(p3,p4-p3)).c_str()); + ListView_SetItemText(hwndList, iRow, 4, tmp); + mir_free(tmp); + } tmp = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); ListView_SetItemText(hwndList, iRow, 3, tmp); mir_free(tmp); - p = out.find("uid ", p); - p2 = out.find_first_not_of(" ", p+5); - p = out.find("<", p2); - tmp = mir_wstrdup(toUTF16(out.substr(p2,p-p2)).c_str()); - ListView_SetItemText(hwndList, iRow, 2, tmp); - mir_free(tmp); - p++; - p2 = out.find(">", p); + p+= strlen("uid "); + p2 = out.find("\n", p); + p3 = out.substr(p, p2-p).find("<"); + if(p3 != string::npos) + { + p3+=p; + p2=p3; + p2--; + p3++; + string::size_type p4 = out.find(">", p3); + tmp = mir_wstrdup(toUTF16(out.substr(p3,p4-p3)).c_str()); + ListView_SetItemText(hwndList, iRow, 1, tmp); + mir_free(tmp); + } + p = out.find_first_not_of(" ", p); tmp = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); - ListView_SetItemText(hwndList, iRow, 1, tmp); + ListView_SetItemText(hwndList, iRow, 2, tmp); mir_free(tmp); // p = out.find("sub ", p2) + 6; // p = out.find(" ", p) + 1; @@ -1459,6 +1484,7 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 5, LVSCW_AUTOSIZE); i++; } } -- cgit v1.2.3 From 816241e9a436ba0992d6306a0b739862d6e2fa47 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sat, 5 Feb 2011 01:01:39 +0300 Subject: keylist fix --- main.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 1287be5..f35ff70 100644 --- a/main.cpp +++ b/main.cpp @@ -1451,6 +1451,8 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, ListView_SetItemText(hwndList, iRow, 4, tmp); mir_free(tmp); } + else + p2--; tmp = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); ListView_SetItemText(hwndList, iRow, 3, tmp); mir_free(tmp); @@ -1469,6 +1471,8 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, ListView_SetItemText(hwndList, iRow, 1, tmp); mir_free(tmp); } + else + p2--; p = out.find_first_not_of(" ", p); tmp = mir_wstrdup(toUTF16(out.substr(p,p2-p)).c_str()); ListView_SetItemText(hwndList, iRow, 2, tmp); -- cgit v1.2.3