diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2011-03-11 18:48:51 +0200 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2011-03-11 18:48:51 +0200 |
commit | 2391d026b942419c578e985b17f1d69a5af737ee (patch) | |
tree | 6a1de7dbc4b823c783445d4a4de55ca614cf736b /main.cpp | |
parent | b5eba0e25f83526ad457252c4b860300393bb3c6 (diff) | |
parent | 816241e9a436ba0992d6306a0b739862d6e2fa47 (diff) |
Merge branch 'new_gpg' of ssh://sss.chaoslab.ru/home/git/mim_plugs into new_gpg
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 107 |
1 files changed, 70 insertions, 37 deletions
@@ -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 @@ -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<<length; f<<"\n"; + f<<"Subkey-Length: "; + f<<length; + f<<"\n"; f<<"Subkey-Type: "; f<<subkeytype; delete [] subkeytype; @@ -1373,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; { @@ -1420,30 +1429,53 @@ 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); + } + else + p2--; 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); + } + else + p2--; + 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; @@ -1456,6 +1488,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++; } } @@ -1730,12 +1763,12 @@ void InitCheck() if(MessageBoxA(0, question.c_str(), "Own secret key warning", MB_YESNO) == IDYES) ShowFirstRunDialog(); } - {
- TCHAR *path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T(""));
- DWORD dwFileAttr = GetFileAttributes(path);
- if (dwFileAttr != INVALID_FILE_ATTRIBUTES)
- {
- dwFileAttr &=~ FILE_ATTRIBUTE_READONLY;
+ { + 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); |