Don't escape chat strings which go to engine
authorunc0rr
Tue, 06 Jan 2009 14:29:34 +0000
changeset 1587 b8a3d449bed7
parent 1586 2c6f1d1f43c1
child 1588 0988ae7771d3
Don't escape chat strings which go to engine
QTfrontend/chatwidget.cpp
QTfrontend/chatwidget.h
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
--- a/QTfrontend/chatwidget.cpp	Tue Jan 06 14:18:09 2009 +0000
+++ b/QTfrontend/chatwidget.cpp	Tue Jan 06 14:29:34 2009 +0000
@@ -22,6 +22,7 @@
 #include <QLineEdit>
 #include <QAction>
 #include <QApplication>
+#include <QTextDocument>
 
 #include "chatwidget.h"
 
@@ -74,6 +75,18 @@
 	if (chatStrings.size() > 250)
 		chatStrings.removeFirst();
 	
+	chatStrings.append(Qt::escape(str));
+	
+	chatText->setHtml(chatStrings.join("<br>"));
+
+	chatText->moveCursor(QTextCursor::End);
+}
+
+void HWChatWidget::onServerMessage(const QString& str)
+{
+	if (chatStrings.size() > 250)
+		chatStrings.removeFirst();
+	
 	chatStrings.append(str);
 	
 	chatText->setHtml(chatStrings.join("<br>"));
--- a/QTfrontend/chatwidget.h	Tue Jan 06 14:18:09 2009 +0000
+++ b/QTfrontend/chatwidget.h	Tue Jan 06 14:29:34 2009 +0000
@@ -36,6 +36,7 @@
 
  public slots:
   void onChatString(const QString& str);
+  void onServerMessage(const QString& str);
   void nickAdded(const QString& nick);
   void nickRemoved(const QString& nick);
   void clear();
--- a/QTfrontend/hwform.cpp	Tue Jan 06 14:18:09 2009 +0000
+++ b/QTfrontend/hwform.cpp	Tue Jan 06 14:29:34 2009 +0000
@@ -450,7 +450,7 @@
 		ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
 	
 	connect(hwnet, SIGNAL(serverMessage(const QString&)),
-		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
+		ui.pageRoomsList->chatWidget, SLOT(onServerMessage(const QString&)));
 
 	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
 		hwnet, SLOT(CreateRoom(const QString&)));
--- a/QTfrontend/newnetclient.cpp	Tue Jan 06 14:18:09 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Jan 06 14:29:34 2009 +0000
@@ -19,7 +19,6 @@
 
 #include <QMessageBox>
 #include <QDebug>
-#include <QTextDocument>
 
 #include "hwconsts.h"
 #include "newnetclient.h"
@@ -279,9 +278,9 @@
 		QStringList tmp = lst;
 		tmp.removeFirst();
 		if (netClientState == 2)
-			emit chatStringLobby(Qt::escape(tmp.join("\n")));
+			emit chatStringLobby(tmp.join("\n"));
 		else
-			emit chatStringFromNet(Qt::escape(tmp.join("\n")));
+			emit chatStringFromNet(tmp.join("\n"));
 		return;
 	}
 
@@ -648,9 +647,9 @@
 QString HWNewNet::formatChatMsg(const QString & nick, const QString & msg)
 {
 	if(msg.left(4) == "/me ")
-		return QString("* %1 %2").arg(Qt::escape(nick)).arg(Qt::escape(msg.mid(4)));
+		return QString("* %1 %2").arg(nick).arg(msg.mid(4));
 	else
-		return QString("%1: %2").arg(Qt::escape(nick)).arg(Qt::escape(msg));
+		return QString("%1: %2").arg(nick).arg(msg);
 }
 
 void HWNewNet::kickPlayer(const QString & nick)