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 /messages.cpp | |
parent | 78e9e2fae403e930b5ca3ee1c772ad8008a833f1 (diff) |
modified: main.cpp
modified: messages.cpp
modified: options.cpp
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
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();
|