![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#include <server_room.h>
Signals | |
| void | roomInfoChanged (const ServerInfo_Room &roomInfo) |
| void | gameListChanged (const ServerInfo_Game &gameInfo) |
Public Member Functions | |
| Server_Room (int _id, int _chatHistorySize, const QString &_name, const QString &_description, const QString &_permissionLevel, const QString &_privilegeLevel, bool _autoJoin, const QString &_joinMessage, const QStringList &_gameTypes, Server *parent, const QList< ServerInfo_RoomChannel > &_channels={}) | |
| ~Server_Room () override | |
| int | getId () const |
| QString | getName () const |
| QString | getDescription () const |
| QString | getRoomPermission () const |
| QString | getRoomPrivilege () const |
| bool | getAutoJoin () const |
| bool | userMayJoin (const ServerInfo_User &userInfo) |
| QString | getJoinMessage () const |
| const QStringList & | getGameTypes () const |
| const QList< ServerInfo_RoomChannel > & | getChannels () const |
| const ServerInfo_RoomChannel * | findChannel (const QString &channelId) const |
| Looks up a catalog channel by its stable id. | |
| const QMap< int, Server_Game * > & | getGames () const |
| const QMap< int, ServerInfo_Game > & | getExternalGames () const |
| Server * | getServer () const |
| const ServerInfo_Room & | getInfo (ServerInfo_Room &result, bool complete, bool showGameTypes=false, bool includeExternalData=true, const ServerInfo_User *forUser=nullptr) const |
| int | getGamesCreatedByUser (const QString &name) const |
| QList< ServerInfo_Game > | getGamesOfUser (const QString &name) const |
| QList< ServerInfo_ChatMessage > | getChatHistory (const QString &channelId) const |
| void | addClient (Server_ProtocolHandler *client) |
| void | removeClient (Server_ProtocolHandler *client) |
| void | addExternalUser (const ServerInfo_User &userInfo) |
| void | removeExternalUser (const QString &_name) |
| const QMap< QString, ServerInfo_User_Container > & | getExternalUsers () const |
| void | updateExternalGameList (const ServerInfo_Game &gameInfo) |
| Response::ResponseCode | processJoinGameCommand (const Command_JoinGame &cmd, ResponseContainer &rc, Server_AbstractUserInterface *userInterface) |
| void | say (const QString &userName, const QString &s, const QString &channelId=QString(), bool sendToIsl=true) |
| void | removeSaidMessages (const QString &userName, int amount, bool sendToIsl=true) |
| void | addGame (Server_Game *game) |
| void | removeGame (Server_Game *game) |
| void | sendRoomEvent (RoomEvent *event, bool sendToIsl=true, ServerInfo_RoomChannel::AccessLevel accessLevel=ServerInfo_RoomChannel::Public) |
| RoomEvent * | prepareRoomEvent (const ::google::protobuf::Message &roomEvent) |
Static Public Member Functions | |
| static bool | isMainChannel (const QString &channelId) |
True when channelId refers to the implicit Main channel. | |
| static bool | hasChannelPrivilege (const ServerInfo_User &userInfo, ServerInfo_RoomChannel::AccessLevel requiredLevel) |
True when the flags in userInfo satisfy requiredLevel. | |
| static bool | mayReadChannel (const ServerInfo_User &userInfo, const ServerInfo_RoomChannel &channel) |
True when userInfo may read channel. | |
| static bool | mayWriteChannel (const ServerInfo_User &userInfo, const ServerInfo_RoomChannel &channel) |
True when userInfo may write to channel. | |
Public Attributes | |
| QReadWriteLock | usersLock |
| QReadWriteLock | gamesLock |
| QReadWriteLock | historyLock |
Static Public Attributes | |
| static const QString | MAIN_CHANNEL_KEY = QStringLiteral("__main__") |
Private Slots | |
| void | broadcastGameListUpdate (const ServerInfo_Game &gameInfo, bool sendToIsl=true) |
Private Attributes | |
| int | id |
| int | chatHistorySize |
| QString | name |
| QString | description |
| QString | permissionLevel |
| QString | privilegeLevel |
| bool | autoJoin |
| QString | joinMessage |
| QStringList | gameTypes |
| QList< ServerInfo_RoomChannel > | channels |
| QMap< int, Server_Game * > | games |
| QMap< int, ServerInfo_Game > | externalGames |
| QMap< QString, Server_ProtocolHandler * > | users |
| QMap< QString, ServerInfo_User_Container > | externalUsers |
| QMap< QString, QList< ServerInfo_ChatMessage > > | channelChatHistory |
| Server_Room::Server_Room | ( | int | _id, |
| int | _chatHistorySize, | ||
| const QString & | _name, | ||
| const QString & | _description, | ||
| const QString & | _permissionLevel, | ||
| const QString & | _privilegeLevel, | ||
| bool | _autoJoin, | ||
| const QString & | _joinMessage, | ||
| const QStringList & | _gameTypes, | ||
| Server * | parent, | ||
| const QList< ServerInfo_RoomChannel > & | _channels = {} ) |
|
override |
| void Server_Room::addClient | ( | Server_ProtocolHandler * | client | ) |
| void Server_Room::addExternalUser | ( | const ServerInfo_User & | userInfo | ) |
| void Server_Room::addGame | ( | Server_Game * | game | ) |
|
privateslot |
| const ServerInfo_RoomChannel * Server_Room::findChannel | ( | const QString & | channelId | ) | const |
Looks up a catalog channel by its stable id.
|
signal |
|
inline |
|
inline |
| QList< ServerInfo_ChatMessage > Server_Room::getChatHistory | ( | const QString & | channelId | ) | const |
|
inline |
|
inline |
|
inline |
|
inline |
| int Server_Room::getGamesCreatedByUser | ( | const QString & | name | ) | const |
| QList< ServerInfo_Game > Server_Room::getGamesOfUser | ( | const QString & | name | ) | const |
|
inline |
|
inline |
| const ServerInfo_Room & Server_Room::getInfo | ( | ServerInfo_Room & | result, |
| bool | complete, | ||
| bool | showGameTypes = false, | ||
| bool | includeExternalData = true, | ||
| const ServerInfo_User * | forUser = nullptr ) const |
|
inline |
|
inline |
|
inline |
|
inline |
| Server * Server_Room::getServer | ( | ) | const |
|
static |
True when the flags in userInfo satisfy requiredLevel.
User flags are independent bits, not a ladder: IsDeveloper does not imply IsModerator or IsAdmin, so developer-only users cannot read or post in moderator/admin channels. Admins hold the moderator bit alongside the admin bit and moderators are admitted to judge channels.
|
static |
True when channelId refers to the implicit Main channel.
|
static |
True when userInfo may read channel.
|
static |
True when userInfo may write to channel.
Writing requires the channel's write level, or — when no explicit write level is configured — the same level as reading.
| RoomEvent * Server_Room::prepareRoomEvent | ( | const ::google::protobuf::Message & | roomEvent | ) |
| Response::ResponseCode Server_Room::processJoinGameCommand | ( | const Command_JoinGame & | cmd, |
| ResponseContainer & | rc, | ||
| Server_AbstractUserInterface * | userInterface ) |
| void Server_Room::removeClient | ( | Server_ProtocolHandler * | client | ) |
| void Server_Room::removeExternalUser | ( | const QString & | _name | ) |
| void Server_Room::removeGame | ( | Server_Game * | game | ) |
| void Server_Room::removeSaidMessages | ( | const QString & | userName, |
| int | amount, | ||
| bool | sendToIsl = true ) |
|
signal |
| void Server_Room::say | ( | const QString & | userName, |
| const QString & | s, | ||
| const QString & | channelId = QString(), | ||
| bool | sendToIsl = true ) |
| void Server_Room::sendRoomEvent | ( | RoomEvent * | event, |
| bool | sendToIsl = true, | ||
| ServerInfo_RoomChannel::AccessLevel | accessLevel = ServerInfo_RoomChannel::Public ) |
| void Server_Room::updateExternalGameList | ( | const ServerInfo_Game & | gameInfo | ) |
| bool Server_Room::userMayJoin | ( | const ServerInfo_User & | userInfo | ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
mutable |
|
private |
|
mutable |
|
private |
|
private |
|
static |
|
private |
|
private |
|
private |
|
private |
|
mutable |