Added dice, added check for room access
This commit is contained in:
15
server.cpp
15
server.cpp
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user