128 if isNothing ci || ri == lobbyId then |
128 if isNothing ci || ri == lobbyId then |
129 return [] |
129 return [] |
130 else |
130 else |
131 handleCmd_lobby ["JOIN_ROOM", name clRoom] |
131 handleCmd_lobby ["JOIN_ROOM", name clRoom] |
132 |
132 |
133 {- |
|
134 --------------------------- |
133 --------------------------- |
135 -- Administrator's stuff -- |
134 -- Administrator's stuff -- |
136 |
135 |
137 handleCmd_lobby clID clients rooms ["KICK", kickNick] = |
136 handleCmd_lobby ["KICK", kickNick] = do |
138 [KickClient kickID | isAdministrator client && (not noSuchClient) && kickID /= clID] |
137 (ci, _) <- ask |
139 where |
138 cl <- thisClient |
140 client = clients IntMap.! clID |
139 kickId <- clientByNick kickNick |
141 maybeClient = Foldable.find (\cl -> kickNick == nick cl) clients |
140 return [KickClient $ fromJust kickId | isAdministrator cl && isJust kickId && fromJust kickId /= ci] |
142 noSuchClient = isNothing maybeClient |
|
143 kickID = clientUID $ fromJust maybeClient |
|
144 |
141 |
145 |
142 {- |
146 handleCmd_lobby clID clients rooms ["BAN", banNick] = |
143 handleCmd_lobby clID clients rooms ["BAN", banNick] = |
147 if not $ isAdministrator client then |
144 if not $ isAdministrator client then |
148 [] |
145 [] |
149 else |
146 else |
150 BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] |
147 BanClient banNick : handleCmd_lobby clID clients rooms ["KICK", banNick] |