56 if null (room client) then |
56 if null (room client) then |
57 (noChangeClients, noChangeRooms, answerQuit) |
57 (noChangeClients, noChangeRooms, answerQuit) |
58 else if isMaster client then |
58 else if isMaster client then |
59 (noChangeClients, removeRoom (room client), answerQuit ++ answerAbandoned) -- core disconnects clients on ROOMABANDONED answer |
59 (noChangeClients, removeRoom (room client), answerQuit ++ answerAbandoned) -- core disconnects clients on ROOMABANDONED answer |
60 else |
60 else |
61 (noChangeClients, modifyRoom clRoom{teams = othersTeams}, answerQuit ++ (answerQuitInform $ nick client) ++ answerRemoveClientTeams ++ answerLostTeams) |
61 (noChangeClients, modifyRoom clRoom{teams = othersTeams}, answerQuit ++ (answerQuitInform $ nick client) ++ answerRemoveClientTeams) |
62 where |
62 where |
63 clRoom = roomByName (room client) rooms |
63 clRoom = roomByName (room client) rooms |
64 answerRemoveClientTeams = map (\tn -> (othersInRoom, ["REMOVE_TEAM", teamname tn])) clientTeams |
64 answerRemoveClientTeams = map (\tn -> (othersInRoom, ["REMOVE_TEAM", teamname tn])) clientTeams |
65 (clientTeams, othersTeams) = partition (\t -> teamowner t == nick client) $ teams clRoom |
65 (clientTeams, othersTeams) = partition (\t -> teamowner t == nick client) $ teams clRoom |
66 answerLostTeams = if gameinprogress clRoom then answerInGameLostTeams clientTeams else [] |
|
67 answerInGameLostTeams teams = [] |
|
68 |
|
69 |
66 |
70 |
67 |
71 -- check state and call state-dependent commmand handlers |
68 -- check state and call state-dependent commmand handlers |
72 handleCmd client clients rooms cmd = |
69 handleCmd client clients rooms cmd = |
73 if null (nick client) || protocol client == 0 then |
70 if null (nick client) || protocol client == 0 then |