gameServer/HWProtoCore.hs
changeset 5060 7d0f6e5b1c1c
parent 5030 42746c5d4a80
child 5996 2c72fe81dd37
equal deleted inserted replaced
5059:68a5415ca8ea 5060:7d0f6e5b1c1c
    41 
    41 
    42 
    42 
    43 handleCmd_loggedin ["INFO", asknick] = do
    43 handleCmd_loggedin ["INFO", asknick] = do
    44     (_, rnc) <- ask
    44     (_, rnc) <- ask
    45     maybeClientId <- clientByNick asknick
    45     maybeClientId <- clientByNick asknick
       
    46     isAdminAsking <- liftM isAdministrator thisClient
    46     let noSuchClient = isNothing maybeClientId
    47     let noSuchClient = isNothing maybeClientId
    47     let clientId = fromJust maybeClientId
    48     let clientId = fromJust maybeClientId
    48     let cl = rnc `client` fromJust maybeClientId
    49     let cl = rnc `client` fromJust maybeClientId
    49     let roomId = clientRoom rnc clientId
    50     let roomId = clientRoom rnc clientId
    50     let clRoom = room rnc roomId
    51     let clRoom = room rnc roomId
    53     let roomInfo = if roomId /= lobbyId then B.concat [roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby"
    54     let roomInfo = if roomId /= lobbyId then B.concat [roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby"
    54     let roomStatus = if gameinprogress clRoom then
    55     let roomStatus = if gameinprogress clRoom then
    55             if teamsInGame cl > 0 then "(playing)" else "(spectating)"
    56             if teamsInGame cl > 0 then "(playing)" else "(spectating)"
    56             else
    57             else
    57             ""
    58             ""
       
    59     let hostStr = if isAdminAsking then host cl else cutHost $ host cl
    58     if noSuchClient then
    60     if noSuchClient then
    59         return []
    61         return []
    60         else
    62         else
    61         answerClient [
    63         answerClient [
    62             "INFO",
    64             "INFO",
    63             nick cl,
    65             nick cl,
    64             B.concat ["[", host cl, "]"],
    66             B.concat ["[", hostStr, "]"],
    65             protoNumber2ver $ clientProto cl,
    67             protoNumber2ver $ clientProto cl,
    66             B.concat ["[", roomInfo, "]", roomStatus]
    68             B.concat ["[", roomInfo, "]", roomStatus]
    67             ]
    69             ]
    68 
    70 
    69 
    71