Don't send LEFT message for clients without nick
authorunc0rr
Mon, 05 Jan 2009 19:44:43 +0000
changeset 1581 2dfa315b4bb2
parent 1580 971e7f057a86
child 1582 262245ba6ea6
Don't send LEFT message for clients without nick
QTfrontend/newnetclient.cpp
netserver/HWProto.hs
--- a/QTfrontend/newnetclient.cpp	Mon Jan 05 17:03:49 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Mon Jan 05 19:44:43 2009 +0000
@@ -385,7 +385,7 @@
 	if(lst[0] == "LOBBY:LEFT") {
 		if(lst.size() < 2)
 		{
-			qWarning("Net: Bad LEFT message");
+			qWarning("Net: Bad LOBBY:LEFT message");
 			return;
 		}
 		emit nickRemovedLobby(lst[1]);
--- a/netserver/HWProto.hs	Mon Jan 05 17:03:49 2009 +0000
+++ b/netserver/HWProto.hs	Mon Jan 05 19:44:43 2009 +0000
@@ -61,10 +61,13 @@
 		else
 		answerOthersRoom ["LEFT", nick]
 answerQuitLobby nick msg =
-	if not $ null msg then
-		answerAll ["LOBBY:LEFT", nick, msg]
+	if not $ null nick then
+		if not $ null msg then
+			answerAll ["LOBBY:LEFT", nick, msg]
 		else
-		answerAll ["LOBBY:LEFT", nick]
+			answerAll ["LOBBY:LEFT", nick]
+	else
+		[]
 
 answerJoined nick   = answerSameRoom ["JOINED", nick]
 answerRunGame       = answerSameRoom ["RUN_GAME"]