diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-17 00:43:52 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-17 00:43:52 +0300 |
commit | ca445d73975b8f78003887562da4c5ef6f6d835e (patch) | |
tree | fc5ed6a3a1791ab6bc17f773cd74407e65563514 | |
parent | 78e9e2fae403e930b5ca3ee1c772ad8008a833f1 (diff) |
modified: main.cpp
modified: messages.cpp
modified: options.cpp
-rw-r--r-- | main.cpp | 31 | ||||
-rw-r--r-- | messages.cpp | 27 | ||||
-rw-r--r-- | options.cpp | 14 |
3 files changed, 49 insertions, 23 deletions
@@ -124,14 +124,14 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM tmp = mir_a2t(out.substr(p,p2-p-1).c_str());
ListView_SetItemText(hwndList, iRow, 3, tmp);
mir_free(tmp);
+ ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this
+ ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE);
i++;
}
}
- ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this
- ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE);
}
return TRUE;
@@ -302,6 +302,8 @@ static BOOL CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, TranslateDialogDefault(hwndDlg);
TCHAR *tmp = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "GPGPubKey", _T(""));
SetDlgItemText(hwndDlg, IDC_MESSAGE, (_tcslen(tmp) > 0)?_T("There is existing key for contact, do you want to replace with new key ?"):_T("New public key was received, do you want to import it?"));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_IMPORT_AND_USE), DBGetContactSettingByte(new_key_hcnt, szGPGModuleName, "GPGEncryption", 0)?0:1);
+ SetDlgItemText(hwndDlg, ID_IMPORT, (_tcslen(tmp) > 0)?_T("Replace"):_T("Accept"));
mir_free(tmp);
return TRUE;
}
@@ -572,6 +574,11 @@ static BOOL CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, tmp = mir_a2t(out.substr(p,p2-p-1).c_str());
ListView_SetItemText(hwndList_g, iRow, 3, tmp);
mir_free(tmp);
+ ListView_SetColumnWidth(hwndList_g, 0, LVSCW_AUTOSIZE);// not sure about this
+ ListView_SetColumnWidth(hwndList_g, 1, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList_g, 2, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList_g, 3, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList_g, 4, LVSCW_AUTOSIZE);
i++;
}
}
@@ -702,19 +709,17 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam, tmp = mir_a2t(out.substr(p,p2-p-1).c_str());
ListView_SetItemText(hwndList, iRow, 3, tmp);
mir_free(tmp);
+ ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this
+ ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
+ ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE);
i++;
}
}
- ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this
- ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE);
- ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE);
}
return TRUE; - } - - + } case WM_COMMAND: { switch (LOWORD(wParam)) diff --git a/messages.cpp b/messages.cpp index 2c095ed..47f2669 100644 --- a/messages.cpp +++ b/messages.cpp @@ -39,8 +39,16 @@ int RecvMsgSvc(WPARAM w, LPARAM l) mir_free(tmp);
wstring::size_type s1, s2;
- s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
- s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
+ if((str.find(_T("-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && (str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos))
+ {
+ s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
+ }
+ else if((str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && (str.find(_T("-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos))
+ {
+ s2 = str.find(_T("-----END PGP PRIVATE KEY BLOCK-----"));
+ s1 = str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
+ }
if((s2 != wstring::npos) && (s1 != wstring::npos))
{ //this is public key
if(!DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "GPGEncryption", 0))
@@ -51,9 +59,18 @@ int RecvMsgSvc(WPARAM w, LPARAM l) {
str.erase(s1, 1);
}
- s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
- s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
- s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ if((str.find(_T("-----END PGP PUBLIC KEY BLOCK-----")) != wstring::npos) && (str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----")) != wstring::npos))
+ {
+ s2 = str.find(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ s1 = str.find(_T("-----BEGIN PGP PUBLIC KEY BLOCK-----"));
+ s2 += _tcslen(_T("-----END PGP PUBLIC KEY BLOCK-----"));
+ }
+ else if((str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----")) != wstring::npos) && (str.find(_T("-----END PGP PRIVATE KEY BLOCK-----")) != wstring::npos))
+ {
+ s2 = str.find(_T("-----END PGP PRIVATE KEY BLOCK-----"));
+ s1 = str.find(_T("-----BEGIN PGP PRIVATE KEY BLOCK-----"));
+ s2 += _tcslen(_T("-----END PGP PRIVATE KEY BLOCK-----"));
+ }
new_key.append(str.substr(s1,s2-s1));
new_key_hcnt = ccs->hContact;
ShowNewKeyDialog();
diff --git a/options.cpp b/options.cpp index c4bcd7a..a64695f 100644 --- a/options.cpp +++ b/options.cpp @@ -162,13 +162,13 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ListView_SetItemState(hwndList, iRow, 0x2000, 0xF000); user_data[i] = hContact; ZeroMemory(&item,sizeof(item)); + ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this + ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); i++; } - ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE);// not sure about this - ListView_SetColumnWidth(hwndList, 1, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 2, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 3, LVSCW_AUTOSIZE); - ListView_SetColumnWidth(hwndList, 4, LVSCW_AUTOSIZE); return TRUE; } @@ -584,6 +584,10 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP ListView_SetItemText(hwndList_p, item_num, 3, tmp); mir_free(tmp); } + ListView_SetColumnWidth(hwndList_p, 0, LVSCW_AUTOSIZE);// not sure about this + ListView_SetColumnWidth(hwndList_p, 1, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 2, LVSCW_AUTOSIZE); + ListView_SetColumnWidth(hwndList_p, 3, LVSCW_AUTOSIZE); } MessageBoxA(0, output.c_str(), "", MB_OK); DeleteFile(tmp2); |