diff options
Diffstat (limited to 'utilities.cpp')
-rw-r--r-- | utilities.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/utilities.cpp b/utilities.cpp index 9270a21..480f9b6 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -331,7 +331,38 @@ int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accoun static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pUserData) { - + HXML local_node = node; + for(int n = 0; n < xi.getChildCount(node); n++) + { + LPCTSTR str = xi.getText(local_node); + if(str) + { + if(_tcsstr(str, _T("-----BEGIN PGP MESSAGE-----")) && _tcsstr(str, _T("-----END PGP MESSAGE-----"))) + { + xi.setText(local_node, _T("This message is encrypted.")); + wstring data = str; + 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); + 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; + 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")); + } + } + local_node = xi.getChild(node, n); + } return FALSE; } |