298 return [AnswerClients chans ["EM", engineMsg cl]] |
299 return [AnswerClients chans ["EM", engineMsg cl]] |
299 where |
300 where |
300 engineMsg cl = toEngineMsg $ B.concat ["b", nick cl, "(team): ", msg, "\x20\x20"] |
301 engineMsg cl = toEngineMsg $ B.concat ["b", nick cl, "(team): ", msg, "\x20\x20"] |
301 |
302 |
302 handleCmd_inRoom ["BAN", banNick] = do |
303 handleCmd_inRoom ["BAN", banNick] = do |
303 (_, rnc) <- ask |
304 (thisClientId, rnc) <- ask |
304 maybeClientId <- clientByNick banNick |
305 maybeClientId <- clientByNick banNick |
|
306 master <- liftM isMaster thisClient |
305 let banId = fromJust maybeClientId |
307 let banId = fromJust maybeClientId |
306 master <- liftM isMaster thisClient |
308 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc banId |
307 return [ModifyRoom (\r -> r{roomBansList = (host $ rnc `client` banId) : roomBansList r}) | master && isJust maybeClientId] |
309 if master && isJust maybeClientId && (banId /= thisClientId) && sameRoom then |
|
310 return [ |
|
311 ModifyRoom (\r -> r{roomBansList = let h = host $ rnc `client` banId in h `deepseq` h : roomBansList r}) |
|
312 , KickRoomClient banId |
|
313 ] |
|
314 else |
|
315 return [] |
308 |
316 |
309 |
317 |
310 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
318 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
311 |
319 |
312 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |
320 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |