SVN commit 1146402 by mzanetti: escape < and newlines before encrypting and converting between plaintext and richtext M +3 -3 otrplugin.cpp --- trunk/KDE/kdenetwork/kopete/plugins/otr/otrplugin.cpp #1146401:1146402 @@ -161,13 +161,13 @@ bool plaintext = msg.format() == Qt::PlainText; kDebug(14318) << "Message format is" << (plaintext ? "plaintext" : "richtext"); if(plaintext){ - msgBody = msg.plainBody(); + msgBody = msg.plainBody().replace('<', "<"); cacheBody = msgBody; } else { msgBody = msg.escapedBody(); cacheBody = msgBody; } - kDebug(14318) << "Outgoing message before processing:" << msgBody; + kDebug(14318) << "Outgoing message before processing:" << msgBody << "escaped" << Kopete::Message::escape(msgBody); int encryptionState = otrlChatInterface->encryptMessage( &msgBody, accountId, msg.manager()->account()->protocol()->displayName(), contact->contactId(), msg.manager() ); @@ -315,7 +315,7 @@ } else if( msg.direction() == Kopete::Message::Outbound ){ // kDebug(14318) << "searching cache for" << msg.plainBody(); if( messageCache.contains( msg.plainBody() ) ){ - msg.setHtmlBody( messageCache[msg.plainBody()] ); + msg.setHtmlBody( messageCache[msg.plainBody()].replace('\n', "
")); messageCache.remove( messageCache[msg.plainBody()] ); if(messageCache.count() > 5) messageCache.clear(); }