gameServer/HWProtoInRoomState.hs
changeset 9770 5706b637bae2
parent 9753 9579596cf471
child 9787 0da6ba2f1f93
equal deleted inserted replaced
9769:5814e0c47c99 9770:5706b637bae2
    29 handleCmd_inRoom ("CFG" : paramName : paramStrs)
    29 handleCmd_inRoom ("CFG" : paramName : paramStrs)
    30     | null paramStrs = return [ProtocolError $ loc "Empty config entry"]
    30     | null paramStrs = return [ProtocolError $ loc "Empty config entry"]
    31     | otherwise = do
    31     | otherwise = do
    32         chans <- roomOthersChans
    32         chans <- roomOthersChans
    33         cl <- thisClient
    33         cl <- thisClient
    34         if isMaster cl then
    34         rm <- thisRoom
       
    35 
       
    36         if isSpecial rm then
       
    37             return [Warning $ loc "Restricted"]
       
    38         else if isMaster cl then
    35            return [
    39            return [
    36                 ModifyRoom f,
    40                 ModifyRoom f,
    37                 AnswerClients chans ("CFG" : paramName : paramStrs)]
    41                 AnswerClients chans ("CFG" : paramName : paramStrs)]
    38             else
    42             else
    39             return [ProtocolError $ loc "Not room master"]
    43             return [ProtocolError $ loc "Not room master"]
   289             [ProtocolError $ loc "Not room master"]
   293             [ProtocolError $ loc "Not room master"]
   290         else
   294         else
   291         if illegalName newName then 
   295         if illegalName newName then 
   292             [Warning $ loc "Illegal room name"]
   296             [Warning $ loc "Illegal room name"]
   293         else
   297         else
   294         if isSpecial rm then 
   298         if isSpecial rm then
   295             [Warning $ loc "Restricted"]
   299             [Warning $ loc "Restricted"]
   296         else
   300         else
   297         if isJust $ find (\r -> newName == name r) rs then
   301         if isJust $ find (\r -> newName == name r) rs then
   298             [Warning $ loc "Room with such name already exists"]
   302             [Warning $ loc "Room with such name already exists"]
   299         else
   303         else
   368 
   372 
   369 handleCmd_inRoom ["FIX"] = do
   373 handleCmd_inRoom ["FIX"] = do
   370     cl <- thisClient
   374     cl <- thisClient
   371     return [ModifyRoom (\r -> r{isSpecial = True}) | isAdministrator cl]
   375     return [ModifyRoom (\r -> r{isSpecial = True}) | isAdministrator cl]
   372 
   376 
       
   377 handleCmd_inRoom ["UNFIX"] = do
       
   378     cl <- thisClient
       
   379     return [ModifyRoom (\r -> r{isSpecial = False}) | isAdministrator cl]
       
   380 
   373 
   381 
   374 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)
   382 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)
   375 
   383 
   376 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"]
   384 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"]
   377 
   385