equal
deleted
inserted
replaced
250 |
250 |
251 |
251 |
252 handleCmd_inRoom ["ROOM_NAME", newName] = do |
252 handleCmd_inRoom ["ROOM_NAME", newName] = do |
253 cl <- thisClient |
253 cl <- thisClient |
254 rs <- allRoomInfos |
254 rs <- allRoomInfos |
|
255 rm <- thisRoom |
|
256 chans <- sameProtoChans |
255 |
257 |
256 return $ |
258 return $ |
257 if not $ isMaster cl then |
259 if not $ isMaster cl then |
258 [ProtocolError "Not room master"] |
260 [ProtocolError "Not room master"] |
259 else |
261 else |
260 if isJust $ find (\r -> newName == name r) rs then |
262 if isJust $ find (\r -> newName == name r) rs then |
261 [Warning "Room with such name already exists"] |
263 [Warning "Room with such name already exists"] |
262 else |
264 else |
263 [ModifyRoom (\r -> r{name = newName})] |
265 [ModifyRoom roomUpdate, |
|
266 AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (nick cl) (roomUpdate rm))] |
|
267 where |
|
268 roomUpdate r = r{name = newName} |
264 |
269 |
265 |
270 |
266 handleCmd_inRoom ["KICK", kickNick] = do |
271 handleCmd_inRoom ["KICK", kickNick] = do |
267 (thisClientId, rnc) <- ask |
272 (thisClientId, rnc) <- ask |
268 maybeClientId <- clientByNick kickNick |
273 maybeClientId <- clientByNick kickNick |