gameServer/HWProtoNEState.hs
changeset 3545 b07ee704f35d
parent 3538 b11ac2677e42
child 3566 772a46ef8288
--- a/gameServer/HWProtoNEState.hs	Wed Jun 23 21:18:48 2010 +0200
+++ b/gameServer/HWProtoNEState.hs	Wed Jun 23 21:39:14 2010 +0200
@@ -20,8 +20,8 @@
     let cl = irnc `client` ci
     if not . B.null $ nick cl then return [ProtocolError "Nickname already chosen"]
         else
-        if haveSameNick irnc then return [AnswerClients [sendChan cl] ["WARNING", "Nickname already in use"], ByeClient ""]
-            else 
+        if haveSameNick irnc (nick cl) then return [AnswerClients [sendChan cl] ["WARNING", "Nickname already in use"], ByeClient ""]
+            else
             if illegalName newNick then return [ByeClient "Illegal nickname"]
                 else
                 return $
@@ -29,8 +29,7 @@
                     AnswerClients [sendChan cl] ["NICK", newNick] :
                     [CheckRegistered | clientProto cl /= 0]
     where
-        haveSameNick irnc = False --isJust $ find (\cl -> newNick == nick cl) $ IntMap.elems clients
-
+    haveSameNick irnc clNick = isJust $ find (\cl -> newNick == clNick) $ map (client irnc) $ allClients irnc
 
 handleCmd_NotEntered ["PROTO", protoNum] = do
     (ci, irnc) <- ask