gameServer/HWProtoInRoomState.hs
changeset 8247 d7cf4a9ce685
parent 8232 fb5aa767a2a0
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