--- a/gameServer/HWProtoLobbyState.hs Sat Jun 06 12:42:35 2009 +0000
+++ b/gameServer/HWProtoLobbyState.hs Sun Jun 07 07:42:40 2009 +0000
@@ -44,6 +44,8 @@
handleCmd_lobby clID clients rooms ["CREATE_ROOM", newRoom, roomPassword] =
if haveSameRoom then
[Warning "Room exists"]
+ else if illegalName newRoom then
+ [Warning "Illegal room name"]
else
[RoomRemoveThisClient "", -- leave lobby
AddRoom newRoom roomPassword,
--- a/gameServer/HWProtoNEState.hs Sat Jun 06 12:42:35 2009 +0000
+++ b/gameServer/HWProtoNEState.hs Sun Jun 07 07:42:40 2009 +0000
@@ -13,10 +13,12 @@
handleCmd_NotEntered clID clients _ ["NICK", newNick] =
if not . null $ nick client then
- [ProtocolError "Nick already chosen"]
+ [ProtocolError "Nickname already chosen"]
else if haveSameNick then
- [AnswerThisClient ["WARNING", "Nick collision"]]
+ [AnswerThisClient ["WARNING", "Nickname collision"]]
++ [ByeClient ""]
+ else if illegalName newNick then
+ [ByeClient "Illegal nickname"]
else
[ModifyClient (\c -> c{nick = newNick}),
AnswerThisClient ["NICK", newNick]]
--- a/gameServer/Utils.hs Sat Jun 06 12:42:35 2009 +0000
+++ b/gameServer/Utils.hs Sun Jun 07 07:42:40 2009 +0000
@@ -57,6 +57,9 @@
else
t : replaceTeam team teams
+illegalName :: String -> Bool
+illegalName str = all isSpace str
+
protoNumber2ver :: Word16 -> String
protoNumber2ver 17 = "0.9.7-dev"
protoNumber2ver 19 = "0.9.7"