send msg in plain text when the html encoding does not change anything into the message. This drastically reduces messages size.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4599 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-09-09 19:54:17 +00:00
parent b73fd06753
commit dc0f4ef68a

View File

@ -1164,6 +1164,13 @@ bool MessageComposer::sendMessage_internal(bool bDraftbox)
mi.title = misc::removeNewLine(ui.titleEdit->text()).toStdWString();
mi.msg = ui.msgText->toHtml().toStdWString();
if(ui.msgText->toHtml() == QTextDocument(ui.msgText->toPlainText()).toHtml())
{
mi.msg = ui.msgText->toPlainText().toStdWString() ;
std::cerr << "Optimized forum message to " << mi.msg.length() << " bytes , instead of " << ui.msgText->toHtml().length() << std::endl;
}
/* check for existing title */
if (bDraftbox == false && mi.title.empty()) {
if (QMessageBox::warning(this, tr("RetroShare"), tr("Do you want to send the message without a subject ?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) {