Added dice, added check for room access

This commit is contained in:
Torsten Schulz
2017-07-22 22:24:38 +02:00
parent b5b4c94f65
commit 105232a9e3
7 changed files with 188 additions and 18 deletions

View File

@@ -70,13 +70,18 @@ namespace Yc {
return list;
}
bool Server::roomAllowed(std::string roomName, std::string userName, std::string password){
for (auto &room: _rooms) {
if (room->name() == roomName && room->accessAllowed(userName, password)) {
return true;
}
}
return false;
}
void Server::createRooms(Json::Value roomList) {
for (auto &room: roomList) {
std::vector<std::string> allowedUsers;
for (auto &user: room["allowed"]) {
allowedUsers.push_back(user.asString());
}
Room *newRoom = new Room(this, room["name"].asString(), room["password"].asString(), allowedUsers);
Room *newRoom = new Room(this, room);
_rooms.push_back(newRoom);
}
}