equal
deleted
inserted
replaced
41 else |
41 else |
42 return [] |
42 return [] |
43 where |
43 where |
44 h ["DELEGATE", n] = handleCmd ["DELEGATE", n] |
44 h ["DELEGATE", n] = handleCmd ["DELEGATE", n] |
45 h ["STATS"] = handleCmd ["STATS"] |
45 h ["STATS"] = handleCmd ["STATS"] |
46 h ["PART", msg] = handleCmd ["PART", msg] |
46 h ("PART":m:ms) = handleCmd ["PART", B.unwords $ m:ms] |
47 h ["QUIT", msg] = handleCmd ["QUIT", msg] |
47 h ("QUIT":m:ms) = handleCmd ["QUIT", B.unwords $ m:ms] |
48 h ["GLOBAL", msg] = do |
48 h ("RND":rs) = handleCmd ("RND":rs) |
|
49 h ("GLOBAL":m:ms) = do |
|
50 cl <- thisClient |
49 rnc <- liftM snd ask |
51 rnc <- liftM snd ask |
50 let chans = map (sendChan . client rnc) $ allClients rnc |
52 let chans = map (sendChan . client rnc) $ allClients rnc |
51 return [AnswerClients chans ["CHAT", "[global notice]", msg]] |
53 return [AnswerClients chans ["CHAT", "[global notice]", B.unwords $ m:ms] | isAdministrator cl] |
52 h c = return [Warning . B.concat . L.intersperse " " $ "Unknown cmd" : c] |
54 h c = return [Warning . B.concat . L.intersperse " " $ "Unknown cmd" : c] |
53 |
55 |
54 handleCmd cmd = do |
56 handleCmd cmd = do |
55 (ci, irnc) <- ask |
57 (ci, irnc) <- ask |
56 let cl = irnc `client` ci |
58 let cl = irnc `client` ci |
70 let noSuchClient = isNothing maybeClientId |
72 let noSuchClient = isNothing maybeClientId |
71 let clientId = fromJust maybeClientId |
73 let clientId = fromJust maybeClientId |
72 let cl = rnc `client` fromJust maybeClientId |
74 let cl = rnc `client` fromJust maybeClientId |
73 let roomId = clientRoom rnc clientId |
75 let roomId = clientRoom rnc clientId |
74 let clRoom = room rnc roomId |
76 let clRoom = room rnc roomId |
75 let roomMasterSign = if isMaster cl then "@" else "" |
77 let roomMasterSign = if isMaster cl then "+" else "" |
76 let adminSign = if isAdministrator cl then "@" else "" |
78 let adminSign = if isAdministrator cl then "@" else "" |
77 let rInfo = if roomId /= lobbyId then B.concat [roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby" |
79 let rInfo = if roomId /= lobbyId then B.concat [adminSign, roomMasterSign, "room ", name clRoom] else adminSign `B.append` "lobby" |
78 let roomStatus = if isJust $ gameInfo clRoom then |
80 let roomStatus = if isJust $ gameInfo clRoom then |
79 if teamsInGame cl > 0 then "(playing)" else "(spectating)" |
81 if teamsInGame cl > 0 then "(playing)" else "(spectating)" |
80 else |
82 else |
81 "" |
83 "" |
82 let hostStr = if isAdminAsking then host cl else cutHost $ host cl |
84 let hostStr = if isAdminAsking then host cl else cutHost $ host cl |