gameServer/Actions.hs
changeset 4991 90d1fb9fc2e1
parent 4989 4771fed9272e
child 4998 cdcdf37e5532
equal deleted inserted replaced
4990:4b5d62ac01f7 4991:90d1fb9fc2e1
   313 
   313 
   314 processAction CheckRegistered = do
   314 processAction CheckRegistered = do
   315     (Just ci) <- gets clientIndex
   315     (Just ci) <- gets clientIndex
   316     n <- client's nick
   316     n <- client's nick
   317     h <- client's host
   317     h <- client's host
       
   318     p <- client's clientProto
   318     uid <- client's clUID
   319     uid <- client's clUID
   319     db <- gets (dbQueries . serverInfo)
   320     haveSameNick <- liftM (not . null . tail . filter (\c -> nick c == n)) allClientsS
   320     io $ writeChan db $ CheckAccount ci (hashUnique uid) n h
   321     if haveSameNick then
   321     return ()
   322         if p < 38 then
       
   323             mapM_ processAction [ByeClient "Nickname is already in use", removeNick]
       
   324             else
       
   325             mapM_ processAction [NoticeMessage NickAlreadyInUse, removeNick]
       
   326         else
       
   327         do
       
   328         db <- gets (dbQueries . serverInfo)
       
   329         io $ writeChan db $ CheckAccount ci (hashUnique uid) n h
       
   330         return ()
       
   331    where
       
   332        removeNick = ModifyClient (\c -> c{nick = ""})
   322 
   333 
   323 
   334 
   324 processAction ClearAccountsCache = do
   335 processAction ClearAccountsCache = do
   325     dbq <- gets (dbQueries . serverInfo)
   336     dbq <- gets (dbQueries . serverInfo)
   326     io $ writeChan dbq ClearCache
   337     io $ writeChan dbq ClearCache