73 let ris = allRooms irnc |
73 let ris = allRooms irnc |
74 cl <- thisClient |
74 cl <- thisClient |
75 let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris |
75 let maybeRI = find (\ri -> roomName == name (irnc `room` ri)) ris |
76 let jRI = fromJust maybeRI |
76 let jRI = fromJust maybeRI |
77 let jRoom = irnc `room` jRI |
77 let jRoom = irnc `room` jRI |
|
78 let sameProto = clientProto cl == roomProto jRoom |
78 let jRoomClients = map (client irnc) $ roomClients irnc jRI |
79 let jRoomClients = map (client irnc) $ roomClients irnc jRI |
79 let nicks = map nick jRoomClients |
80 let nicks = map nick jRoomClients |
80 let chans = map sendChan (cl : jRoomClients) |
81 let chans = map sendChan (cl : jRoomClients) |
81 return $ |
82 return $ |
82 if isNothing maybeRI then |
83 if isNothing maybeRI || not sameProto then |
83 [Warning "No such rooms"] |
84 [Warning "No such rooms"] |
84 else if isRestrictedJoins jRoom then |
85 else if isRestrictedJoins jRoom then |
85 [Warning "Joining restricted"] |
86 [Warning "Joining restricted"] |
86 else if roomPassword /= password jRoom then |
87 else if roomPassword /= password jRoom then |
87 [Warning "Wrong password"] |
88 [Warning "Wrong password"] |
133 (_, rnc) <- ask |
134 (_, rnc) <- ask |
134 ci <- clientByNick asknick |
135 ci <- clientByNick asknick |
135 cl <- thisClient |
136 cl <- thisClient |
136 let ri = clientRoom rnc $ fromJust ci |
137 let ri = clientRoom rnc $ fromJust ci |
137 let clRoom = room rnc ri |
138 let clRoom = room rnc ri |
138 if isNothing ci || ri == lobbyId || clientProto cl /= roomProto clRoom then |
139 if isNothing ci || ri == lobbyId then |
139 return [] |
140 return [] |
140 else |
141 else |
141 handleCmd_lobby ["JOIN_ROOM", name clRoom] |
142 handleCmd_lobby ["JOIN_ROOM", name clRoom] |
142 |
143 |
143 --------------------------- |
144 --------------------------- |