From f5333c257d4b23bb5f37ab3380dd69191f71429c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 23 Jun 2020 20:13:32 +0300 Subject: Jabber to filter out encrypted outgoing carbon copies --- protocols/JabberG/src/jabber_thread.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'protocols/JabberG') diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index c4b6c54956..e911d7f33d 100755 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1310,19 +1310,23 @@ void CJabberProto::OnProcessMessage(const TiXmlElement *node, ThreadData *info) return; } - // XEP-0027 is not strict enough, different clients have different implementations - // additional validation is required - char *prolog = "-----BEGIN PGP MESSAGE-----"; - char *prolog_newline = "\r\n\r\n"; - char *epilog = "\r\n-----END PGP MESSAGE-----\r\n"; - - CMStringA tempstring; - if (!strstr(ptszText, prolog)) - tempstring.Format("%s%s%s%s", prolog, prolog_newline, ptszText, epilog); - else - tempstring = ptszText; - - szMessage += tempstring; + if (carbon && carbonSent) + szMessage = TranslateU("Unable to decrypt a carbon copy of the encrypted outgoing message"); + else { + // XEP-0027 is not strict enough, different clients have different implementations + // additional validation is required + char *prolog = "-----BEGIN PGP MESSAGE-----"; + char *prolog_newline = "\r\n\r\n"; + char *epilog = "\r\n-----END PGP MESSAGE-----\r\n"; + + CMStringA tempstring; + if (!strstr(ptszText, prolog)) + tempstring.Format("%s%s%s%s", prolog, prolog_newline, ptszText, epilog); + else + tempstring = ptszText; + + szMessage += tempstring; + } } else if (!mir_strcmp(pszXmlns, JABBER_FEAT_DELAY) && msgTime == 0) { const char *ptszTimeStamp = XmlGetAttr(xNode, "stamp"); -- cgit v1.2.3