# HG changeset patch # User unc0rr # Date 1277232049 -14400 # Node ID b11ac2677e429998d4a12f08f8c78404ef63647d # Parent 7d99655130ffc7c12be837fe2a7d075b776dc6b0 Restore test for already used nick diff -r 7d99655130ff -r b11ac2677e42 gameServer/HWProtoNEState.hs --- 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