Use another event to change state from 'logging in' to 'lobby'
authorunc0rr
Tue, 24 Feb 2009 19:39:10 +0000
changeset 1838 00a5fc50aa43
parent 1837 650884b2e8c1
child 1839 5dd4cb7fd7e5
Use another event to change state from 'logging in' to 'lobby'
QTfrontend/newnetclient.cpp
--- a/QTfrontend/newnetclient.cpp	Tue Feb 24 19:38:49 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Tue Feb 24 19:39:10 2009 +0000
@@ -201,14 +201,9 @@
 		return;
 	}
 
-	if ((lst[0] == "NICK") || (lst[0] == "PROTO"))
+	if (lst[0] == "NICK")
 	{
-		loginStep++;
-		if (loginStep == 2)
-		{
-			netClientState = 2;
-			RawSendNet(QString("LIST"));
-		}
+		mynick = lst[1];
 		return ;
 	}
 
@@ -339,14 +334,14 @@
 		return;
 	}
 
-	if(lst[0]=="ROOMABANDONED") {
+	if(lst[0] == "ROOMABANDONED") {
 		netClientState = 2;
 		emit showMessage(HWNewNet::tr("Room destroyed"));
 		emit LeftRoom();
 		return;
 	}
 
-	if(lst[0]=="JOINED") {
+	if(lst[0] == "JOINED") {
 		if(lst.size() < 2)
 		{
 			qWarning("Net: Bad JOINED message");
@@ -368,7 +363,7 @@
 		return;
 	}
 
-	if(lst[0]=="LOBBY:JOINED") {
+	if(lst[0] == "LOBBY:JOINED") {
 		if(lst.size() < 2)
 		{
 			qWarning("Net: Bad JOINED message");
@@ -377,6 +372,12 @@
 		
 		for(int i = 1; i < lst.size(); ++i)
 		{
+			if (lst[i] == mynick)
+			{
+				netClientState = 2;
+				RawSendNet(QString("LIST"));
+			}
+
 			emit nickAddedLobby(lst[i]);
 			emit chatStringLobby(QString(tr("*** %1 joined")).arg(lst[i]));
 		}