gameServer/HWProtoInRoomState.hs
branchflibqtfrontend
changeset 8244 0f8893faeb00
parent 8227 3a2ce574aa3b
child 8330 aaefa587e277
child 8369 31033e521653
--- a/gameServer/HWProtoInRoomState.hs	Thu Dec 06 00:24:20 2012 +0400
+++ b/gameServer/HWProtoInRoomState.hs	Thu Dec 06 00:38:12 2012 +0400
@@ -301,6 +301,16 @@
         [KickRoomClient kickId | master && isJust maybeClientId && (kickId /= thisClientId) && sameRoom]
 
 
+handleCmd_inRoom ["DELEGATE", newAdmin] = do
+    (thisClientId, rnc) <- ask
+    maybeClientId <- clientByNick newAdmin
+    master <- liftM isMaster thisClient
+    let newAdminId = fromJust maybeClientId
+    let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId
+    return
+        [ChangeMaster (Just newAdminId) | master && isJust maybeClientId && (newAdminId /= thisClientId) && sameRoom]
+
+
 handleCmd_inRoom ["TEAMCHAT", msg] = do
     cl <- thisClient
     chans <- roomSameClanChans