205 proto <- client's clientProto |
205 proto <- client's clientProto |
206 ri <- clientRoomA |
206 ri <- clientRoomA |
207 rnc <- gets roomsClients |
207 rnc <- gets roomsClients |
208 newMasterId <- liftM (\ids -> fromMaybe (last . filter (/= ci) $ ids) delegateId) . io $ roomClientsIndicesM rnc ri |
208 newMasterId <- liftM (\ids -> fromMaybe (last . filter (/= ci) $ ids) delegateId) . io $ roomClientsIndicesM rnc ri |
209 newMaster <- io $ client'sM rnc id newMasterId |
209 newMaster <- io $ client'sM rnc id newMasterId |
|
210 oldMasterId <- io $ room'sM rnc masterID ri |
|
211 oldMaster <- io $ client'sM rnc id oldMasterId |
210 oldRoomName <- io $ room'sM rnc name ri |
212 oldRoomName <- io $ room'sM rnc name ri |
211 oldMaster <- client's nick |
|
212 kicked <- client's isKickedFromServer |
213 kicked <- client's isKickedFromServer |
213 thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
214 thisRoomChans <- liftM (map sendChan) $ roomClientsS ri |
214 let newRoomName = if (proto < 42) || kicked then nick newMaster else oldRoomName |
215 let newRoomName = if (proto < 42) || kicked then nick newMaster else oldRoomName |
215 mapM_ processAction [ |
216 mapM_ processAction [ |
216 ModifyRoom (\r -> r{masterID = newMasterId |
217 ModifyRoom (\r -> r{masterID = newMasterId |
218 , isRestrictedJoins = False |
219 , isRestrictedJoins = False |
219 , isRestrictedTeams = False |
220 , isRestrictedTeams = False |
220 , isRegisteredOnly = False} |
221 , isRegisteredOnly = False} |
221 ) |
222 ) |
222 , ModifyClient2 newMasterId (\c -> c{isMaster = True}) |
223 , ModifyClient2 newMasterId (\c -> c{isMaster = True}) |
223 , ModifyClient (\c -> c{isMaster = False}) |
224 , ModifyClient2 oldMasterId (\c -> c{isMaster = False}) |
224 , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"] |
225 , AnswerClients [sendChan newMaster] ["ROOM_CONTROL_ACCESS", "1"] |
225 , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", oldMaster] |
226 , AnswerClients thisRoomChans ["CLIENT_FLAGS", "-h", nick oldMaster] |
226 , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster] |
227 , AnswerClients thisRoomChans ["CLIENT_FLAGS", "+h", nick newMaster] |
227 ] |
228 ] |
228 |
229 |
229 newRoom' <- io $ room'sM rnc id ri |
230 newRoom' <- io $ room'sM rnc id ri |
230 chans <- liftM (map sendChan) $! sameProtoClientsS proto |
231 chans <- liftM (map sendChan) $! sameProtoClientsS proto |