diff options
Diffstat (limited to 'signet/Room.cpp')
-rw-r--r-- | signet/Room.cpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/signet/Room.cpp b/signet/Room.cpp index 2ed9732c..461ad437 100644 --- a/signet/Room.cpp +++ b/signet/Room.cpp @@ -18,28 +18,47 @@ // Header include #include "Room.h" +// Signet includes +#include "Table.h" + Signet::Room::Room(const QString& name, QObject* parent) : - QObject(parent), + ConnectionHandler(parent), m_name(name) { } -bool Signet::Room::addClient(Client* client) +QString Signet::Room::type() const +{ + return "room"; +} + +QString Signet::Room::name() const { - // TODO: Estabish a connection with the client + return m_name; } void Signet::Room::createTable(const QString& table) { - // TODO: Create a table + if (m_tables.contains(table)) + return; + m_tables[table] = new Table(table, this); } void Signet::Room::closeTable(const QString& table) { - // TODO: Close a table + if (m_tables.contains(table)) + { + delete m_tables[table]; + m_tables.remove(table); + } } bool Signet::Room::joinTable(Client* client, const QString& tableName) { - // TODO: Add a client to the table + if (!m_tables.contains(tableName)) + createTable(tableName); + if (!m_tables[tableName]->addClient(client)) + { + // TODO: Let the client know about the error. + } } |