[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/plugins/otr
From:       Michael Zanetti <michael_zanetti () gmx ! net>
Date:       2010-07-05 22:31:26
Message-ID: 20100705223126.5B50FAC85D () svn ! kde ! org
[Download RAW message or body]

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('<', "&lt;");
             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', "<br>"));
 			messageCache.remove( messageCache[msg.plainBody()] );
 			if(messageCache.count() > 5) messageCache.clear();
 		}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic