let frontend send (copypasta) multi-line messages line by line to avoid protocol violation
authorsheepluva
Thu, 22 Sep 2011 14:02:44 +0200
changeset 5990 578978418fe5
parent 5989 23407ecb1826
child 5991 c3b7064d9226
let frontend send (copypasta) multi-line messages line by line to avoid protocol violation
QTfrontend/chatwidget.cpp
--- a/QTfrontend/chatwidget.cpp	Thu Sep 22 11:44:39 2011 +0400
+++ b/QTfrontend/chatwidget.cpp	Thu Sep 22 14:02:44 2011 +0200
@@ -30,6 +30,7 @@
 #include <QCursor>
 #include <QScrollBar>
 #include <QItemSelectionModel>
+#include <QStringList>
 
 #include "hwconsts.h"
 #include "SDLs.h"
@@ -313,8 +314,10 @@
 
 void HWChatWidget::returnPressed()
 {
-    emit chatLine(chatEditLine->text());
+    QStringList lines = chatEditLine->text().split('\n');
     chatEditLine->clear();
+    foreach (const QString &line, lines)
+        emit chatLine(line);
 }