395 handleCmd_inRoom ["GREETING", msg] = do |
395 handleCmd_inRoom ["GREETING", msg] = do |
396 cl <- thisClient |
396 cl <- thisClient |
397 rm <- thisRoom |
397 rm <- thisRoom |
398 return [ModifyRoom (\r -> r{greeting = msg}) | isAdministrator cl || (isMaster cl && (not $ isSpecial rm))] |
398 return [ModifyRoom (\r -> r{greeting = msg}) | isAdministrator cl || (isMaster cl && (not $ isSpecial rm))] |
399 |
399 |
|
400 |
|
401 handleCmd_inRoom ["CALLVOTE"] = do |
|
402 cl <- thisClient |
|
403 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "Available callvote commands: kick <nickname>"]] |
|
404 |
|
405 handleCmd_inRoom ["CALLVOTE", "KICK"] = do |
|
406 cl <- thisClient |
|
407 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: specify nickname"]] |
|
408 |
|
409 handleCmd_inRoom ["CALLVOTE", "KICK", nickname] = do |
|
410 (thisClientId, rnc) <- ask |
|
411 cl <- thisClient |
|
412 maybeClientId <- clientByNick nickname |
|
413 let kickId = fromJust maybeClientId |
|
414 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId |
|
415 |
|
416 if isJust maybeClientId && sameRoom then |
|
417 startVote $ VoteKick nickname |
|
418 else |
|
419 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: no such user"]] |
|
420 |
|
421 handleCmd_inRoom ["VOTE", m] = do |
|
422 cl <- thisClient |
|
423 let b = if m == "YES" then Just True else if m == "NO" then Just False else Nothing |
|
424 if isJust b then |
|
425 voted (clUID cl) (fromJust b) |
|
426 else |
|
427 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "vote: 'yes' or 'no'"]] |
|
428 |
400 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
429 handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17) |
401 |
430 |
402 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |
431 handleCmd_inRoom (s:_) = return [ProtocolError $ "Incorrect command '" `B.append` s `B.append` "' (state: in room)"] |
403 |
432 |
404 handleCmd_inRoom [] = return [ProtocolError "Empty command (state: in room)"] |
433 handleCmd_inRoom [] = return [ProtocolError "Empty command (state: in room)"] |