Fix room admin rights delegation by server admin when he isn't room admin
authorunc0rr
Mon, 27 May 2013 23:54:52 +0400
changeset 9062 a65492ca1587
parent 9061 38e8787483db
child 9063 5cab446e1341
Fix room admin rights delegation by server admin when he isn't room admin
gameServer/Actions.hs
--- a/gameServer/Actions.hs	Mon May 27 23:24:35 2013 +0400
+++ b/gameServer/Actions.hs	Mon May 27 23:54:52 2013 +0400
@@ -207,8 +207,9 @@
     rnc <- gets roomsClients
     newMasterId <- liftM (\ids -> fromMaybe (last . filter (/= ci) $ ids) delegateId) . io $ roomClientsIndicesM rnc ri
     newMaster <- io $ client'sM rnc id newMasterId
+    oldMasterId <- io $ room'sM rnc masterID ri
+    oldMaster <- io $ client'sM rnc id oldMasterId
     oldRoomName <- io $ room'sM rnc name ri
-    oldMaster <- client's nick
     kicked <- client's isKickedFromServer
     thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
     let newRoomName = if (proto < 42) || kicked then nick newMaster else oldRoomName
@@ -220,9 +221,9 @@
                 , isRegisteredOnly = False}
                 )
         , ModifyClient2 newMasterId (\c -> c{isMaster = True})
-        , ModifyClient (\c -> c{isMaster = False})
+        , ModifyClient2 oldMasterId (\c -> c{isMaster = False})
         , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
-        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster]
+        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", nick oldMaster]
         , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster]
         ]