--- a/gameServer/Actions.hs Sun Sep 09 15:37:10 2012 +0400
+++ b/gameServer/Actions.hs Sun Sep 09 19:57:13 2012 +0400
@@ -244,13 +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, 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]
+ 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
@@ -264,6 +267,7 @@
rnc <- gets roomsClients
proto <- client's clientProto
n <- client's nick
+ chan <- client's sendChan
let rm = newRoom{
masterID = clId,
@@ -280,6 +284,7 @@
mapM_ processAction [
AnswerClients chans ("ROOM" : "ADD" : roomInfo n rm)
+ , AnswerClients [chan] ["CLIENT_FLAGS", "+h", n]
, ModifyClient (\cl -> cl{isMaster = True})
]
--- a/gameServer/HWProtoLobbyState.hs Sun Sep 09 15:37:10 2012 +0400
+++ b/gameServer/HWProtoLobbyState.hs Sun Sep 09 19:57:13 2012 +0400
@@ -70,7 +70,7 @@
let sameProto = clientProto cl == roomProto jRoom
let jRoomClients = map (client irnc) $ roomClients irnc jRI
let nicks = map nick jRoomClients
- let owner = fromJust $ find isMaster jRoomClients
+ let ownerNick = nick . fromJust $ find isMaster jRoomClients
let chans = map sendChan (cl : jRoomClients)
let isBanned = host cl `elem` roomBansList jRoom
return $
@@ -84,10 +84,11 @@
[NoticeMessage WrongPassword]
else
[
- MoveToRoom jRI,
- AnswerClients [sendChan cl] $ "JOINED" : nicks,
- AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl],
- AnswerClients [sendChan cl] $ ["WARNING", "Room admin is " `B.append` nick owner]
+ MoveToRoom jRI
+ , AnswerClients [sendChan cl] $ "JOINED" : nicks
+ , AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
+ , AnswerClients [sendChan cl] $ ["WARNING", "Room admin is " `B.append` ownerNick]
+ , AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick]
]
++ map (readynessMessage cl) jRoomClients
++ answerFullConfig cl (mapParams jRoom) (params jRoom)