mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 15:16:15 -08:00
Define permission levels for rooms
This commit is contained in:
@@ -542,6 +542,24 @@ Response::ResponseCode Server_ProtocolHandler::cmdJoinRoom(const Command_JoinRoo
|
||||
if (!r)
|
||||
return Response::RespNameNotFound;
|
||||
|
||||
QString roomPermission = r->getRoomPermission().toLower();
|
||||
if (roomPermission != "none"){
|
||||
if (roomPermission == "registered") {
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsRegistered))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
|
||||
if (roomPermission == "moderator"){
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsModerator))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
|
||||
if (roomPermission == "administrator"){
|
||||
if (!(userInfo->user_level() & ServerInfo_User::IsAdmin))
|
||||
return Response::RespUserLevelTooLow;
|
||||
}
|
||||
}
|
||||
|
||||
r->addClient(this);
|
||||
rooms.insert(r->getId(), r);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user