gameServer/Actions.hs
changeset 7687 c73fd8cfa7c0
parent 7682 f6bfbe829008
child 7710 fd5bcbd698a5
--- a/gameServer/Actions.hs	Mon Aug 27 17:40:16 2012 +0200
+++ b/gameServer/Actions.hs	Sun Sep 16 16:54:51 2012 +0200
@@ -244,11 +244,16 @@
     newMasterId <- liftM (head . filter (/= ci)) . io $ roomClientsIndicesM rnc ri
     newMaster <- io $ client'sM rnc id newMasterId
     oldRoomName <- io $ room'sM rnc name ri
+    oldMaster <- client's nick
+    thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
     let newRoomName = nick newMaster
     mapM_ processAction [
-        ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName}),
-        ModifyClient2 newMasterId (\c -> c{isMaster = True}),
-        AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
+        ModifyRoom (\r -> r{masterID = newMasterId, name = newRoomName, isRestrictedJoins = False, isRestrictedTeams = False})
+        , ModifyClient2 newMasterId (\c -> c{isMaster = True})
+        , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"]
+        , AnswerClients thisRoomChans ["WARNING", "New room admin is " `B.append` nick newMaster]
+        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster]
+        , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster]
         ]
 
     proto <- client's clientProto
@@ -262,6 +267,7 @@
     rnc <- gets roomsClients
     proto <- client's clientProto
     n <- client's nick
+    chan <- client's sendChan
 
     let rm = newRoom{
             masterID = clId,
@@ -278,6 +284,7 @@
 
     mapM_ processAction [
         AnswerClients chans ("ROOM" : "ADD" : roomInfo n rm)
+        , AnswerClients [chan] ["CLIENT_FLAGS", "+h", n]
         , ModifyClient (\cl -> cl{isMaster = True})
         ]