From ca445d73975b8f78003887562da4c5ef6f6d835e Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Tue, 17 Aug 2010 00:43:52 +0300 Subject: modified: main.cpp modified: messages.cpp modified: options.cpp --- messages.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'messages.cpp') 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(); -- cgit v1.2.3