QTfrontend/net/newnetclient.cpp
changeset 9549 ac5c1f691ce2
parent 9541 312bb4384f33
child 9702 27006953d901
--- a/QTfrontend/net/newnetclient.cpp	Tue Oct 15 22:38:32 2013 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Tue Oct 15 23:07:22 2013 +0400
@@ -112,7 +112,7 @@
     isChief = true;
 }
 
-void HWNewNet::JoinRoom(const QString & room)
+void HWNewNet::JoinRoom(const QString & room, const QString &password)
 {
     if(netClientState != InLobby)
     {
@@ -122,7 +122,11 @@
 
     myroom = room;
 
-    RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room));
+    if(password.isEmpty())
+        RawSendNet(QString("JOIN_ROOM%1%2").arg(delimeter).arg(room));
+    else
+        RawSendNet(QString("JOIN_ROOM%1%2%1%3").arg(delimeter).arg(room).arg(password));
+
     isChief = false;
 }
 
@@ -1069,10 +1073,11 @@
     switch(n)
     {
         case 0:
-        {
             emit NickTaken(mynick);
             break;
-        }
+        case 2:
+            emit askForRoomPassword();
+            break;
     }
 }
 
@@ -1090,3 +1095,9 @@
 {
     return m_roomPlayersModel;
 }
+
+void HWNewNet::roomPasswordEntered(const QString &password)
+{
+    if(!myroom.isEmpty())
+        JoinRoom(myroom, password);
+}