QTfrontend/net/newnetclient.cpp
changeset 14865 90cf07c60feb
parent 14838 bdb47255d7e4
child 14866 e088bd03812d
--- a/QTfrontend/net/newnetclient.cpp	Tue Apr 30 22:43:48 2019 +0200
+++ b/QTfrontend/net/newnetclient.cpp	Wed May 01 00:01:56 2019 +0300
@@ -80,7 +80,7 @@
     NetSocket.flush();
 }
 
-void HWNewNet::Connect(const QString & hostName, quint16 port, const QString & nick)
+void HWNewNet::Connect(const QString & hostName, quint16 port, bool useTls, const QString & nick)
 {
     netClientState = Connecting;
     mynick = nick;
@@ -257,6 +257,17 @@
     maybeSendPassword();
 }
 
+void HWNewNet::ContinueConnection()
+{
+    if (netClientState == Connected)    
+    {
+        RawSendNet(QString("NICK%1%2").arg(delimiter).arg(mynick));
+        RawSendNet(QString("PROTO%1%2").arg(delimiter).arg(*cProtoVer));    
+        m_game_connected = true;
+        emit adminAccess(false);
+    }
+}
+
 void HWNewNet::ParseCmd(const QStringList & lst)
 {
     qDebug() << "Server: " << lst;
@@ -311,6 +322,7 @@
         }
         else 
         {
+            netClientState = Redirected;
             emit redirected(port);
         }
         return;
@@ -328,11 +340,12 @@
             return;
         }
 
-        RawSendNet(QString("NICK%1%2").arg(delimiter).arg(mynick));
-        RawSendNet(QString("PROTO%1%2").arg(delimiter).arg(*cProtoVer));
-        netClientState = Connected;
-        m_game_connected = true;
-        emit adminAccess(false);
+        ClientState lastState = netClientState;
+        netClientState = Connected;      
+        if (lastState != Redirected)
+        {
+            ContinueConnection();
+        }
         return;
     }