406 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: specify nickname"]] |
406 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: specify nickname"]] |
407 |
407 |
408 handleCmd_inRoom ["CALLVOTE", "KICK", nickname] = do |
408 handleCmd_inRoom ["CALLVOTE", "KICK", nickname] = do |
409 (thisClientId, rnc) <- ask |
409 (thisClientId, rnc) <- ask |
410 cl <- thisClient |
410 cl <- thisClient |
|
411 rm <- thisRoom |
411 maybeClientId <- clientByNick nickname |
412 maybeClientId <- clientByNick nickname |
412 let kickId = fromJust maybeClientId |
413 let kickId = fromJust maybeClientId |
413 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId |
414 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc kickId |
414 |
415 |
415 if isJust maybeClientId && sameRoom then |
416 if isNothing $ masterID rm then |
416 startVote $ VoteKick nickname |
417 return [] |
417 else |
418 else |
418 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: no such user"]] |
419 if isJust maybeClientId && sameRoom then |
|
420 startVote $ VoteKick nickname |
|
421 else |
|
422 return [AnswerClients [sendChan cl] ["CHAT", "[server]", "callvote kick: no such user"]] |
419 |
423 |
420 handleCmd_inRoom ["VOTE", m] = do |
424 handleCmd_inRoom ["VOTE", m] = do |
421 cl <- thisClient |
425 cl <- thisClient |
422 let b = if m == "YES" then Just True else if m == "NO" then Just False else Nothing |
426 let b = if m == "YES" then Just True else if m == "NO" then Just False else Nothing |
423 if isJust b then |
427 if isJust b then |