1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
vcmi/lobby/LobbyServer.h

40 lines
967 B
C++
Raw Normal View History

/*
* 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;
2023-11-12 13:27:22 +02:00
void onNewConnection(const std::shared_ptr<NetworkConnection> &) override;
void onPacketReceived(const std::shared_ptr<NetworkConnection> &, const std::vector<uint8_t> & message) override;
public:
LobbyServer();
};