321 handleCmd_inRoom ["DELEGATE", newAdmin] = do |
321 handleCmd_inRoom ["DELEGATE", newAdmin] = do |
322 (thisClientId, rnc) <- ask |
322 (thisClientId, rnc) <- ask |
323 maybeClientId <- clientByNick newAdmin |
323 maybeClientId <- clientByNick newAdmin |
324 master <- liftM isMaster thisClient |
324 master <- liftM isMaster thisClient |
325 serverAdmin <- liftM isAdministrator thisClient |
325 serverAdmin <- liftM isAdministrator thisClient |
|
326 thisRoomMasterId <- liftM masterID thisRoom |
326 let newAdminId = fromJust maybeClientId |
327 let newAdminId = fromJust maybeClientId |
327 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId |
328 let sameRoom = clientRoom rnc thisClientId == clientRoom rnc newAdminId |
328 return |
329 return |
329 [ChangeMaster (Just newAdminId) | |
330 [ChangeMaster (Just newAdminId) | |
330 (master || serverAdmin) |
331 (master || serverAdmin) |
331 && isJust maybeClientId |
332 && isJust maybeClientId |
332 && ((newAdminId /= thisClientId) || (serverAdmin && not master)) |
333 && ((newAdminId /= thisClientId) || (serverAdmin && not master)) |
|
334 && (newAdminId /= thisRoomMasterId) |
333 && sameRoom] |
335 && sameRoom] |
334 |
336 |
335 |
337 |
336 handleCmd_inRoom ["TEAMCHAT", msg] = do |
338 handleCmd_inRoom ["TEAMCHAT", msg] = do |
337 cl <- thisClient |
339 cl <- thisClient |