equal
deleted
inserted
replaced
214 handleCmd_inRoom ["EM", msg] = do |
214 handleCmd_inRoom ["EM", msg] = do |
215 cl <- thisClient |
215 cl <- thisClient |
216 rm <- thisRoom |
216 rm <- thisRoom |
217 chans <- roomOthersChans |
217 chans <- roomOthersChans |
218 |
218 |
219 if teamsInGame cl > 0 && (isJust $ gameInfo rm) && isLegal then |
219 if teamsInGame cl > 0 && (isJust $ gameInfo rm) && (not $ B.null legalMsgs) then |
220 return $ AnswerClients chans ["EM", msg] |
220 return $ AnswerClients chans ["EM", legalMsgs] |
221 : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = msg : roundMsgs g}) $ gameInfo r}) | not isKeepAlive] |
221 : [ModifyRoom (\r -> r{gameInfo = liftM (\g -> g{roundMsgs = nonEmptyMsgs : roundMsgs g}) $ gameInfo r}) | not $ B.null nonEmptyMsgs] |
222 else |
222 else |
223 return [] |
223 return [] |
224 where |
224 where |
225 (isLegal, isKeepAlive) = checkNetCmd msg |
225 (legalMsgs, nonEmptyMsgs) = checkNetCmd msg |
226 |
226 |
227 |
227 |
228 handleCmd_inRoom ["ROUNDFINISHED", correctly] = do |
228 handleCmd_inRoom ["ROUNDFINISHED", correctly] = do |
229 cl <- thisClient |
229 cl <- thisClient |
230 rm <- thisRoom |
230 rm <- thisRoom |
270 return $ |
270 return $ |
271 if not $ isMaster cl then |
271 if not $ isMaster cl then |
272 [ProtocolError $ loc "Not room master"] |
272 [ProtocolError $ loc "Not room master"] |
273 else |
273 else |
274 [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r})] |
274 [ModifyRoom (\r -> r{isRegisteredOnly = not $ isRegisteredOnly r})] |
|
275 |
275 |
276 |
276 handleCmd_inRoom ["ROOM_NAME", newName] = do |
277 handleCmd_inRoom ["ROOM_NAME", newName] = do |
277 cl <- thisClient |
278 cl <- thisClient |
278 rs <- allRoomInfos |
279 rs <- allRoomInfos |
279 rm <- thisRoom |
280 rm <- thisRoom |
322 chans <- roomSameClanChans |
323 chans <- roomSameClanChans |
323 return [AnswerClients chans ["EM", engineMsg cl]] |
324 return [AnswerClients chans ["EM", engineMsg cl]] |
324 where |
325 where |
325 engineMsg cl = toEngineMsg $ B.concat ["b", nick cl, "(team): ", msg, "\x20\x20"] |
326 engineMsg cl = toEngineMsg $ B.concat ["b", nick cl, "(team): ", msg, "\x20\x20"] |
326 |
327 |
|
328 |
327 handleCmd_inRoom ["BAN", banNick] = do |
329 handleCmd_inRoom ["BAN", banNick] = do |
328 (thisClientId, rnc) <- ask |
330 (thisClientId, rnc) <- ask |
329 maybeClientId <- clientByNick banNick |
331 maybeClientId <- clientByNick banNick |
330 master <- liftM isMaster thisClient |
332 master <- liftM isMaster thisClient |
331 let banId = fromJust maybeClientId |
333 let banId = fromJust maybeClientId |