Fix doubling chat message
authorunc0rr
Wed, 15 Oct 2008 16:59:11 +0000
changeset 1360 d3e285281c26
parent 1359 c7703c653865
child 1361 afdcf39c6bea
Fix doubling chat message
QTfrontend/chatwidget.cpp
QTfrontend/chatwidget.h
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
QTfrontend/proto.cpp
--- a/QTfrontend/chatwidget.cpp	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/chatwidget.cpp	Wed Oct 15 16:59:11 2008 +0000
@@ -55,7 +55,7 @@
   chatEditLine->clear();
 }
 
-void HWChatWidget::onChatStringFromNet(const QString& str)
+void HWChatWidget::onChatString(const QString& str)
 {
   QListWidget* w = chatText;
   w->addItem(str);
--- a/QTfrontend/chatwidget.h	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/chatwidget.h	Wed Oct 15 16:59:11 2008 +0000
@@ -34,7 +34,7 @@
   HWChatWidget(QWidget* parent=0);
 
  public slots:
-  void onChatStringFromNet(const QString& str);
+  void onChatString(const QString& str);
   void nickAdded(const QString& nick);
   void nickRemoved(const QString& nick);
   void clear();
--- a/QTfrontend/hwform.cpp	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/hwform.cpp	Wed Oct 15 16:59:11 2008 +0000
@@ -431,7 +431,9 @@
 		hwnet, SLOT(askRoomsList()));
 
 	connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
-		ui.pageNetGame->pChatWidget, SLOT(onChatStringFromNet(const QString&)));
+		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
+	connect(hwnet, SIGNAL(chatStringFromMet(const QString&)),
+		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
 	connect(ui.pageNetGame->pChatWidget, SIGNAL(chatLine(const QString&)),
 		hwnet, SLOT(chatLineToNet(const QString&)));
 	connect(hwnet, SIGNAL(nickAdded(const QString&)),
--- a/QTfrontend/newnetclient.cpp	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Wed Oct 15 16:59:11 2008 +0000
@@ -482,7 +482,7 @@
 {
   if(str!="") {
     RawSendNet(QString("CHAT_STRING")+delimeter+str);
-    emit(chatStringFromNet(QString("%1: %2").arg(mynick).arg(str)));
+    emit(chatStringFromMe(QString("%1: %2").arg(mynick).arg(str)));
   }
 }
 
--- a/QTfrontend/newnetclient.h	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/newnetclient.h	Wed Oct 15 16:59:11 2008 +0000
@@ -105,6 +105,7 @@
   void hhnumChanged(const HWTeam&);
   void teamColorChanged(const HWTeam&);
   void chatStringFromNet(const QString&);
+  void chatStringFromMe(const QString&);
   void ammoChanged(const QString& name, const QString& ammo);
   void roomsList(const QStringList&);
 
--- a/QTfrontend/proto.cpp	Wed Oct 15 16:54:05 2008 +0000
+++ b/QTfrontend/proto.cpp	Wed Oct 15 16:59:11 2008 +0000
@@ -26,6 +26,7 @@
 QByteArray & HWProto::addStringToBuffer(QByteArray & buf, const QString & string)
 {
 	QByteArray strmsg = string.toUtf8();
+	strmsg.left(250);
 	quint8 sz = strmsg.size();
 	buf.append(QByteArray((char *)&sz, 1));
 	buf.append(strmsg);