diff options
-rw-r--r-- | messages.cpp | 1 | ||||
-rw-r--r-- | utilities.cpp | 22 |
2 files changed, 13 insertions, 10 deletions
diff --git a/messages.cpp b/messages.cpp index eeea14b..7b294d4 100644 --- a/messages.cpp +++ b/messages.cpp @@ -252,6 +252,7 @@ int SendMsgSvc(WPARAM w, LPARAM l) if(strlen(tmp) < 2)
{
mir_free(tmp);
+ HistoryLog(ccs->hContact, "Failed to encrypt message with GPG", EVENTTYPE_MESSAGE, DBEF_SENT);
return CallService(MS_PROTO_CHAINSEND, w, l);
}
if(!bJabberAPI)
diff --git a/utilities.cpp b/utilities.cpp index a98ff39..2fbc8fb 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -359,20 +359,22 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU wstring data = str; xi.setText(local_node, _T("This message is encrypted.")); wstring::size_type p1 = data.find(_T("-----BEGIN PGP MESSAGE-----")) + _tcslen(_T("-----BEGIN PGP MESSAGE-----")); - if(data.find(_T("Version: "), p1) != wstring::npos) + while(data.find(_T("Version: "), p1) != wstring::npos) { p1 = data.find(_T("Version: "), p1); 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; + while(data.find(_T("Comment: "), p1) != wstring::npos) + { + p1 = data.find(_T("Comment: "), p1); + p1 = data.find(_T("\n"), p1); + } + while(data.find(_T("Encoding: "), p1) != wstring::npos) + { + p1 = data.find(_T("Encoding: "), p1); + p1 = data.find(_T("\n"), p1); + } + 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:encrypted")); |