gameServer/HWProtoInRoomState.hs
changeset 9715 30a303d226f9
parent 9702 27006953d901
child 9753 9579596cf471
equal deleted inserted replaced
9713:cd1d63c355a6 9715:30a303d226f9
   321 handleCmd_inRoom ["DELEGATE", newAdmin] = do
   321 handleCmd_inRoom ["DELEGATE", newAdmin] = do
   322     (thisClientId, rnc) <- ask
   322     (thisClientId, rnc) <- ask
   323     maybeClientId <- clientByNick newAdmin
   323     maybeClientId <- clientByNick newAdmin
   324     master <- liftM isMaster thisClient
   324     master <- liftM isMaster thisClient
   325     serverAdmin <- liftM isAdministrator thisClient
   325     serverAdmin <- liftM isAdministrator thisClient
       
   326     thisRoomMasterId <- liftM masterID thisRoom
   326     let newAdminId = fromJust maybeClientId
   327     let newAdminId = fromJust maybeClientId
   327     let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
   328     let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
   328     return
   329     return
   329         [ChangeMaster (Just newAdminId) |
   330         [ChangeMaster (Just newAdminId) |
   330             (master || serverAdmin)
   331             (master || serverAdmin)
   331                 && isJust maybeClientId
   332                 && isJust maybeClientId
   332                 && ((newAdminId /= thisClientId) || (serverAdmin && not master))
   333                 && ((newAdminId /= thisClientId) || (serverAdmin && not master))
       
   334                 && (newAdminId /= thisRoomMasterId)
   333                 && sameRoom]
   335                 && sameRoom]
   334 
   336 
   335 
   337 
   336 handleCmd_inRoom ["TEAMCHAT", msg] = do
   338 handleCmd_inRoom ["TEAMCHAT", msg] = do
   337     cl <- thisClient
   339     cl <- thisClient