equal
deleted
inserted
replaced
217 readyPlayers = if ready then readyPlayers r - 1 else readyPlayers r |
217 readyPlayers = if ready then readyPlayers r - 1 else readyPlayers r |
218 }) ri |
218 }) ri |
219 moveClientToLobby rnc ci |
219 moveClientToLobby rnc ci |
220 |
220 |
221 processAction ChangeMaster = do |
221 processAction ChangeMaster = do |
222 ri <- clientRoomA |
222 (Just ci) <- gets clientIndex |
223 rnc <- gets roomsClients |
223 ri <- clientRoomA |
224 newMasterId <- liftM head . io $ roomClientsIndicesM rnc ri |
224 rnc <- gets roomsClients |
|
225 newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri |
225 newMaster <- io $ client'sM rnc id newMasterId |
226 newMaster <- io $ client'sM rnc id newMasterId |
226 let newRoomName = nick newMaster |
227 let newRoomName = nick newMaster |
227 mapM_ processAction [ |
228 mapM_ processAction [ |
228 ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName}), |
229 ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName}), |
229 ModifyClient2 newMasterId (\c -> c{isMaster = True}), |
230 ModifyClient2 newMasterId (\c -> c{isMaster = True}), |
405 modify (\s -> s{clientIndex = Just newClId}) |
406 modify (\s -> s{clientIndex = Just newClId}) |
406 mapM_ processAction |
407 mapM_ processAction |
407 [ |
408 [ |
408 AnswerClients [sendChan cl] ["CONNECTED", "Hedgewars server http://www.hedgewars.org/", serverVersion] |
409 AnswerClients [sendChan cl] ["CONNECTED", "Hedgewars server http://www.hedgewars.org/", serverVersion] |
409 , CheckBanned |
410 , CheckBanned |
410 , AddIP2Bans (host cl) "Reconnected too fast" (addUTCTime 10 $ connectTime cl) |
411 -- , AddIP2Bans (host cl) "Reconnected too fast" (addUTCTime 10 $ connectTime cl) |
411 ] |
412 ] |
412 |
413 |
413 |
414 |
414 processAction (AddNick2Bans n reason expiring) = do |
415 processAction (AddNick2Bans n reason expiring) = do |
415 processAction $ ModifyServerInfo (\s -> s{bans = BanByNick n reason expiring : bans s}) |
416 processAction $ ModifyServerInfo (\s -> s{bans = BanByNick n reason expiring : bans s}) |