Frontend: Prevent connecting to another room when already joining

This commit is contained in:
James Rowe 2018-04-20 00:14:44 -06:00
parent c8d4ca8915
commit 5fef22fc52
4 changed files with 20 additions and 15 deletions

View file

@ -51,8 +51,14 @@ void DirectConnectWindow::Connect() {
return;
}
if (const auto member = Network::GetRoomMember().lock()) {
if (member->IsConnected() && !NetworkMessage::WarnDisconnect()) {
// Prevent the user from trying to join a room while they are already joining.
if (member->GetState() == Network::RoomMember::State::Joining) {
return;
} else if (member->GetState() == Network::RoomMember::State::Joined) {
// And ask if they want to leave the room if they are already in one.
if (!NetworkMessage::WarnDisconnect()) {
return;
}
}
}
switch (static_cast<ConnectionType>(ui->connection_type->currentIndex())) {