SVN commit 919435 by mzanetti:
backport of plaintext handling fix.
M +4 -3 otrlchatinterface.cpp
M +7 -2 otrplugin.cpp
--- branches/KDE/4.2/kdenetwork/kopete/plugins/otr/otrlchatinterface.cpp #919434:919435
@@ -522,12 +522,13 @@
if( newMessage != NULL ){
*msg = QString::fromUtf8(newMessage);
otrl_message_free( newMessage );
+ msg->replace( QString('\n'), QString("
") );
+ return 0; // message is decrypted and ready to deliver
} else {
- msg->replace( QString('<'), QString("<") );
+ return 1; // message was a plaintext message. Better not touching it :)
}
- msg->replace( QString('\n'), QString("
") );
}
- return ignoremessage;
+ return 2; // internal OTR message. Ignore it.
}
KDE_EXPORT QString *OtrlChatInterface::encryptMessage( QString *msg, const QString &accountId,
--- branches/KDE/4.2/kdenetwork/kopete/plugins/otr/otrplugin.cpp #919434:919435
@@ -243,11 +243,16 @@
QString body = msg.plainBody();
QString accountId = msg.manager()->account()->accountId();
QString contactId = msg.from()->contactId();
- int ignoremessage = OtrlChatInterface::self()->decryptMessage( &body, accountId, msg.manager()->account()->protocol()->displayName(), contactId, msg.manager() );
+ int retValue = OtrlChatInterface::self()->decryptMessage( &body, accountId, msg.manager()->account()->protocol()->displayName(), contactId, msg.manager() );
msg.setHtmlBody( body );
- if( ignoremessage | OtrlChatInterface::self()->shouldDiscard( msg.plainBody() ) ){
+ if( retValue == 2 | OtrlChatInterface::self()->shouldDiscard( msg.plainBody() ) ){
+ // internal OTR message
event->discard();
return;
+ } else if(retValue == 1){
+ // plaintext message. Proceed with next plugin
+ MessageHandler::handleMessage( event );
+ return;
}
} else if( msg.direction() == Kopete::Message::Outbound ){
if( messageCache.contains( msg.plainBody() ) ){