send plain text message instead of html, when the text contains no html specifics. This is a huge gain in forum posts size, up to a factor of 50

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4247 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2011-06-10 21:16:38 +00:00
parent 29553d1ae3
commit 844aa174b5

View File

@ -144,6 +144,12 @@ void CreateForumMsg::createMsg()
QString name = misc::removeNewLine(ui.forumSubject->text()); QString name = misc::removeNewLine(ui.forumSubject->text());
QString desc = ui.forumMessage->toHtml(); QString desc = ui.forumMessage->toHtml();
if(desc == QTextDocument(ui.forumMessage->toPlainText()).toHtml())
{
desc = ui.forumMessage->toPlainText() ;
std::cerr << "Optimized forum message to " << desc.length() << " bytes , instead of " << ui.forumMessage->toHtml().length() << std::endl;
}
if(name.isEmpty()) if(name.isEmpty())
{ /* error message */ { /* error message */
QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"), QMessageBox::warning(this, tr("RetroShare"),tr("Please set a Forum Subject and Forum Message"),