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