Send QUIT message to server when netclient object is destroyed
authorunc0rr
Thu, 04 Dec 2008 21:15:01 +0000
changeset 1526 18e412dd7d50
parent 1525 311d0ab35d98
child 1527 4a610e970b66
Send QUIT message to server when netclient object is destroyed
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
--- a/QTfrontend/newnetclient.cpp	Thu Dec 04 21:14:03 2008 +0000
+++ b/QTfrontend/newnetclient.cpp	Thu Dec 04 21:15:01 2008 +0000
@@ -45,6 +45,13 @@
 			SLOT(displayError(QAbstractSocket::SocketError)));
 }
 
+HWNewNet::~HWNewNet()
+{
+	if (m_game_connected)
+		RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
+	NetSocket.flush();
+}
+
 void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick)
 {
 	mynick = nick;
@@ -54,7 +61,7 @@
 void HWNewNet::Disconnect()
 {
 	if (m_game_connected)
-		RawSendNet(QString("QUIT"));
+		RawSendNet(QString("QUIT%1%2").arg(delimeter).arg("User quit"));
 	m_game_connected = false;
 	NetSocket.disconnectFromHost();
 }
--- a/QTfrontend/newnetclient.h	Thu Dec 04 21:14:03 2008 +0000
+++ b/QTfrontend/newnetclient.h	Thu Dec 04 21:15:01 2008 +0000
@@ -39,6 +39,7 @@
 
  public:
   HWNewNet(GameUIConfig * config, GameCFGWidget* pGameCFGWidget, TeamSelWidget* pTeamSelWidget);
+  ~HWNewNet();
   void Connect(const QString & hostName, quint16 port, const QString & nick);
   void Disconnect();
   bool isRoomChief();