equal
deleted
inserted
replaced
39 handleCmd ["PING"] = answerClient ["PONG"] |
39 handleCmd ["PING"] = answerClient ["PONG"] |
40 |
40 |
41 |
41 |
42 handleCmd ("QUIT" : xs) = return [ByeClient msg] |
42 handleCmd ("QUIT" : xs) = return [ByeClient msg] |
43 where |
43 where |
44 -- "User quit: " is a special string parsed by frontend, do not localize. |
44 -- "bye" is a special string (do not translate!) when the user quits manually, |
45 -- It denotes when the /quit command has been used with message parameter. |
45 -- otherwise there will be an additional server message |
46 -- "bye" is also a special string. |
46 msg = if not $ null xs then (head xs) else "bye" |
47 msg = if not $ null xs then "User quit: " `B.append` (head xs) else "bye" |
|
48 |
47 |
49 |
48 |
50 handleCmd ["PONG"] = do |
49 handleCmd ["PONG"] = do |
51 cl <- thisClient |
50 cl <- thisClient |
52 if pingsQueue cl == 0 then |
51 if pingsQueue cl == 0 then |
108 -- lobby-only commands |
107 -- lobby-only commands |
109 h "STATS" _ = handleCmd_lobbyOnly ["STATS"] |
108 h "STATS" _ = handleCmd_lobbyOnly ["STATS"] |
110 h "RESTART_SERVER" "YES" = handleCmd_lobbyOnly ["RESTART_SERVER"] |
109 h "RESTART_SERVER" "YES" = handleCmd_lobbyOnly ["RESTART_SERVER"] |
111 |
110 |
112 -- room and lobby commands |
111 -- room and lobby commands |
113 h "QUIT" m | not $ B.null m = handleCmd ["QUIT", m] |
112 h "QUIT" _ = handleCmd ["QUIT"] |
114 | otherwise = handleCmd ["QUIT"] |
|
115 h "RND" p = handleCmd ("RND" : B.words p) |
113 h "RND" p = handleCmd ("RND" : B.words p) |
116 h "GLOBAL" p = serverAdminOnly $ do |
114 h "GLOBAL" p = serverAdminOnly $ do |
117 rnc <- liftM snd ask |
115 rnc <- liftM snd ask |
118 let chans = map (sendChan . client rnc) $ allClients rnc |
116 let chans = map (sendChan . client rnc) $ allClients rnc |
119 return [AnswerClients chans ["CHAT", nickGlobal, p]] |
117 return [AnswerClients chans ["CHAT", nickGlobal, p]] |