gameServer/HWProtoNEState.hs
changeset 3538 b11ac2677e42
parent 3536 7d99655130ff
child 3566 772a46ef8288
--- a/gameServer/HWProtoNEState.hs	Tue Jun 22 22:21:44 2010 +0400
+++ b/gameServer/HWProtoNEState.hs	Tue Jun 22 22:40:49 2010 +0400
@@ -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