summaryrefslogtreecommitdiff
path: root/messages.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'messages.cpp')
-rw-r--r--messages.cpp27
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();