| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /*
- * LobbyServer.h, part of VCMI engine
- *
- * Authors: listed in file AUTHORS in main folder
- *
- * License: GNU General Public License v2.0 or later
- * Full text of license available in license.txt file, in main folder
- *
- */
- #pragma once
- #include "../lib/network/NetworkServer.h"
- class SQLiteInstance;
- class SQLiteStatement;
- class LobbyDatabase
- {
- std::unique_ptr<SQLiteInstance> database;
- std::unique_ptr<SQLiteStatement> insertChatMessageStatement;
- void initializeDatabase();
- void prepareStatements();
- void createTableChatMessages();
- public:
- LobbyDatabase();
- void insertChatMessage(const std::string & sender, const std::string & messageText);
- };
- class LobbyServer : public NetworkServer
- {
- std::unique_ptr<LobbyDatabase> database;
- void onNewConnection(const std::shared_ptr<NetworkConnection> &) override;
- void onPacketReceived(const std::shared_ptr<NetworkConnection> &, const std::vector<uint8_t> & message) override;
- public:
- LobbyServer();
- };
|