equal
deleted
inserted
replaced
40 where |
40 where |
41 f r = if paramName `Map.member` (mapParams r) then |
41 f r = if paramName `Map.member` (mapParams r) then |
42 r{mapParams = Map.insert paramName (head paramStrs) (mapParams r)} |
42 r{mapParams = Map.insert paramName (head paramStrs) (mapParams r)} |
43 else |
43 else |
44 r{params = Map.insert paramName paramStrs (params r)} |
44 r{params = Map.insert paramName paramStrs (params r)} |
|
45 |
45 |
46 |
46 handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo) |
47 handleCmd_inRoom ("ADD_TEAM" : tName : color : grave : fort : voicepack : flag : difStr : hhsInfo) |
47 | length hhsInfo /= 16 = return [ProtocolError $ loc "Corrupted hedgehogs info"] |
48 | length hhsInfo /= 16 = return [ProtocolError $ loc "Corrupted hedgehogs info"] |
48 | otherwise = do |
49 | otherwise = do |
49 (ci, _) <- ask |
50 (ci, _) <- ask |
288 [ProtocolError $ loc "Not room master"] |
289 [ProtocolError $ loc "Not room master"] |
289 else |
290 else |
290 if illegalName newName then |
291 if illegalName newName then |
291 [Warning $ loc "Illegal room name"] |
292 [Warning $ loc "Illegal room name"] |
292 else |
293 else |
|
294 if isSpecial rm then |
|
295 [Warning $ loc "Restricted"] |
|
296 else |
293 if isJust $ find (\r -> newName == name r) rs then |
297 if isJust $ find (\r -> newName == name r) rs then |
294 [Warning $ loc "Room with such name already exists"] |
298 [Warning $ loc "Room with such name already exists"] |
295 else |
299 else |
296 [ModifyRoom roomUpdate, |
300 [ModifyRoom roomUpdate, |
297 AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (clientProto cl) (nick cl) (roomUpdate rm))] |
301 AnswerClients chans ("ROOM" : "UPD" : name rm : roomInfo (clientProto cl) (nick cl) (roomUpdate rm))] |
329 return |
333 return |
330 [ChangeMaster (Just newAdminId) | |
334 [ChangeMaster (Just newAdminId) | |
331 (master || serverAdmin) |
335 (master || serverAdmin) |
332 && isJust maybeClientId |
336 && isJust maybeClientId |
333 && ((newAdminId /= thisClientId) || (serverAdmin && not master)) |
337 && ((newAdminId /= thisClientId) || (serverAdmin && not master)) |
334 && (newAdminId /= thisRoomMasterId) |
338 && (Just newAdminId /= thisRoomMasterId) |
335 && sameRoom] |
339 && sameRoom] |
336 |
340 |
337 |
341 |
338 handleCmd_inRoom ["TEAMCHAT", msg] = do |
342 handleCmd_inRoom ["TEAMCHAT", msg] = do |
339 cl <- thisClient |
343 cl <- thisClient |
360 handleCmd_inRoom ("RND":rs) = do |
364 handleCmd_inRoom ("RND":rs) = do |
361 n <- clientNick |
365 n <- clientNick |
362 s <- roomClientsChans |
366 s <- roomClientsChans |
363 return [AnswerClients s ["CHAT", n, B.unwords $ "/rnd" : rs], Random s rs] |
367 return [AnswerClients s ["CHAT", n, B.unwords $ "/rnd" : rs], Random s rs] |
364 |
368 |
|
369 handleCmd_inRoom ["FIX"] = do |
|
370 cl <- thisClient |
|
371 return [ModifyRoom (\r -> r{isSpecial = True}) | isAdministrator cl] |
|
372 |
|
373 |
365 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
374 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
366 |
375 |
367 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |
376 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |
368 |
377 |
369 handleCmd_inRoom [] = return [ProtocolError "Empty command (state: in room)"] |
378 handleCmd_inRoom [] = return [ProtocolError "Empty command (state: in room)"] |