22 return [AnswerClients s ["CHAT", n, msg]] |
22 return [AnswerClients s ["CHAT", n, msg]] |
23 |
23 |
24 handleCmd_inRoom ["PART"] = return [MoveToLobby "part"] |
24 handleCmd_inRoom ["PART"] = return [MoveToLobby "part"] |
25 handleCmd_inRoom ["PART", msg] = return [MoveToLobby $ "part: " `B.append` msg] |
25 handleCmd_inRoom ["PART", msg] = return [MoveToLobby $ "part: " `B.append` msg] |
26 |
26 |
|
27 |
|
28 handleCmd_inRoom ("CFG" : paramName : paramStrs) |
|
29 | null paramStrs = return [ProtocolError "Empty config entry"] |
|
30 | otherwise = do |
|
31 chans <- roomOthersChans |
|
32 cl <- thisClient |
|
33 if isMaster cl then |
|
34 return [ |
|
35 ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)}), |
|
36 AnswerClients chans ("CFG" : paramName : paramStrs)] |
|
37 else |
|
38 return [ProtocolError "Not room master"] |
|
39 |
27 {- |
40 {- |
28 |
|
29 handleCmd_inRoom clID clients rooms ("CFG" : paramName : paramStrs) |
|
30 | null paramStrs = [ProtocolError "Empty config entry"] |
|
31 | isMaster client = |
|
32 [ModifyRoom (\r -> r{params = Map.insert paramName paramStrs (params r)}), |
|
33 AnswerOthersInRoom ("CFG" : paramName : paramStrs)] |
|
34 | otherwise = [ProtocolError "Not room master"] |
|
35 where |
|
36 client = clients IntMap.! clID |
|
37 |
|
38 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : flag : difStr : hhsInfo) |
41 handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : flag : difStr : hhsInfo) |
39 | length hhsInfo == 15 && clientProto client < 30 = handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : " " : flag : difStr : hhsInfo) |
42 | length hhsInfo == 15 && clientProto client < 30 = handleCmd_inRoom clID clients rooms ("ADD_TEAM" : name : color : grave : fort : voicepack : " " : flag : difStr : hhsInfo) |
40 | length hhsInfo /= 16 = [ProtocolError "Corrupted hedgehogs info"] |
43 | length hhsInfo /= 16 = [ProtocolError "Corrupted hedgehogs info"] |
41 | length (teams room) == 6 = [Warning "too many teams"] |
44 | length (teams room) == 6 = [Warning "too many teams"] |
42 | canAddNumber <= 0 = [Warning "too many hedgehogs"] |
45 | canAddNumber <= 0 = [Warning "too many hedgehogs"] |