summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-17 21:41:32 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-17 21:41:32 +0300
commite07a374f12258c3798c9f49ea926db29f90d93ec (patch)
tree4961e82ee9c977b8c469d9959e5973704e1548d6
parent8091df1285c1b9f78e612cb49a00f343f5b355a8 (diff)
modified: utilities.cpp
-rw-r--r--utilities.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/utilities.cpp b/utilities.cpp
index b0a9131..5ba8398 100644
--- a/utilities.cpp
+++ b/utilities.cpp
@@ -420,24 +420,27 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU
data.append(_T("\n"));
}
DeleteFile(path_out.c_str());
- wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + _tcslen(_T("-----BEGIN PGP MESSAGE-----"));
- if(data.find(_T("Version: "), p1) != wstring::npos)
+ if(data.find(_T("-----BEGIN PGP MESSAGE-----")) != wstring::npos && data.find(_T("-----END PGP MESSAGE-----")) != wstring::npos)
{
- p1 = data.find(_T("Version: "), p1);
- p1 = data.find(_T("\n"), p1);
+ wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + _tcslen(_T("-----BEGIN PGP MESSAGE-----"));
if(data.find(_T("Version: "), p1) != wstring::npos)
{
p1 = data.find(_T("Version: "), p1);
- p1 = data.find(_T("\n"), p1)+2;
+ p1 = data.find(_T("\n"), p1);
+ if(data.find(_T("Version: "), p1) != wstring::npos)
+ {
+ p1 = data.find(_T("Version: "), p1);
+ p1 = data.find(_T("\n"), p1)+2;
+ }
+ else
+ p1 += 2;
}
else
- p1 += 2;
+ p1+=2;
+ wstring::size_type p2 = data.find(_T("-----END PGP MESSAGE-----"));
+ HXML encrypted_data = xi.addChild(node, _T("x"), data.substr(p1, p2-p1).c_str());
+ xi.addAttr(encrypted_data, _T("xmlns"), _T("jabber:x:signed"));
}
- else
- p1+=2;
- wstring::size_type p2 = data.find(_T("-----END PGP MESSAGE-----"));
- HXML encrypted_data = xi.addChild(node, _T("x"), data.substr(p1, p2-p1).c_str());
- xi.addAttr(encrypted_data, _T("xmlns"), _T("jabber:x:signed"));
return FALSE;
}
}