From 12aee2c958bcffb53679adb13891c9020e13eda0 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 26 Jan 2020 18:04:38 +0100 Subject: [PATCH] Renamed TSServer to VirtualServer --- server/CMakeLists.txt | 2 +- server/main.cpp | 2 +- server/src/ConnectionStatistics.cpp | 2 +- server/src/ConnectionStatistics.h | 2 +- server/src/DatabaseHelper.cpp | 52 +++++++------- server/src/DatabaseHelper.h | 38 +++++----- server/src/Group.cpp | 4 +- server/src/Group.h | 8 +-- server/src/InstanceHandler.cpp | 6 +- server/src/InstanceHandler.h | 4 +- server/src/ServerManager.cpp | 14 ++-- server/src/ServerManager.h | 18 ++--- server/src/ServerManagerSnapshotDeploy.cpp | 8 +-- server/src/SignalHandler.cpp | 2 +- server/src/TS3ServerClientManager.cpp | 24 +++---- server/src/TS3ServerHeartbeat.cpp | 6 +- .../src/{TSServer.cpp => VirtualServer.cpp} | 70 +++++++++---------- server/src/{TSServer.h => VirtualServer.h} | 16 ++--- server/src/channel/ServerChannel.cpp | 4 +- server/src/channel/ServerChannel.h | 6 +- server/src/client/ConnectedClient.cpp | 6 +- server/src/client/ConnectedClient.h | 10 +-- server/src/client/DataClient.cpp | 2 +- server/src/client/DataClient.h | 10 +-- server/src/client/InternalClient.cpp | 2 +- server/src/client/InternalClient.h | 2 +- server/src/client/SpeakingClient.h | 4 +- server/src/client/command_handler/channel.cpp | 2 +- server/src/client/command_handler/client.cpp | 2 +- server/src/client/command_handler/misc.cpp | 2 +- server/src/client/command_handler/server.cpp | 6 +- server/src/client/file/FileClient.h | 2 +- server/src/client/music/MusicClient.cpp | 6 +- server/src/client/music/MusicClient.h | 2 +- server/src/client/music/Song.cpp | 2 +- server/src/client/music/Song.h | 6 +- .../channel_replay/ChannelProvider.cpp | 2 +- .../src/client/query/QueryClientCommands.cpp | 4 +- server/src/client/voice/VoiceClient.cpp | 2 +- server/src/client/voice/VoiceClient.h | 4 +- server/src/manager/BanManager.cpp | 2 +- server/src/manager/BanManager.h | 2 +- server/src/manager/ComplainManager.cpp | 4 +- server/src/manager/ComplainManager.h | 6 +- server/src/manager/ConversationManager.cpp | 4 +- server/src/manager/ConversationManager.h | 8 +-- server/src/manager/LetterManager.cpp | 4 +- server/src/manager/LetterManager.h | 6 +- server/src/manager/TokeManager.cpp | 4 +- server/src/manager/TokeManager.h | 6 +- server/src/music/MusicBotManager.cpp | 4 +- server/src/music/MusicBotManager.h | 10 +-- server/src/music/MusicPlaylist.cpp | 4 +- server/src/music/MusicPlaylist.h | 2 +- server/src/music/PlayablePlaylist.cpp | 2 +- server/src/server/POWHandler.h | 2 +- server/src/server/QueryServer.cpp | 2 +- server/src/server/QueryServer.h | 2 +- server/src/server/VoiceIOManager.cpp | 8 +-- server/src/server/VoiceIOManager.h | 12 ++-- server/src/server/VoiceServer.cpp | 4 +- server/src/server/VoiceServer.h | 8 +-- server/src/server/WebServer.cpp | 2 +- server/src/server/WebServer.h | 8 +-- server/src/server/file/FileServer.cpp | 16 ++--- server/src/server/file/FileServer.h | 16 ++--- server/src/terminal/CommandHandler.cpp | 2 +- server/src/weblist/TeamSpeakWebClient.cpp | 4 +- server/src/weblist/TeamSpeakWebClient.h | 6 +- server/src/weblist/WebListManager.cpp | 8 +-- server/src/weblist/WebListManager.h | 10 +-- 71 files changed, 272 insertions(+), 272 deletions(-) rename server/src/{TSServer.cpp => VirtualServer.cpp} (95%) rename server/src/{TSServer.h => VirtualServer.h} (96%) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 9bd273a..9955559 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -49,7 +49,7 @@ set(SERVER_SOURCE_FILES src/client/voice/VoiceClientPacketHandler.cpp src/client/voice/VoiceClientView.cpp src/TS3ServerClientManager.cpp - src/TSServer.cpp + src/VirtualServer.cpp src/TS3ServerHeartbeat.cpp src/SignalHandler.cpp src/server/VoiceServer.cpp diff --git a/server/main.cpp b/server/main.cpp index b1f40ab..0317bb7 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -8,7 +8,7 @@ #include #include "src/Configuration.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "src/InstanceHandler.h" #include "src/server/QueryServer.h" #include "src/server/file/FileServer.h" diff --git a/server/src/ConnectionStatistics.cpp b/server/src/ConnectionStatistics.cpp index 536d044..16b139f 100644 --- a/server/src/ConnectionStatistics.cpp +++ b/server/src/ConnectionStatistics.cpp @@ -4,7 +4,7 @@ #include #include "ConnectionStatistics.h" -#include "TSServer.h" +#include "VirtualServer.h" using namespace std; using namespace std::chrono; diff --git a/server/src/ConnectionStatistics.h b/server/src/ConnectionStatistics.h index 3507b99..78e6bfb 100644 --- a/server/src/ConnectionStatistics.h +++ b/server/src/ConnectionStatistics.h @@ -7,7 +7,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } namespace stats { diff --git a/server/src/DatabaseHelper.cpp b/server/src/DatabaseHelper.cpp index ea300ab..1fea6f4 100644 --- a/server/src/DatabaseHelper.cpp +++ b/server/src/DatabaseHelper.cpp @@ -72,7 +72,7 @@ int collectData(deque>* list, int length, char** } #define MAX_QUERY 32 -std::deque> DatabaseHelper::queryDatabaseInfo(const std::shared_ptr& server, const std::deque& list) { +std::deque> DatabaseHelper::queryDatabaseInfo(const std::shared_ptr& server, const std::deque& list) { if(list.empty()) return {}; deque> result; @@ -102,7 +102,7 @@ std::deque> DatabaseHelper::queryDatabaseInf return result; } -std::deque> DatabaseHelper::queryDatabaseInfoByUid(const std::shared_ptr &server, std::deque list) { +std::deque> DatabaseHelper::queryDatabaseInfoByUid(const std::shared_ptr &server, std::deque list) { if(list.empty()) return {}; deque> result; @@ -132,9 +132,9 @@ std::deque> DatabaseHelper::queryDatabaseInf return result; } -bool DatabaseHelper::validClientDatabaseId(const std::shared_ptr& server, ClientDbId cldbid) { return cldbid > 0; } //TODO here check +bool DatabaseHelper::validClientDatabaseId(const std::shared_ptr& server, ClientDbId cldbid) { return cldbid > 0; } //TODO here check -void DatabaseHelper::deleteClient(const std::shared_ptr& server, ClientDbId cldbid) { +void DatabaseHelper::deleteClient(const std::shared_ptr& server, ClientDbId cldbid) { ServerId sid = static_cast(server ? server->getServerId() : 0); { lock_guard lock(permManagerLock); @@ -162,11 +162,11 @@ void DatabaseHelper::deleteClient(const std::shared_ptr& server, Clien struct PermissionArguments { sql::command& command; PermissionManager* manager; - TSServer* server; + VirtualServer* server; inline int serverId() { return this->server ? this->server->getServerId() : 0; } }; -inline sql::result load_permissions(const std::shared_ptr& server, PermissionManager* manager, sql::command& command) { +inline sql::result load_permissions(const std::shared_ptr& server, PermissionManager* manager, sql::command& command) { auto start = system_clock::now(); auto data = PermissionArguments{command, manager, server.get()}; @@ -232,7 +232,7 @@ inline sql::result load_permissions(const std::shared_ptr& server, Per auto time = end - start; logTrace(server ? server->getServerId() : 0, "[SQL] load_permissions(\"{}\") took {}ms", command.sqlCommand(), duration_cast(time).count()); } -inline sql::result load_permissions_v2(const std::shared_ptr& server, v2::PermissionManager* manager, sql::command& command, bool resolve_channel /* only used for client permissions (client channel permissions) */) { +inline sql::result load_permissions_v2(const std::shared_ptr& server, v2::PermissionManager* manager, sql::command& command, bool resolve_channel /* only used for client permissions (client channel permissions) */) { auto start = system_clock::now(); auto server_id = server ? server->getServerId() : 0; @@ -303,7 +303,7 @@ inline sql::result load_permissions_v2(const std::shared_ptr& server, #define INSERT_COMMAND "INSERT INTO `permissions` (`serverId`, `type`, `id`, `channelId`, `permId`, `value`, `grant`, `flag_skip`, `flag_negate`) VALUES (:serverId, :type, :id, :chId, :permId, :value, :grant, :flag_skip, :flag_negate)" #define DELETE_COMMAND "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `type` = :type AND `id` = :id AND `permId` = :permId AND `channelId` = :chId" -std::shared_ptr DatabaseHelper::loadClientPermissionManager(const std::shared_ptr& server, ClientDbId cldbid) { +std::shared_ptr DatabaseHelper::loadClientPermissionManager(const std::shared_ptr& server, ClientDbId cldbid) { auto server_id = server ? server->getServerId() : 0; #ifndef DISABLE_CACHING { @@ -375,7 +375,7 @@ std::shared_ptr DatabaseHelper::loadClientPermissionManag } -void DatabaseHelper::saveClientPermissions(const std::shared_ptr &server, ts::ClientDbId client_dbid, const std::shared_ptr &permissions) { +void DatabaseHelper::saveClientPermissions(const std::shared_ptr &server, ts::ClientDbId client_dbid, const std::shared_ptr &permissions) { const auto updates = permissions->flush_db_updates(); if(updates.empty()) return; @@ -410,7 +410,7 @@ void DatabaseHelper::saveClientPermissions(const std::shared_ptr DatabaseHelper::loadGroupPermissions(const std::shared_ptr& server, ts::GroupId group_id) { +std::shared_ptr DatabaseHelper::loadGroupPermissions(const std::shared_ptr& server, ts::GroupId group_id) { auto result = std::make_shared(); if(this->use_startup_cache && server) { shared_ptr entry; @@ -442,7 +442,7 @@ std::shared_ptr DatabaseHelper::loadGroupPerm return result; } -void DatabaseHelper::saveGroupPermissions(const std::shared_ptr &server, ts::GroupId group_id, const std::shared_ptr &permissions) { +void DatabaseHelper::saveGroupPermissions(const std::shared_ptr &server, ts::GroupId group_id, const std::shared_ptr &permissions) { const auto updates = permissions->flush_db_updates(); if(updates.empty()) return; @@ -476,7 +476,7 @@ void DatabaseHelper::saveGroupPermissions(const std::shared_ptr DatabaseHelper::loadPlaylistPermissions(const std::shared_ptr &server, ts::PlaylistId playlist_id) { +std::shared_ptr DatabaseHelper::loadPlaylistPermissions(const std::shared_ptr &server, ts::PlaylistId playlist_id) { shared_ptr result; if(this->use_startup_cache && server) { shared_ptr entry; @@ -515,7 +515,7 @@ std::shared_ptr DatabaseHelper::loadPlaylistPermi } assert(result); - weak_ptr weak_server = server; + weak_ptr weak_server = server; auto server_id = server ? server->getServerId() : 0; result->registerUpdateHandler([&, weak_server, server_id, playlist_id](std::shared_ptr permission) { @@ -557,7 +557,7 @@ std::shared_ptr DatabaseHelper::loadPlaylistPermi return result; } -std::shared_ptr DatabaseHelper::loadChannelPermissions(const std::shared_ptr& server, ts::ChannelId channel) { +std::shared_ptr DatabaseHelper::loadChannelPermissions(const std::shared_ptr& server, ts::ChannelId channel) { auto result = std::make_shared(); if(this->use_startup_cache && server) { shared_ptr entry; @@ -589,7 +589,7 @@ std::shared_ptr DatabaseHelper::loadChannelPe return result; } -void DatabaseHelper::saveChannelPermissions(const std::shared_ptr &server, ts::ChannelId channel_id, const std::shared_ptr &permissions) { +void DatabaseHelper::saveChannelPermissions(const std::shared_ptr &server, ts::ChannelId channel_id, const std::shared_ptr &permissions) { const auto updates = permissions->flush_db_updates(); if(updates.empty()) return; @@ -726,7 +726,7 @@ inline sql::result load_properties(ServerId sid, deque DatabaseHelper::loadServerProperties(const std::shared_ptr& server) { +std::shared_ptr DatabaseHelper::loadServerProperties(const std::shared_ptr& server) { auto props = std::make_shared(); props->register_property_type(); @@ -770,7 +770,7 @@ std::shared_ptr DatabaseHelper::loadServerProperties(const std::shar } } - weak_ptr weak = server; + weak_ptr weak = server; ServerId serverId = server ? server->getServerId() : 0; props->registerNotifyHandler([&, serverId, weak](Property& prop){ if((prop.type().flags & property::FLAG_SAVE) == 0) { @@ -800,7 +800,7 @@ std::shared_ptr DatabaseHelper::loadServerProperties(const std::shar return props; } -std::shared_ptr DatabaseHelper::loadPlaylistProperties(const std::shared_ptr& server, PlaylistId id) { +std::shared_ptr DatabaseHelper::loadPlaylistProperties(const std::shared_ptr& server, PlaylistId id) { auto props = std::make_shared(); props->register_property_type(); @@ -843,7 +843,7 @@ std::shared_ptr DatabaseHelper::loadPlaylistProperties(const std::sh } } - weak_ptr weak = server; + weak_ptr weak = server; ServerId serverId = server ? server->getServerId() : 0; props->registerNotifyHandler([&, serverId, weak, id](Property& prop){ if((prop.type().flags & property::FLAG_SAVE) == 0) { @@ -873,7 +873,7 @@ std::shared_ptr DatabaseHelper::loadPlaylistProperties(const std::sh return props; } -std::shared_ptr DatabaseHelper::loadChannelProperties(const shared_ptr& server, ChannelId channel) { +std::shared_ptr DatabaseHelper::loadChannelProperties(const shared_ptr& server, ChannelId channel) { ServerId serverId = server ? server->getServerId() : 0U; auto props = std::make_shared(); @@ -920,7 +920,7 @@ std::shared_ptr DatabaseHelper::loadChannelProperties(const shared_p } } - weak_ptr weak = server; + weak_ptr weak = server; props->registerNotifyHandler([&, weak, serverId, channel](Property& prop){ auto weak_server = weak.lock(); if(!weak_server && serverId != 0) @@ -954,7 +954,7 @@ std::shared_ptr DatabaseHelper::loadChannelProperties(const shared_p return props; } -std::shared_ptr DatabaseHelper::loadClientProperties(const std::shared_ptr& server, ClientDbId cldbid, ClientType type) { +std::shared_ptr DatabaseHelper::loadClientProperties(const std::shared_ptr& server, ClientDbId cldbid, ClientType type) { auto props = DatabaseHelper::default_properties_client(nullptr, type); if(server) { props->operator[](property::CLIENT_DESCRIPTION) = server->properties()[property::VIRTUALSERVER_DEFAULT_CLIENT_DESCRIPTION].value(); @@ -997,7 +997,7 @@ std::shared_ptr DatabaseHelper::loadClientProperties(const std::shar } - weak_ptr weak_server = server; + weak_ptr weak_server = server; auto server_id = server ? server->getServerId() : 0; props->registerNotifyHandler([&, weak_server, server_id, cldbid, type](Property& prop){ //General save auto server = weak_server.lock(); @@ -1237,7 +1237,7 @@ void DatabaseHelper::loadStartupPropertyCache() { }, &arg); } -bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr &server, ts::GroupId group_id) { +bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr &server, ts::GroupId group_id) { auto command = sql::command(this->sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `type` = :type AND `id` = :id", variable{":serverId", server ? server->getServerId() : 0}, variable{":type", permission::SQL_PERM_GROUP}, @@ -1246,7 +1246,7 @@ bool DatabaseHelper::deleteGroupPermissions(const std::shared_ptr &server, ts::ChannelId channel_id) { +bool DatabaseHelper::deleteChannelPermissions(const std::shared_ptr &server, ts::ChannelId channel_id) { auto command = sql::command(sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId AND `channelId` = :chid", variable{":serverId", server ? server->getServerId() : 0}, variable{":chid", channel_id}).execute(); @@ -1263,7 +1263,7 @@ std::deque> DatabaseHelper::query_properties( return result; } -bool DatabaseHelper::deletePlaylist(const std::shared_ptr &server, ts::PlaylistId playlist_id) { +bool DatabaseHelper::deletePlaylist(const std::shared_ptr &server, ts::PlaylistId playlist_id) { auto server_id = server ? server->getServerId() : (ServerId) 0; sql::command(this->sql, "DELETE FROM `playlists` WHERE `serverId` = :server_id AND `playlist_id` = :playlist_id", diff --git a/server/src/DatabaseHelper.h b/server/src/DatabaseHelper.h index eefaf4c..0ec3d55 100644 --- a/server/src/DatabaseHelper.h +++ b/server/src/DatabaseHelper.h @@ -10,7 +10,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class DataClient; struct ClientDatabaseInfo { @@ -86,30 +86,30 @@ namespace ts { size_t cacheBinarySize(); void clearStartupCache(ServerId sid = 0); - void deleteClient(const std::shared_ptr&,ClientDbId); - bool validClientDatabaseId(const std::shared_ptr&, ClientDbId); - std::deque> queryDatabaseInfo(const std::shared_ptr&, const std::deque&); - std::deque> queryDatabaseInfoByUid(const std::shared_ptr &, std::deque); + void deleteClient(const std::shared_ptr&,ClientDbId); + bool validClientDatabaseId(const std::shared_ptr&, ClientDbId); + std::deque> queryDatabaseInfo(const std::shared_ptr&, const std::deque&); + std::deque> queryDatabaseInfoByUid(const std::shared_ptr &, std::deque); - std::shared_ptr loadClientPermissionManager(const std::shared_ptr&, ClientDbId); //Just and write - void saveClientPermissions(const std::shared_ptr&, ClientDbId , const std::shared_ptr& /* permission manager */); + std::shared_ptr loadClientPermissionManager(const std::shared_ptr&, ClientDbId); //Just and write + void saveClientPermissions(const std::shared_ptr&, ClientDbId , const std::shared_ptr& /* permission manager */); - std::shared_ptr loadChannelPermissions(const std::shared_ptr&, ChannelId); //Just read - void saveChannelPermissions(const std::shared_ptr&, ChannelId, const std::shared_ptr& /* permission manager */); + std::shared_ptr loadChannelPermissions(const std::shared_ptr&, ChannelId); //Just read + void saveChannelPermissions(const std::shared_ptr&, ChannelId, const std::shared_ptr& /* permission manager */); - std::shared_ptr loadGroupPermissions(const std::shared_ptr&, GroupId); //Just read - void saveGroupPermissions(const std::shared_ptr&, GroupId, const std::shared_ptr& /* permission manager */); + std::shared_ptr loadGroupPermissions(const std::shared_ptr&, GroupId); //Just read + void saveGroupPermissions(const std::shared_ptr&, GroupId, const std::shared_ptr& /* permission manager */); - std::shared_ptr loadPlaylistPermissions(const std::shared_ptr&, PlaylistId /* playlist id */); //Read and write + std::shared_ptr loadPlaylistPermissions(const std::shared_ptr&, PlaylistId /* playlist id */); //Read and write - std::shared_ptr loadServerProperties(const std::shared_ptr&); //Read and write - std::shared_ptr loadPlaylistProperties(const std::shared_ptr&, PlaylistId); //Read and write - std::shared_ptr loadChannelProperties(const std::shared_ptr&, ChannelId); //Read and write - std::shared_ptr loadClientProperties(const std::shared_ptr&, ClientDbId, ClientType); + std::shared_ptr loadServerProperties(const std::shared_ptr&); //Read and write + std::shared_ptr loadPlaylistProperties(const std::shared_ptr&, PlaylistId); //Read and write + std::shared_ptr loadChannelProperties(const std::shared_ptr&, ChannelId); //Read and write + std::shared_ptr loadClientProperties(const std::shared_ptr&, ClientDbId, ClientType); - bool deleteGroupPermissions(const std::shared_ptr&, GroupId); - bool deleteChannelPermissions(const std::shared_ptr&, ChannelId); - bool deletePlaylist(const std::shared_ptr&, PlaylistId /* playlist id */); + bool deleteGroupPermissions(const std::shared_ptr&, GroupId); + bool deleteChannelPermissions(const std::shared_ptr&, ChannelId); + bool deletePlaylist(const std::shared_ptr&, PlaylistId /* playlist id */); std::deque> query_properties(ServerId /* server */, property::PropertyType /* type */, uint64_t /* id */); /* required for server snapshots */ void tick(); diff --git a/server/src/Group.cpp b/server/src/Group.cpp index 00506f6..40eed0a 100644 --- a/server/src/Group.cpp +++ b/server/src/Group.cpp @@ -3,7 +3,7 @@ #include #include #include "Group.h" -#include "TSServer.h" +#include "VirtualServer.h" #include "src/client/ConnectedClient.h" #include "InstanceHandler.h" #include "src/server/file/FileServer.h" @@ -88,7 +88,7 @@ Group::~Group() { memtrack::freed(this); } -GroupManager::GroupManager(const shared_ptr &server, sql::SqlManager *sql, std::shared_ptr root) : server(server), sql(sql), root(std::move(root)) { } +GroupManager::GroupManager(const shared_ptr &server, sql::SqlManager *sql, std::shared_ptr root) : server(server), sql(sql), root(std::move(root)) { } GroupManager::~GroupManager() {} diff --git a/server/src/Group.h b/server/src/Group.h index c3ce431..c1f8f99 100644 --- a/server/src/Group.h +++ b/server/src/Group.h @@ -13,7 +13,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class ConnectedClient; } @@ -145,11 +145,11 @@ namespace ts { class GroupManager { friend class ServerChannelTree; friend class Group; - friend class server::TSServer; + friend class server::VirtualServer; public: static int64_t generateGroupId(sql::SqlManager* sql); - GroupManager(const std::shared_ptr &, sql::SqlManager *, std::shared_ptr root = nullptr); + GroupManager(const std::shared_ptr &, sql::SqlManager *, std::shared_ptr root = nullptr); ~GroupManager(); bool loadGroupFormDatabase(GroupId id = 0); @@ -221,7 +221,7 @@ namespace ts { void handleChannelDeleted(const ChannelId& /* channel id */); private: std::shared_ptr root = nullptr; - std::weak_ptr server; + std::weak_ptr server; ServerId getServerId(); sql::SqlManager* sql; diff --git a/server/src/InstanceHandler.cpp b/server/src/InstanceHandler.cpp index 66d0028..212ba73 100644 --- a/server/src/InstanceHandler.cpp +++ b/server/src/InstanceHandler.cpp @@ -182,14 +182,14 @@ InstanceHandler::InstanceHandler(SqlDataManager *sql) : sql(sql) { this->web_list = make_shared(); } -void InstanceHandler::executeTick(TSServer* server) { +void InstanceHandler::executeTick(VirtualServer* server) { auto str = "server_" + to_string(server->getServerId()); - if(!this->tick_manager->schedule(str, std::bind(&TSServer::executeServerTick, server), milliseconds(500))) { + if(!this->tick_manager->schedule(str, std::bind(&VirtualServer::executeServerTick, server), milliseconds(500))) { logCritical(LOG_INSTANCE, "Could not schedule server ticking task!"); } } -void InstanceHandler::cancelExecute(TSServer* server) { +void InstanceHandler::cancelExecute(VirtualServer* server) { auto str = "server_" + to_string(server->getServerId()); if(!this->tick_manager->cancelTask(str)){ logError(LOG_INSTANCE, "Could not stop server tick task!"); diff --git a/server/src/InstanceHandler.h b/server/src/InstanceHandler.h index d2e1f1c..d99799e 100644 --- a/server/src/InstanceHandler.h +++ b/server/src/InstanceHandler.h @@ -48,8 +48,8 @@ namespace ts { std::chrono::time_point getStartTimestamp(){ return startTimestamp; } - void executeTick(TSServer*); - void cancelExecute(TSServer*); + void executeTick(VirtualServer*); + void cancelExecute(VirtualServer*); bool reloadConfig(std::vector& /* errors */, bool /* reload file */); void setWebCertRoot(const std::string& /* key */, const std::string& /* certificate */, const std::string& /* revision */); diff --git a/server/src/ServerManager.cpp b/server/src/ServerManager.cpp index 9f98703..2fe1355 100644 --- a/server/src/ServerManager.cpp +++ b/server/src/ServerManager.cpp @@ -119,7 +119,7 @@ bool ServerManager::initialize(bool autostart) { } - auto server = make_shared(id, this->handle->getSql()); + auto server = make_shared(id, this->handle->getSql()); server->self = server; if(!server->initialize(true)) { //FIXME error handling @@ -180,14 +180,14 @@ bool ServerManager::initialize(bool autostart) { return true; } -shared_ptr ServerManager::findServerById(ServerId sid) { +shared_ptr ServerManager::findServerById(ServerId sid) { for(auto server : this->serverInstances()) if(server->getServerId() == sid) return server; return nullptr; } -shared_ptr ServerManager::findServerByPort(uint16_t port) { +shared_ptr ServerManager::findServerByPort(uint16_t port) { for(const auto& server : this->serverInstances()){ if(server->properties()[property::VIRTUALSERVER_PORT] == port) return server; if(server->running() && server->getVoiceServer()) @@ -306,7 +306,7 @@ size_t ServerManager::usedSlots() { return res; } -shared_ptr ServerManager::createServer(std::string hosts, uint16_t port) { +shared_ptr ServerManager::createServer(std::string hosts, uint16_t port) { bool sid_success = false; ServerId serverId = this->next_available_server_id(sid_success); @@ -321,7 +321,7 @@ shared_ptr ServerManager::createServer(std::string hosts, uint16_t por if(!prop_copy.success) logCritical(LOG_GENERAL, "Failed to copy default server properties: {}", prop_copy.fmtStr()); - auto server = make_shared(serverId, this->handle->getSql()); + auto server = make_shared(serverId, this->handle->getSql()); server->self = server; if(!server->initialize(true)) { //FIXME error handling @@ -337,7 +337,7 @@ shared_ptr ServerManager::createServer(std::string hosts, uint16_t por return server; } -bool ServerManager::deleteServer(shared_ptr server) { +bool ServerManager::deleteServer(shared_ptr server) { { threads::MutexLock l(this->instanceLock); bool found = false; @@ -347,7 +347,7 @@ bool ServerManager::deleteServer(shared_ptr server) { break; } if(!found) return false; - this->instances.erase(std::remove_if(this->instances.begin(), this->instances.end(), [&](const shared_ptr& s) { + this->instances.erase(std::remove_if(this->instances.begin(), this->instances.end(), [&](const shared_ptr& s) { return s == server; }), this->instances.end()); } diff --git a/server/src/ServerManager.h b/server/src/ServerManager.h index 891e66a..6ecde63 100644 --- a/server/src/ServerManager.h +++ b/server/src/ServerManager.h @@ -4,7 +4,7 @@ #include #include "client/voice/PrecomputedPuzzles.h" #include "server/VoiceIOManager.h" -#include "TSServer.h" +#include "VirtualServer.h" namespace ts { namespace server { @@ -32,15 +32,15 @@ namespace ts { bool initialize(bool execute_autostart = true); - std::shared_ptr createServer(std::string, uint16_t); - bool deleteServer(std::shared_ptr); + std::shared_ptr createServer(std::string, uint16_t); + bool deleteServer(std::shared_ptr); - std::shared_ptr findServerById(ServerId); - std::shared_ptr findServerByPort(uint16_t); + std::shared_ptr findServerById(ServerId); + std::shared_ptr findServerByPort(uint16_t); uint16_t next_available_port(); ServerId next_available_server_id(bool& /* success */); - std::deque> serverInstances(){ + std::deque> serverInstances(){ threads::MutexLock l(this->instanceLock); return instances; } @@ -54,8 +54,8 @@ namespace ts { void shutdownAll(const std::string&); //Dotn use shared_ptr references to keep sure that they be hold in memory - bool createServerSnapshot(Command &cmd, std::shared_ptr server, int version, std::string &error); - std::shared_ptr createServerFromSnapshot(std::shared_ptr old, std::string, uint16_t, const ts::Command &, std::string &); + bool createServerSnapshot(Command &cmd, std::shared_ptr server, int version, std::string &error); + std::shared_ptr createServerFromSnapshot(std::shared_ptr old, std::string, uint16_t, const ts::Command &, std::string &); size_t maxSlotLimit(){ return 254; } @@ -81,7 +81,7 @@ namespace ts { State state = State::STOPPED; InstanceHandler* handle; threads::Mutex instanceLock; - std::deque> instances; + std::deque> instances; protocol::PuzzleManager* puzzles = nullptr; event::EventExecutor* execute_loop = nullptr; diff --git a/server/src/ServerManagerSnapshotDeploy.cpp b/server/src/ServerManagerSnapshotDeploy.cpp index f21fc99..338c9e6 100644 --- a/server/src/ServerManagerSnapshotDeploy.cpp +++ b/server/src/ServerManagerSnapshotDeploy.cpp @@ -163,7 +163,7 @@ struct SnapshotPermissionEntry { } }; -std::shared_ptr ServerManager::createServerFromSnapshot(shared_ptr old, std::string host, +std::shared_ptr ServerManager::createServerFromSnapshot(shared_ptr old, std::string host, uint16_t port, const ts::Command &arguments, std::string &error) { ServerId serverId = 0; @@ -671,7 +671,7 @@ std::shared_ptr ServerManager::createServerFromSnapshot(shared_ptrdeleteServer(old); //Now we load the server - auto server = make_shared(serverId, this->handle->getSql()); + auto server = make_shared(serverId, this->handle->getSql()); server->self = server; if(!server->initialize(false)) { //FIXME Error handling! @@ -721,7 +721,7 @@ inline bool writePermissions(const shared_ptr return true; } -inline void writeRelations(const shared_ptr& server, GroupTarget type, Command& cmd, int& index, int version) { +inline void writeRelations(const shared_ptr& server, GroupTarget type, Command& cmd, int& index, int version) { PermissionCommandTuple parm{cmd, index, version, 0, 0}; auto res = sql::command(server->getSql(), "SELECT `cldbid`, `groups`.`groupId`, `channelId`, `until` FROM `assignedGroups` INNER JOIN `groups` ON `groups`.`serverId` = `assignedGroups`.`serverId` AND `groups`.`groupId` = `assignedGroups`.`groupId` WHERE `groups`.`serverId` = :sid AND `groups`.target = :type", variable{":sid", server->getServerId()}, @@ -767,7 +767,7 @@ struct DatabaseMusicbot { std::string bot_unique_id; }; -bool ServerManager::createServerSnapshot(Command &cmd, shared_ptr server, int version, std::string &error) { +bool ServerManager::createServerSnapshot(Command &cmd, shared_ptr server, int version, std::string &error) { int index = 0; diff --git a/server/src/SignalHandler.cpp b/server/src/SignalHandler.cpp index 7bc5549..2b816ad 100644 --- a/server/src/SignalHandler.cpp +++ b/server/src/SignalHandler.cpp @@ -1,6 +1,6 @@ #include -#include "TSServer.h" +#include "VirtualServer.h" #include "SignalHandler.h" #include "ServerManager.h" #include "InstanceHandler.h" diff --git a/server/src/TS3ServerClientManager.cpp b/server/src/TS3ServerClientManager.cpp index c9dcabc..8f32204 100644 --- a/server/src/TS3ServerClientManager.cpp +++ b/server/src/TS3ServerClientManager.cpp @@ -2,7 +2,7 @@ #include #include "client/voice/VoiceClient.h" #include "client/InternalClient.h" -#include "TSServer.h" +#include "VirtualServer.h" #include #include #include @@ -15,7 +15,7 @@ using namespace ts::buffer; using namespace ts::permission; using namespace std::chrono; -bool TSServer::registerClient(shared_ptr client) { +bool VirtualServer::registerClient(shared_ptr client) { sassert(client); { @@ -86,7 +86,7 @@ bool TSServer::registerClient(shared_ptr client) { return true; } -bool TSServer::unregisterClient(shared_ptr cl, std::string reason, std::unique_lock& chan_tree_lock) { +bool VirtualServer::unregisterClient(shared_ptr cl, std::string reason, std::unique_lock& chan_tree_lock) { if(cl->getType() == ClientType::CLIENT_TEAMSPEAK && cl->getType() == ClientType::CLIENT_WEB) { sassert(cl->state == ConnectionState::DISCONNECTED); } @@ -127,7 +127,7 @@ bool TSServer::unregisterClient(shared_ptr cl, std::string reas return true; } -void TSServer::registerInternalClient(std::shared_ptr client) { +void VirtualServer::registerInternalClient(std::shared_ptr client) { client->state = ConnectionState::CONNECTED; { lock_guard lock(this->clients.lock); @@ -151,7 +151,7 @@ void TSServer::registerInternalClient(std::shared_ptr client) { } } -void TSServer::unregisterInternalClient(std::shared_ptr client) { +void VirtualServer::unregisterInternalClient(std::shared_ptr client) { client->state = ConnectionState::DISCONNECTED; { @@ -172,7 +172,7 @@ void TSServer::unregisterInternalClient(std::shared_ptr client) } } -bool TSServer::assignDefaultChannel(const shared_ptr& client, bool join) { +bool VirtualServer::assignDefaultChannel(const shared_ptr& client, bool join) { shared_lock server_channel_lock(this->channel_tree_lock); std::shared_ptr channel = nullptr; if(client->properties()->hasProperty(property::CLIENT_DEFAULT_CHANNEL) && !client->properties()[property::CLIENT_DEFAULT_CHANNEL].as().empty()) { @@ -208,7 +208,7 @@ bool TSServer::assignDefaultChannel(const shared_ptr& client, b return true; } -void TSServer::testBanStateChange(const std::shared_ptr& invoker) { +void VirtualServer::testBanStateChange(const std::shared_ptr& invoker) { this->forEachClient([&](shared_ptr client) { auto ban = client->resolveActiveBan(client->getPeerIp()); if(ban) { @@ -220,7 +220,7 @@ void TSServer::testBanStateChange(const std::shared_ptr& invoke }); } -bool TSServer::could_default_create_channel() { +bool VirtualServer::could_default_create_channel() { { auto default_group = this->getGroupManager()->defaultGroup(GroupTarget::GROUPTARGET_SERVER); @@ -254,7 +254,7 @@ bool TSServer::could_default_create_channel() { cl->notifyClientLeftViewKicked(client, client->currentChannel, nullptr, cmd["reasonmsg"].as(), this); */ -void TSServer::notify_client_ban(const shared_ptr &target, const std::shared_ptr &invoker, const std::string &reason, size_t time) { +void VirtualServer::notify_client_ban(const shared_ptr &target, const std::shared_ptr &invoker, const std::string &reason, size_t time) { /* the target is not allowed to execute anything; Must before channel tree lock because the target may waits for us to finish the channel stuff */ lock_guard command_lock(target->command_lock); unique_lock server_channel_lock(this->channel_tree_lock); /* we're "moving" a client! */ @@ -279,7 +279,7 @@ void TSServer::notify_client_ban(const shared_ptr &target, cons target->currentChannel = nullptr; } -void TSServer::notify_client_kick( +void VirtualServer::notify_client_kick( const std::shared_ptr &target, const std::shared_ptr &invoker, const std::string &reason, @@ -323,7 +323,7 @@ void TSServer::notify_client_kick( * * Note: channel cant be a ref because the channel itself gets deleted! */ -void TSServer::delete_channel(shared_ptr channel, const shared_ptr &invoker, const std::string& kick_message, unique_lock &tree_lock) { +void VirtualServer::delete_channel(shared_ptr channel, const shared_ptr &invoker, const std::string& kick_message, unique_lock &tree_lock) { if(!tree_lock.owns_lock()) tree_lock.lock(); if(channel->deleted) @@ -365,7 +365,7 @@ void TSServer::delete_channel(shared_ptr channel, const share }); } -void TSServer::client_move( +void VirtualServer::client_move( const shared_ptr &target, shared_ptr target_channel, const std::shared_ptr &invoker, diff --git a/server/src/TS3ServerHeartbeat.cpp b/server/src/TS3ServerHeartbeat.cpp index 6ca125f..cd17fd7 100644 --- a/server/src/TS3ServerHeartbeat.cpp +++ b/server/src/TS3ServerHeartbeat.cpp @@ -3,7 +3,7 @@ #include "client/voice/VoiceClient.h" #include #include "InstanceHandler.h" -#include "TSServer.h" +#include "VirtualServer.h" #include "./manager/ConversationManager.h" using namespace std; @@ -13,7 +13,7 @@ using namespace ts::protocol; using namespace ts::buffer; extern InstanceHandler* serverInstance; -inline void banClientFlood(TSServer* server, const shared_ptr& cl, time_point until){ +inline void banClientFlood(VirtualServer* server, const shared_ptr& cl, time_point until){ auto time = until.time_since_epoch().count() == 0 ? 0L : chrono::ceil(until - system_clock::now()).count(); std::string reason = "You're flooding too much"; @@ -30,7 +30,7 @@ inline void banClientFlood(TSServer* server, const shared_ptr& timing_end = system_clock::now(); \ variable = duration_cast(timing_end - timing_begin); -void TSServer::executeServerTick() { +void VirtualServer::executeServerTick() { threads::MutexTryLock l(this->stateLock); //Should not attempt to shutdown or start the server while ticking if(!l) { if(this->running()) diff --git a/server/src/TSServer.cpp b/server/src/VirtualServer.cpp similarity index 95% rename from server/src/TSServer.cpp rename to server/src/VirtualServer.cpp index 3ea4132..c434954 100644 --- a/server/src/TSServer.cpp +++ b/server/src/VirtualServer.cpp @@ -21,7 +21,7 @@ #include "server/QueryServer.h" #include "InstanceHandler.h" #include "Configuration.h" -#include "TSServer.h" +#include "VirtualServer.h" #include "src/manager/ConversationManager.h" #include @@ -39,11 +39,11 @@ using namespace ts::buffer; #endif extern ts::server::InstanceHandler* serverInstance; -TSServer::TSServer(uint16_t serverId, sql::SqlManager* database) : serverId(serverId), sql(database) { - memtrack::allocated(this); +VirtualServer::VirtualServer(uint16_t serverId, sql::SqlManager* database) : serverId(serverId), sql(database) { + memtrack::allocated(this); } -bool TSServer::initialize(bool test_properties) { +bool VirtualServer::initialize(bool test_properties) { assert(self.lock()); this->_properties = serverInstance->databaseHelper()->loadServerProperties(self.lock()); @@ -232,8 +232,8 @@ bool TSServer::initialize(bool test_properties) { return true; } -TSServer::~TSServer() { - memtrack::freed(this); +VirtualServer::~VirtualServer() { + memtrack::freed(this); delete this->tokenManager; delete this->groups; delete this->channelTree; @@ -289,7 +289,7 @@ inline vector split_hosts(const std::string& message, char delimiter) { return result; } -bool TSServer::start(std::string& error) { +bool VirtualServer::start(std::string& error) { { threads::Mutex lock(this->stateLock); if(this->state != ServerState::OFFLINE){ @@ -433,18 +433,18 @@ bool TSServer::start(std::string& error) { return true; } -std::string TSServer::publicServerKey() { +std::string VirtualServer::publicServerKey() { size_t keyBufferLength = 265; char keyBuffer[keyBufferLength]; if(ecc_export((unsigned char *) keyBuffer, &keyBufferLength, PK_PUBLIC, this->_serverKey) != CRYPT_OK) return ""; return base64::encode(string(keyBuffer, keyBufferLength)); } -bool TSServer::running() { +bool VirtualServer::running() { return this->state == ServerState::BOOTING || this->state == ServerState::ONLINE; } -void TSServer::preStop(const std::string& reason) { +void VirtualServer::preStop(const std::string& reason) { { threads::MutexLock lock(this->stateLock); if(!this->running() && this->state != ServerState::SUSPENDING) return; @@ -466,7 +466,7 @@ void TSServer::preStop(const std::string& reason) { } } -void TSServer::stop(const std::string& reason) { +void VirtualServer::stop(const std::string& reason) { auto self_lock = this->self.lock(); assert(self_lock); { @@ -532,7 +532,7 @@ void TSServer::stop(const std::string& reason) { this->serverAdmin->server = nullptr; } -size_t TSServer::onlineClients() { +size_t VirtualServer::onlineClients() { size_t result = 0; lock_guard lock(this->clients.lock); @@ -545,7 +545,7 @@ size_t TSServer::onlineClients() { return result; } -OnlineClientReport TSServer::onlineStats() { +OnlineClientReport VirtualServer::onlineStats() { OnlineClientReport response{}; { @@ -575,7 +575,7 @@ OnlineClientReport TSServer::onlineStats() { return response; } -std::shared_ptr TSServer::findClient(sockaddr_in *addr) { +std::shared_ptr VirtualServer::findClient(sockaddr_in *addr) { lock_guard lock(this->clients.lock); for(const auto& elm : this->clients.clients) { if(elm && elm->isAddressV4()) @@ -586,7 +586,7 @@ std::shared_ptr TSServer::findClient(sockaddr_in *addr) { return nullptr; } -std::shared_ptr TSServer::findClient(uint16_t client_id) { +std::shared_ptr VirtualServer::findClient(uint16_t client_id) { lock_guard lock(this->clients.lock); if(this->clients.clients.size() > client_id) return this->clients.clients[client_id]; @@ -594,7 +594,7 @@ std::shared_ptr TSServer::findClient(uint16_t client_id) { return nullptr; } -deque> TSServer::findClientsByCldbId(uint64_t cldbId) { +deque> VirtualServer::findClientsByCldbId(uint64_t cldbId) { deque> result; lock_guard lock(this->clients.lock); @@ -607,7 +607,7 @@ deque> TSServer::findClientsByCldbId(uint64_t cldbId return result; } -deque> TSServer::findClientsByUid(std::string uid) { +deque> VirtualServer::findClientsByUid(std::string uid) { lock_guard lock(this->clients.lock); deque> result; @@ -621,7 +621,7 @@ deque> TSServer::findClientsByUid(std::string uid) { return result; } -std::shared_ptr TSServer::findClient(std::string name, bool ignoreCase) { +std::shared_ptr VirtualServer::findClient(std::string name, bool ignoreCase) { if(ignoreCase) { std::transform(name.begin(), name.end(), name.begin(), ::tolower); } @@ -645,7 +645,7 @@ std::shared_ptr TSServer::findClient(std::string name, bool ign return nullptr; } -bool TSServer::forEachClient(std::function)> function) { +bool VirtualServer::forEachClient(std::function)> function) { for(const auto& elm : this->getClients()) { shared_lock close_lock(elm->finalDisconnectLock, try_to_lock_t{}); if(close_lock.owns_lock()) //If not locked than client is on the way to disconnect @@ -656,7 +656,7 @@ bool TSServer::forEachClient(std::function return true; } -std::vector> TSServer::getClients() { +std::vector> VirtualServer::getClients() { vector> clients; { @@ -672,7 +672,7 @@ std::vector> TSServer::getClients() { return clients; } -deque> TSServer::getClientsByChannel(std::shared_ptr channel) { +deque> VirtualServer::getClientsByChannel(std::shared_ptr channel) { assert(this); auto s_channel = dynamic_pointer_cast(channel); @@ -694,7 +694,7 @@ deque> TSServer::getClientsByChannel(std::shared_ptr return result; } -deque> TSServer::getClientsByChannelRoot(const std::shared_ptr &root, bool lock) { +deque> VirtualServer::getClientsByChannelRoot(const std::shared_ptr &root, bool lock) { assert(this); shared_lock channel_lock(this->channel_tree_lock, defer_lock); @@ -710,7 +710,7 @@ deque> TSServer::getClientsByChannelRoot(const std:: return result; } -bool TSServer::notifyServerEdited(std::shared_ptr invoker, deque keys) { +bool VirtualServer::notifyServerEdited(std::shared_ptr invoker, deque keys) { if(!invoker) return false; Command cmd("notifyserveredited"); @@ -733,7 +733,7 @@ bool TSServer::notifyServerEdited(std::shared_ptr invoker, dequ return true; } -bool TSServer::notifyClientPropertyUpdates(std::shared_ptr client, const deque>& keys, bool selfNotify) { +bool VirtualServer::notifyClientPropertyUpdates(std::shared_ptr client, const deque>& keys, bool selfNotify) { if(keys.empty()) return false; this->forEachClient([&](const shared_ptr& cl) { shared_lock client_channel_lock(client->channel_lock); @@ -743,7 +743,7 @@ bool TSServer::notifyClientPropertyUpdates(std::shared_ptr clie return true; } -void TSServer::broadcastMessage(std::shared_ptr invoker, std::string message) { +void VirtualServer::broadcastMessage(std::shared_ptr invoker, std::string message) { if(!invoker) { logCritical(this->serverId, "Tried to broadcast with an invalid invoker!"); return; @@ -753,7 +753,7 @@ void TSServer::broadcastMessage(std::shared_ptr invoker, std::s }); } -std::vector> CalculateCache::getGroupAssignments(TSServer* server, ClientDbId cldbid, ClientType type) { +std::vector> CalculateCache::getGroupAssignments(VirtualServer* server, ClientDbId cldbid, ClientType type) { if(assignment_server_groups_set) return assignment_server_groups; assignment_server_groups = server->getGroupManager()->getServerGroups(cldbid, type); @@ -761,7 +761,7 @@ std::vector> CalculateCache::getGroupAssignment return assignment_server_groups; } -std::shared_ptr CalculateCache::getChannelAssignment(TSServer* server, ClientDbId client_dbid, ChannelId channel_id) { +std::shared_ptr CalculateCache::getChannelAssignment(VirtualServer* server, ClientDbId client_dbid, ChannelId channel_id) { if(this->assignment_channel_group_set && this->assignment_channel_group_channel == channel_id) return this->assignment_channel_group; auto channel = this->getServerChannel(server, channel_id); @@ -771,7 +771,7 @@ std::shared_ptr CalculateCache::getChannelAssignment(TSServer* return assignment_channel_group; } -std::shared_ptr CalculateCache::getServerChannel(ts::server::TSServer *server, ts::ChannelId channel_id) { +std::shared_ptr CalculateCache::getServerChannel(ts::server::VirtualServer *server, ts::ChannelId channel_id) { if(this->last_server_channel == channel_id) return this->server_channel; this->last_server_channel = channel_id; @@ -783,7 +783,7 @@ ts_always_inline bool channel_ignore_permission(ts::permission::PermissionType t return permission::i_icon_id == type; } -vector> TSServer::calculate_permissions( +vector> VirtualServer::calculate_permissions( const std::deque& permissions, ClientDbId client_dbid, ClientType client_type, @@ -1000,7 +1000,7 @@ vectorproperties()[property::VIRTUALSERVER_FLAG_PASSWORD].as()) return true; if(password.empty()) return false; @@ -1026,12 +1026,12 @@ bool TSServer::verifyServerPassword(std::string password, bool hashed) { return password == this->properties()[property::VIRTUALSERVER_PASSWORD].as(); } -float TSServer::averagePacketLoss() { +float VirtualServer::averagePacketLoss() { //TODO Average packet loss return 0.f; } -float TSServer::averagePing() { +float VirtualServer::averagePing() { float count = 0; float sum = 0; @@ -1053,7 +1053,7 @@ float TSServer::averagePing() { return sum / count; } -bool TSServer::resetPermissions(std::string& token) { +bool VirtualServer::resetPermissions(std::string& token) { LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `permissions` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute()); LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `assignedGroups` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute()); LOG_SQL_CMD(sql::command(this->sql, "DELETE FROM `groups` WHERE `serverId` = :serverId", variable{":serverId", this->serverId}).execute()); @@ -1149,7 +1149,7 @@ bool TSServer::resetPermissions(std::string& token) { return true; } -void TSServer::ensureValidDefaultGroups() { +void VirtualServer::ensureValidDefaultGroups() { auto default_server_group = this->getGroupManager()->defaultGroup(GROUPTARGET_SERVER, true); if(!default_server_group) { logError(this->serverId, "Missing server's default server group! (Id: {})", this->properties()[property::VIRTUALSERVER_DEFAULT_SERVER_GROUP].value()); diff --git a/server/src/TSServer.h b/server/src/VirtualServer.h similarity index 96% rename from server/src/TSServer.h rename to server/src/VirtualServer.h index 043aa1c..2a66aa8 100644 --- a/server/src/TSServer.h +++ b/server/src/VirtualServer.h @@ -117,12 +117,12 @@ namespace ts { std::shared_ptr server_channel; ChannelId last_server_channel = 0; - inline std::vector> getGroupAssignments(TSServer* server, ClientDbId cldbid, ClientType type); - inline std::shared_ptr getChannelAssignment(TSServer* server, ClientDbId client_dbid, ChannelId channel); - inline std::shared_ptr getServerChannel(TSServer*, ChannelId); + inline std::vector> getGroupAssignments(VirtualServer* server, ClientDbId cldbid, ClientType type); + inline std::shared_ptr getChannelAssignment(VirtualServer* server, ClientDbId client_dbid, ChannelId channel); + inline std::shared_ptr getServerChannel(VirtualServer*, ChannelId); }; - class TSServer { + class VirtualServer { friend class WebClient; friend class DataClient; friend class VoiceClient; @@ -136,8 +136,8 @@ namespace ts { friend class InstanceHandler; friend class ServerManager; public: - TSServer(ServerId serverId, sql::SqlManager*); - ~TSServer(); + VirtualServer(ServerId serverId, sql::SqlManager*); + ~VirtualServer(); bool initialize(bool test_properties); @@ -241,7 +241,7 @@ namespace ts { bool could_default_create_channel(); - inline std::shared_ptr ref() { return this->self.lock(); } + inline std::shared_ptr ref() { return this->self.lock(); } inline bool disable_ip_saving() { return this->_disable_ip_saving; } inline std::chrono::system_clock::time_point start_timestamp() { return this->startTimestamp; }; @@ -279,7 +279,7 @@ namespace ts { bool assignDefaultChannel(const std::shared_ptr&, bool join); private: - std::weak_ptr self; + std::weak_ptr self; //Locks by tick, start and stop threads::Mutex stateLock; diff --git a/server/src/channel/ServerChannel.cpp b/server/src/channel/ServerChannel.cpp index 9225d52..9f4f202 100644 --- a/server/src/channel/ServerChannel.cpp +++ b/server/src/channel/ServerChannel.cpp @@ -3,7 +3,7 @@ #include #include #include "misc/rnd.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "src/client/ConnectedClient.h" #include "src/server/file/FileServer.h" #include "src/InstanceHandler.h" @@ -60,7 +60,7 @@ void ServerChannel::setProperties(const std::shared_ptr &ptr) { BasicChannel::setProperties(ptr); } -ServerChannelTree::ServerChannelTree(const std::shared_ptr& server, sql::SqlManager* sql) : sql(sql), server(server) { } +ServerChannelTree::ServerChannelTree(const std::shared_ptr& server, sql::SqlManager* sql) : sql(sql), server(server) { } ServerChannelTree::~ServerChannelTree() { } diff --git a/server/src/channel/ServerChannel.h b/server/src/channel/ServerChannel.h index b9c66ec..d994ccf 100644 --- a/server/src/channel/ServerChannel.h +++ b/server/src/channel/ServerChannel.h @@ -11,7 +11,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class ConnectedClient; } @@ -36,7 +36,7 @@ namespace ts { class ServerChannelTree : public BasicChannelTree { public: - ServerChannelTree(const std::shared_ptr&, sql::SqlManager*); + ServerChannelTree(const std::shared_ptr&, sql::SqlManager*); virtual ~ServerChannelTree(); void loadChannelsFromDatabase(); @@ -54,7 +54,7 @@ namespace ts { std::shared_ptr allocateChannel(const std::shared_ptr &parent, ChannelId channelId) override; private: - std::weak_ptr server; + std::weak_ptr server; ServerId getServerId(); sql::SqlManager* sql; diff --git a/server/src/client/ConnectedClient.cpp b/server/src/client/ConnectedClient.cpp index 719e7f0..6a4a0fc 100644 --- a/server/src/client/ConnectedClient.cpp +++ b/server/src/client/ConnectedClient.cpp @@ -8,7 +8,7 @@ #include #include -#include "../TSServer.h" +#include "src/VirtualServer.h" #include "voice/VoiceClient.h" #include "../server/VoiceServer.h" #include "../server/file/FileServer.h" @@ -23,7 +23,7 @@ using namespace ts::token; extern ts::server::InstanceHandler* serverInstance; -ConnectedClient::ConnectedClient(sql::SqlManager* db, const std::shared_ptr&server) : DataClient(db, server) { +ConnectedClient::ConnectedClient(sql::SqlManager* db, const std::shared_ptr&server) : DataClient(db, server) { memtrack::allocated(this); memset(&this->remote_address, 0, sizeof(this->remote_address)); @@ -83,7 +83,7 @@ std::shared_ptr ConnectedClient::request_connection_info(con //Attention the client should be only read only locked! void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool notify_self) { /* this->server may be null! */ - shared_ptr server_ref = this->server; + shared_ptr server_ref = this->server; auto permissions = this->calculate_permissions({ permission::i_client_talk_power, diff --git a/server/src/client/ConnectedClient.h b/server/src/client/ConnectedClient.h index 61381ed..1821c7d 100644 --- a/server/src/client/ConnectedClient.h +++ b/server/src/client/ConnectedClient.h @@ -16,7 +16,7 @@ if(!this->server) return command_result{error::server_invalid_id}; /* TODO: Play lock the server here with read? So the client dosn't get kicked within that moment */ #define CMD_REF_SERVER(variable_name) \ -std::shared_ptr variable_name = this->getServer(); \ +std::shared_ptr variable_name = this->getServer(); \ if(!variable_name) return command_result{error::server_invalid_id}; #define CMD_REQ_CHANNEL \ @@ -45,7 +45,7 @@ namespace ts { } namespace server { - class TSServer; + class VirtualServer; class MusicClient; class WebClient; class MusicClient; @@ -56,7 +56,7 @@ namespace ts { }; class ConnectedClient : public DataClient { - friend class TSServer; + friend class VirtualServer; friend class VoiceServer; friend class VoiceClient; friend class MusicClient; @@ -70,7 +70,7 @@ namespace ts { friend class ts::GroupManager; friend class ServerManager; public: - explicit ConnectedClient(sql::SqlManager*, const std::shared_ptr& server); + explicit ConnectedClient(sql::SqlManager*, const std::shared_ptr& server); ~ConnectedClient() override; ConnectionState connectionState(){ return this->state; } @@ -96,7 +96,7 @@ namespace ts { inline std::shared_ptr getChannel(){ return this->currentChannel; } inline ChannelId getChannelId(){ auto channel = this->currentChannel; return channel ? channel->channelId() : 0; } - inline std::shared_ptr getServer(){ return this->server; } + inline std::shared_ptr getServer(){ return this->server; } inline ServerId getServerId(){ return this->server ? this->server->getServerId() : (ServerId) 0; } //bool channelSubscribed(const std::shared_ptr&); diff --git a/server/src/client/DataClient.cpp b/server/src/client/DataClient.cpp index fea2240..ee92d42 100644 --- a/server/src/client/DataClient.cpp +++ b/server/src/client/DataClient.cpp @@ -13,7 +13,7 @@ using namespace ts; using namespace ts::server; using namespace ts::permission; -DataClient::DataClient(sql::SqlManager* database, const std::shared_ptr& server) : server(server), sql(database) { +DataClient::DataClient(sql::SqlManager* database, const std::shared_ptr& server) : server(server), sql(database) { assert(database); this->_properties = DatabaseHelper::default_properties_client(nullptr, ClientType::CLIENT_INTERNAL); } diff --git a/server/src/client/DataClient.h b/server/src/client/DataClient.h index e6e1d20..48fc12e 100644 --- a/server/src/client/DataClient.h +++ b/server/src/client/DataClient.h @@ -7,7 +7,7 @@ #include #include #include -#include "../TSServer.h" +#include "src/VirtualServer.h" #include "../Group.h" #define DEBUG_PERMISSION @@ -17,10 +17,10 @@ namespace ts { class MusicBotManager; } namespace server { - class TSServer; + class VirtualServer; class DataClient { - friend class TSServer; + friend class VirtualServer; friend class QueryServer; friend class music::MusicBotManager; public: @@ -51,7 +51,7 @@ namespace ts { } }; - DataClient(sql::SqlManager*, const std::shared_ptr&); + DataClient(sql::SqlManager*, const std::shared_ptr&); virtual ~DataClient(); @@ -100,7 +100,7 @@ namespace ts { virtual bool loadDataForCurrentServer(); protected: sql::SqlManager* sql; - std::shared_ptr server; + std::shared_ptr server; std::shared_ptr clientPermissions = nullptr; std::shared_ptr _properties; diff --git a/server/src/client/InternalClient.cpp b/server/src/client/InternalClient.cpp index 8efa87d..2b65241 100644 --- a/server/src/client/InternalClient.cpp +++ b/server/src/client/InternalClient.cpp @@ -6,7 +6,7 @@ using namespace std; using namespace ts; using namespace ts::server; -InternalClient::InternalClient(sql::SqlManager* sql,const std::shared_ptr& handle, std::string displayName, bool generalClient) : ConnectedClient(sql, handle) { +InternalClient::InternalClient(sql::SqlManager* sql,const std::shared_ptr& handle, std::string displayName, bool generalClient) : ConnectedClient(sql, handle) { memtrack::allocated(this); this->properties()[property::CLIENT_TYPE] = ClientType::CLIENT_INTERNAL; this->properties()[property::CLIENT_TYPE_EXACT] = ClientType::CLIENT_INTERNAL; diff --git a/server/src/client/InternalClient.h b/server/src/client/InternalClient.h index d95387d..dce5335 100644 --- a/server/src/client/InternalClient.h +++ b/server/src/client/InternalClient.h @@ -6,7 +6,7 @@ namespace ts { namespace server { class InternalClient : public ConnectedClient { public: - InternalClient(sql::SqlManager*, const std::shared_ptr&, std::string, bool); + InternalClient(sql::SqlManager*, const std::shared_ptr&, std::string, bool); ~InternalClient(); void setSharedLock(const std::shared_ptr& _this){ diff --git a/server/src/client/SpeakingClient.h b/server/src/client/SpeakingClient.h index c27c4bf..d3888a8 100644 --- a/server/src/client/SpeakingClient.h +++ b/server/src/client/SpeakingClient.h @@ -5,7 +5,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class SpeakingClient : public ConnectedClient { public: struct VoicePacketFlags { @@ -32,7 +32,7 @@ namespace ts { UNSET = 0xff }; - SpeakingClient(sql::SqlManager* a, const std::shared_ptr& b) : ConnectedClient(a, b) { + SpeakingClient(sql::SqlManager* a, const std::shared_ptr& b) : ConnectedClient(a, b) { speak_begin = std::chrono::system_clock::now(); speak_last_packet = std::chrono::system_clock::now(); }; diff --git a/server/src/client/command_handler/channel.cpp b/server/src/client/command_handler/channel.cpp index ed29e00..5271881 100644 --- a/server/src/client/command_handler/channel.cpp +++ b/server/src/client/command_handler/channel.cpp @@ -242,7 +242,7 @@ command_result ConnectedClient::handleCommandChannelGroupCopy(Command &cmd) { global_update = !this->server || !group_manager->isLocalGroup(group_manager->findGroup(target_group_id)); } - for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque>{this->server})) + for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque>{this->server})) if(server) server->forEachClient([](shared_ptr cl) { cl->notifyChannelGroupList(); diff --git a/server/src/client/command_handler/client.cpp b/server/src/client/command_handler/client.cpp index 934c5bd..c67290e 100644 --- a/server/src/client/command_handler/client.cpp +++ b/server/src/client/command_handler/client.cpp @@ -293,7 +293,7 @@ inline void cmd_filelist_append_files(ServerId sid, Command &command, vector server; + shared_ptr server; int index = 0; int offset = 0; int resultIndex = 0; diff --git a/server/src/client/command_handler/misc.cpp b/server/src/client/command_handler/misc.cpp index 1807e5f..37f9957 100644 --- a/server/src/client/command_handler/misc.cpp +++ b/server/src/client/command_handler/misc.cpp @@ -718,7 +718,7 @@ command_result ConnectedClient::handleCommandBanAdd(Command &cmd) { } if(!banned) serverInstance->banManager()->registerBan(sid, this->getClientDatabaseId(), banreason, uid, ip, name, hwid, until); - for(auto server : (this->server ? std::deque>{this->server} : serverInstance->getVoiceServerManager()->serverInstances())) + for(auto server : (this->server ? std::deque>{this->server} : serverInstance->getVoiceServerManager()->serverInstances())) server->testBanStateChange(_this.lock()); return command_result{error::ok}; } diff --git a/server/src/client/command_handler/server.cpp b/server/src/client/command_handler/server.cpp index 10b4b33..0852641 100644 --- a/server/src/client/command_handler/server.cpp +++ b/server/src/client/command_handler/server.cpp @@ -419,7 +419,7 @@ command_result ConnectedClient::handleCommandServerGroupCopy(Command &cmd) { global_update = !this->server || !group_manager->isLocalGroup(group_manager->findGroup(target_group_id)); } - for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque>{this->server})) + for(const auto& server : (global_update ? serverInstance->getVoiceServerManager()->serverInstances() : deque>{this->server})) if(server) server->forEachClient([](shared_ptr cl) { cl->notifyServerGroupList(); @@ -622,7 +622,7 @@ command_result ConnectedClient::handleCommandServerGroupAddClient(Command &cmd) } } - for(const auto& _server : target_server ? std::deque>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) { + for(const auto& _server : target_server ? std::deque>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) { for (const auto &targetClient : _server->findClientsByCldbId(target_cldbid)) { if (_server->notifyClientPropertyUpdates(targetClient, _server->groups->update_server_group_property(targetClient, true, targetClient->getChannel()))) { for (const auto &client : _server->getClients()) { @@ -749,7 +749,7 @@ command_result ConnectedClient::handleCommandServerGroupDelClient(Command &cmd) } } - for(const auto& _server : target_server ? std::deque>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) { + for(const auto& _server : target_server ? std::deque>{target_server} : serverInstance->getVoiceServerManager()->serverInstances()) { for (const auto &targetClient : _server->findClientsByCldbId(target_cldbid)) { if (_server->notifyClientPropertyUpdates(targetClient, _server->groups->update_server_group_property(targetClient, true, targetClient->getChannel()))) { for (const auto &client : _server->getClients()) { diff --git a/server/src/client/file/FileClient.h b/server/src/client/file/FileClient.h index abfdf9b..07c1b19 100644 --- a/server/src/client/file/FileClient.h +++ b/server/src/client/file/FileClient.h @@ -7,7 +7,7 @@ #include #include #include -#include "../../TSServer.h" +#include "src/VirtualServer.h" namespace ts { namespace server { diff --git a/server/src/client/music/MusicClient.cpp b/server/src/client/music/MusicClient.cpp index f9cf16f..9d704e3 100644 --- a/server/src/client/music/MusicClient.cpp +++ b/server/src/client/music/MusicClient.cpp @@ -24,14 +24,14 @@ MusicClient::loader_t MusicClient::channelLoader() { } MusicClient::loader_t MusicClient::failedLoader(const std::string &message) { - return make_shared([message] (const shared_ptr, const shared_ptr&, std::string& error) mutable -> std::shared_ptr { + return make_shared([message] (const shared_ptr, const shared_ptr&, std::string& error) mutable -> std::shared_ptr { error = message; return nullptr; }); } MusicClient::loader_t MusicClient::providerLoader(const std::string &name, shared_ptr<::music::manager::PlayerProvider> provider) { - return make_shared([name, provider, used_provider = std::move(provider)] (const shared_ptr server, const shared_ptr& entry, std::string& error) mutable -> std::shared_ptr { + return make_shared([name, provider, used_provider = std::move(provider)] (const shared_ptr server, const shared_ptr& entry, std::string& error) mutable -> std::shared_ptr { if(!used_provider) used_provider = ::music::manager::resolveProvider(name, entry->getUrl()); @@ -69,7 +69,7 @@ MusicClient::loader_t MusicClient::providerLoader(const std::string &name, share }); } -MusicClient::MusicClient(const std::shared_ptr& handle, const std::string& uniqueId) : ConnectedClient(handle->getSql(), handle) { +MusicClient::MusicClient(const std::shared_ptr& handle, const std::string& uniqueId) : ConnectedClient(handle->getSql(), handle) { memtrack::allocated(this); this->state = CONNECTED; this->properties()[property::CLIENT_TYPE] = ClientType::CLIENT_TEAMSPEAK; diff --git a/server/src/client/music/MusicClient.h b/server/src/client/music/MusicClient.h index 94a5d9f..d7dca06 100644 --- a/server/src/client/music/MusicClient.h +++ b/server/src/client/music/MusicClient.h @@ -44,7 +44,7 @@ namespace ts { STOPPED }; - MusicClient(const std::shared_ptr&,const std::string&); + MusicClient(const std::shared_ptr&,const std::string&); virtual ~MusicClient() override; void setSharedLock(const std::shared_ptr &_this){ diff --git a/server/src/client/music/Song.cpp b/server/src/client/music/Song.cpp index fba98da..9a4934e 100644 --- a/server/src/client/music/Song.cpp +++ b/server/src/client/music/Song.cpp @@ -11,7 +11,7 @@ using namespace std::chrono; PlayableSong::~PlayableSong() = default; -shared_ptr PlayableSong::get_loader(const std::shared_ptr& server, bool spawn_new) { +shared_ptr PlayableSong::get_loader(const std::shared_ptr& server, bool spawn_new) { if(!spawn_new || this->_loader_future) return this->_loader_future; this->_loader_future = make_shared(); diff --git a/server/src/client/music/Song.h b/server/src/client/music/Song.h index 2bcb2c7..3c42191 100644 --- a/server/src/client/music/Song.h +++ b/server/src/client/music/Song.h @@ -9,7 +9,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } namespace music { @@ -39,7 +39,7 @@ namespace ts { std::shared_ptr player; }; - typedef std::function(const std::shared_ptr& /* server */, const std::shared_ptr& entry, std::string& error)> song_loader_t; + typedef std::function(const std::shared_ptr& /* server */, const std::shared_ptr& entry, std::string& error)> song_loader_t; typedef threads::Future> song_future_t; public: @@ -56,7 +56,7 @@ namespace ts { virtual ~PlayableSong(); inline std::shared_ptr song_loader() { return this->_loader_function; } - std::shared_ptr get_loader(const std::shared_ptr&, bool /* create if not exists */ = true); + std::shared_ptr get_loader(const std::shared_ptr&, bool /* create if not exists */ = true); inline std::shared_ptr get_player() { auto data = this->song_loaded_data(); if(!data) return nullptr; diff --git a/server/src/client/music/internal_provider/channel_replay/ChannelProvider.cpp b/server/src/client/music/internal_provider/channel_replay/ChannelProvider.cpp index 8b4457f..7dcb9d6 100644 --- a/server/src/client/music/internal_provider/channel_replay/ChannelProvider.cpp +++ b/server/src/client/music/internal_provider/channel_replay/ChannelProvider.cpp @@ -21,7 +21,7 @@ struct AudioFileInfo { extern ts::server::InstanceHandler* serverInstance; threads::Future> ChannelProvider::createPlayer(const std::string &url, void*, void* ptr_server) { - auto server = ((TSServer*) ptr_server)->ref(); + auto server = ((VirtualServer*) ptr_server)->ref(); threads::Future> future; if(server) { diff --git a/server/src/client/query/QueryClientCommands.cpp b/server/src/client/query/QueryClientCommands.cpp index 0eebd0b..0412861 100644 --- a/server/src/client/query/QueryClientCommands.cpp +++ b/server/src/client/query/QueryClientCommands.cpp @@ -290,7 +290,7 @@ command_result QueryClient::handleCommandLogout(Command &) { command_result QueryClient::handleCommandServerSelect(Command &cmd) { CMD_RESET_IDLE; - shared_ptr target; + shared_ptr target; if(cmd[0].has("port")){ target = serverInstance->getVoiceServerManager()->findServerByPort(cmd["port"].as()); @@ -581,7 +581,7 @@ command_result QueryClient::handleCommandServerCreate(Command& cmd) { } string startError; - shared_ptr server; + shared_ptr server; milliseconds time_create, time_wait, time_start, time_global; { diff --git a/server/src/client/voice/VoiceClient.cpp b/server/src/client/voice/VoiceClient.cpp index 3673f30..f431ee5 100644 --- a/server/src/client/voice/VoiceClient.cpp +++ b/server/src/client/voice/VoiceClient.cpp @@ -8,7 +8,7 @@ #include #include "VoiceClient.h" -#include "../../TSServer.h" +#include "src/VirtualServer.h" #include "../../server/VoiceServer.h" using namespace std; diff --git a/server/src/client/voice/VoiceClient.h b/server/src/client/voice/VoiceClient.h index a4cb3e1..6d75a28 100644 --- a/server/src/client/voice/VoiceClient.h +++ b/server/src/client/voice/VoiceClient.h @@ -37,10 +37,10 @@ namespace ts { class VoiceClientConnection; } namespace server { - class TSServer; + class VirtualServer; class VoiceClient : public SpeakingClient { - friend class TSServer; + friend class VirtualServer; friend class VoiceServer; friend class POWHandler; friend class ts::connection::VoiceClientConnection; diff --git a/server/src/manager/BanManager.cpp b/server/src/manager/BanManager.cpp index a6689a1..25fb22a 100644 --- a/server/src/manager/BanManager.cpp +++ b/server/src/manager/BanManager.cpp @@ -2,7 +2,7 @@ #include #include #include "BanManager.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "src/client/ConnectedClient.h" using namespace std; diff --git a/server/src/manager/BanManager.h b/server/src/manager/BanManager.h index a1e76cf..cd3a366 100644 --- a/server/src/manager/BanManager.h +++ b/server/src/manager/BanManager.h @@ -24,7 +24,7 @@ DEFINE_VARIABLE_TRANSFORM(ts::server::BanStringType, VARTYPE_INT, std::to_string namespace ts { namespace server { - class TSServer; + class VirtualServer; class ConnectedClient; struct BanRecord { diff --git a/server/src/manager/ComplainManager.cpp b/server/src/manager/ComplainManager.cpp index 1b3292e..0a8311d 100644 --- a/server/src/manager/ComplainManager.cpp +++ b/server/src/manager/ComplainManager.cpp @@ -1,13 +1,13 @@ #include #include #include "ComplainManager.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" using namespace std; using namespace std::chrono; using namespace ts; -ComplainManager::ComplainManager(server::TSServer* server) : server(server) { } +ComplainManager::ComplainManager(server::VirtualServer* server) : server(server) { } ComplainManager::~ComplainManager() { this->entries.clear(); } diff --git a/server/src/manager/ComplainManager.h b/server/src/manager/ComplainManager.h index 07bc01d..9c296f9 100644 --- a/server/src/manager/ComplainManager.h +++ b/server/src/manager/ComplainManager.h @@ -6,7 +6,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } struct ComplainEntry; } @@ -21,7 +21,7 @@ namespace ts { class ComplainManager { public: - ComplainManager(server::TSServer*); + ComplainManager(server::VirtualServer*); ~ComplainManager(); bool loadComplains(); @@ -36,7 +36,7 @@ namespace ts { std::shared_ptr createComplain(ClientDbId target, ClientDbId reporter, std::string msg); private: - server::TSServer* server; + server::VirtualServer* server; threads::Mutex entryLock; std::deque> entries; }; diff --git a/server/src/manager/ConversationManager.cpp b/server/src/manager/ConversationManager.cpp index c02227c..ff93416 100644 --- a/server/src/manager/ConversationManager.cpp +++ b/server/src/manager/ConversationManager.cpp @@ -2,7 +2,7 @@ #include "./ConversationManager.h" #include "../InstanceHandler.h" -#include "../TSServer.h" +#include "src/VirtualServer.h" #include #include @@ -1257,7 +1257,7 @@ size_t Conversation::delete_messages(const std::chrono::system_clock::time_point return max(delete_count, delete_count_volatile); } -ConversationManager::ConversationManager(const std::shared_ptr &server) : _ref_server(server) { } +ConversationManager::ConversationManager(const std::shared_ptr &server) : _ref_server(server) { } ConversationManager::~ConversationManager() { } diff --git a/server/src/manager/ConversationManager.h b/server/src/manager/ConversationManager.h index b212a57..9d8ed75 100644 --- a/server/src/manager/ConversationManager.h +++ b/server/src/manager/ConversationManager.h @@ -11,7 +11,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; namespace conversation { struct ConversationEntry { std::chrono::system_clock::time_point message_timestamp; @@ -222,7 +222,7 @@ namespace ts { class ConversationManager { public: - ConversationManager(const std::shared_ptr& /* server */); + ConversationManager(const std::shared_ptr& /* server */); virtual ~ConversationManager(); void initialize(const std::shared_ptr& _this); @@ -239,12 +239,12 @@ namespace ts { return this->_conversations; } - ts_always_inline std::shared_ptr ref_server() { + ts_always_inline std::shared_ptr ref_server() { return this->_ref_server.lock(); } private: std::weak_ptr _ref_this; - std::weak_ptr _ref_server; + std::weak_ptr _ref_server; std::mutex _conversations_lock; std::deque> _conversations; diff --git a/server/src/manager/LetterManager.cpp b/server/src/manager/LetterManager.cpp index 600be6b..db5767e 100644 --- a/server/src/manager/LetterManager.cpp +++ b/server/src/manager/LetterManager.cpp @@ -1,7 +1,7 @@ #include #include #include "LetterManager.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" using namespace std; using namespace std::chrono; @@ -11,7 +11,7 @@ using namespace ts::server; //`serverId` INT NOT NULL, `sender` TEXT, `receiver` TEXT, `created` INT, `subject` TEXT, `message` TEXT -LetterManager::LetterManager(server::TSServer* server) : server(server) {} +LetterManager::LetterManager(server::VirtualServer* server) : server(server) {} LetterManager::~LetterManager() {} size_t LetterManager::unread_letter_count(const ts::ClientUid &client_unique_id) { diff --git a/server/src/manager/LetterManager.h b/server/src/manager/LetterManager.h index bf8f66c..44875e4 100644 --- a/server/src/manager/LetterManager.h +++ b/server/src/manager/LetterManager.h @@ -6,7 +6,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } @@ -26,7 +26,7 @@ namespace ts { class LetterManager { public: - LetterManager(server::TSServer*); + LetterManager(server::VirtualServer*); ~LetterManager(); @@ -39,7 +39,7 @@ namespace ts { void createLetter(ClientUid sender, ClientUid reciver, std::string subject, std::string message); private: - server::TSServer* server; + server::VirtualServer* server; }; } } \ No newline at end of file diff --git a/server/src/manager/TokeManager.cpp b/server/src/manager/TokeManager.cpp index 05eee16..3fa1a1b 100644 --- a/server/src/manager/TokeManager.cpp +++ b/server/src/manager/TokeManager.cpp @@ -9,7 +9,7 @@ #include #include #include "TokeManager.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" using namespace std; using namespace std::chrono; @@ -17,7 +17,7 @@ using namespace ts; using namespace ts::server; using namespace ts::token; -TokenManager::TokenManager(server::TSServer* handle) : handle(handle) { +TokenManager::TokenManager(server::VirtualServer* handle) : handle(handle) { } diff --git a/server/src/manager/TokeManager.h b/server/src/manager/TokeManager.h index 0073ea6..891ed46 100644 --- a/server/src/manager/TokeManager.h +++ b/server/src/manager/TokeManager.h @@ -8,7 +8,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } namespace token { @@ -29,7 +29,7 @@ namespace ts { class TokenManager { public: - TokenManager(server::TSServer*); + TokenManager(server::VirtualServer*); ~TokenManager(); bool loadTokens(); @@ -39,7 +39,7 @@ namespace ts { bool deleteToke(const std::string&); private: int loadTokenFromDb(int length, char** values, char** columns); - server::TSServer* handle; + server::VirtualServer* handle; std::vector> tokens; }; } diff --git a/server/src/music/MusicBotManager.cpp b/server/src/music/MusicBotManager.cpp index 590d56c..9f0d906 100644 --- a/server/src/music/MusicBotManager.cpp +++ b/server/src/music/MusicBotManager.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -31,7 +31,7 @@ void MusicBotManager::shutdown() { load_music.shutdown(); } -MusicBotManager::MusicBotManager(const shared_ptr& server) : handle(server) { } +MusicBotManager::MusicBotManager(const shared_ptr& server) : handle(server) { } MusicBotManager::~MusicBotManager() { } diff --git a/server/src/music/MusicBotManager.h b/server/src/music/MusicBotManager.h index 1ffb3ed..003e69e 100644 --- a/server/src/music/MusicBotManager.h +++ b/server/src/music/MusicBotManager.h @@ -9,14 +9,14 @@ namespace ts { namespace server { class MusicClient; - class TSServer; + class VirtualServer; } namespace music { class PlayablePlaylist; class MusicBotManager { - friend class server::TSServer; + friend class server::VirtualServer; friend class server::MusicClient; public: static threads::ThreadPool tick_music; @@ -25,7 +25,7 @@ namespace ts { static void adjustTickPool(); - MusicBotManager(const std::shared_ptr&); + MusicBotManager(const std::shared_ptr&); ~MusicBotManager(); void load_bots(); @@ -57,12 +57,12 @@ namespace ts { std::shared_ptr create_playlist(ClientDbId /* owner */, const std::string& /* owner name */); bool delete_playlist(PlaylistId /* id */, std::string& /* error */); - inline std::shared_ptr ref_server() { return this->handle.lock(); } + inline std::shared_ptr ref_server() { return this->handle.lock(); } inline std::shared_ptr ref() { return this->_self.lock(); } private: std::weak_ptr _self; - std::weak_ptr handle; + std::weak_ptr handle; int sqlCreateMusicBot(int, std::string*, std::string*); std::recursive_mutex music_bots_lock; diff --git a/server/src/music/MusicPlaylist.cpp b/server/src/music/MusicPlaylist.cpp index cca9612..24a0001 100644 --- a/server/src/music/MusicPlaylist.cpp +++ b/server/src/music/MusicPlaylist.cpp @@ -1,7 +1,7 @@ #include #include #include "MusicPlaylist.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "src/client/ConnectedClient.h" #include #include "src/client/music/internal_provider/channel_replay/ChannelProvider.h" @@ -23,7 +23,7 @@ void Playlist::set_self_ref(const std::shared_ptr &ref) { this->_self = ref; } -std::shared_ptr Playlist::get_server() { +std::shared_ptr Playlist::get_server() { auto handle = this->ref_handle(); if(!handle) return nullptr; return handle->ref_server(); diff --git a/server/src/music/MusicPlaylist.h b/server/src/music/MusicPlaylist.h index c1a7888..45b2e98 100644 --- a/server/src/music/MusicPlaylist.h +++ b/server/src/music/MusicPlaylist.h @@ -119,7 +119,7 @@ namespace ts { bool _songs_loaded = false; sql::SqlManager* get_sql(); - std::shared_ptr get_server(); + std::shared_ptr get_server(); ServerId get_server_id(); std::shared_mutex playlist_lock; diff --git a/server/src/music/PlayablePlaylist.cpp b/server/src/music/PlayablePlaylist.cpp index c3e8e4d..776a222 100644 --- a/server/src/music/PlayablePlaylist.cpp +++ b/server/src/music/PlayablePlaylist.cpp @@ -1,5 +1,5 @@ #include "PlayablePlaylist.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "src/client/music/MusicClient.h" #include "src/client/ConnectedClient.h" #include diff --git a/server/src/server/POWHandler.h b/server/src/server/POWHandler.h index bac5570..8175b0c 100644 --- a/server/src/server/POWHandler.h +++ b/server/src/server/POWHandler.h @@ -6,7 +6,7 @@ #include #include #include "VoiceServer.h" -#include "src/TSServer.h" +#include "src/VirtualServer.h" namespace ts { namespace server { diff --git a/server/src/server/QueryServer.cpp b/server/src/server/QueryServer.cpp index 2b35d38..94d748b 100644 --- a/server/src/server/QueryServer.cpp +++ b/server/src/server/QueryServer.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/server/src/server/QueryServer.h b/server/src/server/QueryServer.h index 7b5fdf8..c84f426 100644 --- a/server/src/server/QueryServer.h +++ b/server/src/server/QueryServer.h @@ -20,7 +20,7 @@ namespace ts { class Group; namespace server { - class TSServer; + class VirtualServer; class QueryClient; struct QueryLoginCredentials { diff --git a/server/src/server/VoiceIOManager.cpp b/server/src/server/VoiceIOManager.cpp index 7619cfb..d53e63c 100644 --- a/server/src/server/VoiceIOManager.cpp +++ b/server/src/server/VoiceIOManager.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "VoiceIOManager.h" #include "VoiceServer.h" #include "src/client/voice/VoiceClient.h" @@ -17,7 +17,7 @@ VoiceIOManager::VoiceIOManager(){ } VoiceIOManager::~VoiceIOManager() { } -std::shared_ptr VoiceIOManager::enableIo(server::TSServer *server) { +std::shared_ptr VoiceIOManager::enableIo(server::VirtualServer *server) { auto server_io = std::make_shared(server); this->adjustExecutors(this->servers.size() + 1); @@ -43,7 +43,7 @@ std::shared_ptr VoiceIOManager::enableIo(server::TSServer *serv return server_io; } -void VoiceIOManager::disableIo(server::TSServer* server) { +void VoiceIOManager::disableIo(server::VirtualServer* server) { std::shared_ptr server_io; { threads::MutexLock l(this->serverLock); @@ -192,7 +192,7 @@ std::shared_ptr VoiceIOManager::less_used_io_loop(vectorevent_loop_events) { diff --git a/server/src/server/VoiceIOManager.h b/server/src/server/VoiceIOManager.h index c970438..54c793e 100644 --- a/server/src/server/VoiceIOManager.h +++ b/server/src/server/VoiceIOManager.h @@ -9,7 +9,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class VoiceServer; class VoiceClient; } @@ -72,7 +72,7 @@ namespace ts { sa_family_t family; /* keeps these addresses in "hot" memory instead resolving three ptr */ - server::TSServer* server; + server::VirtualServer* server; server::VoiceServer* voice_server; int file_descriptor = 0; /* actual socket */ @@ -187,7 +187,7 @@ namespace ts { friend class VoiceIOManager; friend struct IOEventLoopEvents; public: - explicit IOServerHandler(server::TSServer*); + explicit IOServerHandler(server::VirtualServer*); ~IOServerHandler(); void invoke_write(const std::shared_ptr& /* client */); @@ -196,7 +196,7 @@ namespace ts { private: std::shared_ptr create_event_loop_events(const std::shared_ptr &); - server::TSServer* server = nullptr; + server::VirtualServer* server = nullptr; std::deque> event_loop_events; size_t event_loop_index = 0; }; @@ -206,8 +206,8 @@ namespace ts { VoiceIOManager(); virtual ~VoiceIOManager(); - std::shared_ptr enableIo(server::TSServer* server); - void disableIo(server::TSServer*); + std::shared_ptr enableIo(server::VirtualServer* server); + void disableIo(server::VirtualServer*); void shutdownGlobally(); private: diff --git a/server/src/server/VoiceServer.cpp b/server/src/server/VoiceServer.cpp index 4ad9cb3..83ba0ca 100644 --- a/server/src/server/VoiceServer.cpp +++ b/server/src/server/VoiceServer.cpp @@ -8,7 +8,7 @@ #include "../client/voice/VoiceClient.h" #include "../Configuration.h" #include -#include "../TSServer.h" +#include "src/VirtualServer.h" #include #include "../ServerManager.h" #include "../InstanceHandler.h" @@ -26,7 +26,7 @@ using namespace ts; extern InstanceHandler* serverInstance; -VoiceServer::VoiceServer(const std::shared_ptr& server) { +VoiceServer::VoiceServer(const std::shared_ptr& server) { this->server = server; this->pow_handler = make_unique(this); } diff --git a/server/src/server/VoiceServer.h b/server/src/server/VoiceServer.h index af9018d..2ce418f 100644 --- a/server/src/server/VoiceServer.h +++ b/server/src/server/VoiceServer.h @@ -16,7 +16,7 @@ namespace ts { } namespace server { - class TSServer; + class VirtualServer; class ConnectedClient; class VoiceClient; class POWHandler; @@ -35,7 +35,7 @@ namespace ts { friend struct io::IOEventLoopEvents; friend class POWHandler; public: - explicit VoiceServer(const std::shared_ptr& server); + explicit VoiceServer(const std::shared_ptr& server); ~VoiceServer(); bool start(const std::deque>&, std::string&); @@ -60,10 +60,10 @@ namespace ts { return result; } - inline std::shared_ptr get_server() { return this->server; } + inline std::shared_ptr get_server() { return this->server; } private: std::unique_ptr pow_handler; - std::shared_ptr server = nullptr; + std::shared_ptr server = nullptr; bool running = false; std::deque> bindings; diff --git a/server/src/server/WebServer.cpp b/server/src/server/WebServer.cpp index ce347b4..39c6449 100644 --- a/server/src/server/WebServer.cpp +++ b/server/src/server/WebServer.cpp @@ -15,7 +15,7 @@ using namespace ts::server; #define TCP_NOPUSH TCP_CORK #endif -WebControlServer::WebControlServer(const std::shared_ptr& handle) : handle(handle) {} +WebControlServer::WebControlServer(const std::shared_ptr& handle) : handle(handle) {} WebControlServer::~WebControlServer() = default; bool WebControlServer::start(const std::deque>& bindings, std::string& error) { diff --git a/server/src/server/WebServer.h b/server/src/server/WebServer.h index 6ecb629..ab54d99 100644 --- a/server/src/server/WebServer.h +++ b/server/src/server/WebServer.h @@ -7,7 +7,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class WebClient; class WebControlServer { @@ -21,14 +21,14 @@ namespace ts { inline std::string as_string() { return net::to_string(address, true); } }; - explicit WebControlServer(const std::shared_ptr&); + explicit WebControlServer(const std::shared_ptr&); ~WebControlServer(); bool start(const std::deque>& /* bindings */, std::string& /* error */); inline bool running(){ return _running; } void stop(); - std::shared_ptr getTS(){ return this->handle; } + std::shared_ptr getTS(){ return this->handle; } std::deque> connectedClients(){ threads::MutexLock l(this->clientLock); @@ -36,7 +36,7 @@ namespace ts { } private: - std::shared_ptr handle = nullptr; + std::shared_ptr handle = nullptr; threads::Mutex clientLock; std::deque> clients; diff --git a/server/src/server/file/FileServer.cpp b/server/src/server/file/FileServer.cpp index d288d50..585d051 100644 --- a/server/src/server/file/FileServer.cpp +++ b/server/src/server/file/FileServer.cpp @@ -211,7 +211,7 @@ std::shared_ptr FileServer::generateUploadTransferKey(st return result; } -std::shared_ptr FileServer::resolveDirectory(const shared_ptr &server, std::shared_ptr channel, std::string subPath) { +std::shared_ptr FileServer::resolveDirectory(const shared_ptr &server, std::shared_ptr channel, std::string subPath) { fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/channel_" + to_string(channel->channelId())); if(!findFile(path)) this->createDirectory(path.string(), nullptr); @@ -222,7 +222,7 @@ std::shared_ptr FileServer::resolveDirectory(const shared_ptr(ffile); } -std::shared_ptr FileServer::iconDirectory(const shared_ptr &server) { +std::shared_ptr FileServer::iconDirectory(const shared_ptr &server) { fs::path root = fs::u8path(this->rootPath); fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/icons"); if(!fs::exists(root / path)) { @@ -232,13 +232,13 @@ std::shared_ptr FileServer::iconDirectory(const shared_ptr(findFile(path.string())); } -bool FileServer::iconExists(const shared_ptr &server, IconId icon) { +bool FileServer::iconExists(const shared_ptr &server, IconId icon) { if(icon == 0) return false; if(icon < 1000) return true; return this->findFile("icon_" + to_string(icon), this->iconDirectory(server)) != nullptr; } -std::shared_ptr FileServer::avatarDirectory(const shared_ptr &server) { +std::shared_ptr FileServer::avatarDirectory(const shared_ptr &server) { fs::path path = fs::u8path("server_" + to_string(server ? server->getServerId() : 0) + "/avatars"); if(!findFile(path)) this->createDirectory(path.string(), nullptr); @@ -246,7 +246,7 @@ std::shared_ptr FileServer::avatarDirectory(const shared_ptr &server) { +void FileServer::setupServer(const shared_ptr &server) { auto dir = iconDirectory(server); if(!dir) { logError(LOG_FT,"Failed to find icon directory for server {}", server ? server->getServerId() : 0); @@ -261,11 +261,11 @@ void FileServer::setupServer(const shared_ptr &server) { } } -std::string FileServer::server_file_base(const std::shared_ptr &server) { +std::string FileServer::server_file_base(const std::shared_ptr &server) { return rootPath + "/server_" + to_string(server->getServerId()); } -void FileServer::deleteServer(const shared_ptr &server) { +void FileServer::deleteServer(const shared_ptr &server) { fs::path path = fs::u8path(rootPath + "/server_" + to_string(server ? server->getServerId() : 0)); if(fs::exists(path)) { error_code error; @@ -591,7 +591,7 @@ void FileServer::tickFileClient(std::shared_ptr cl) { } struct TransfareGroup { - shared_ptr server; + shared_ptr server; deque> clients; enum { upload, diff --git a/server/src/server/file/FileServer.h b/server/src/server/file/FileServer.h index f48bf07..6cb9f73 100644 --- a/server/src/server/file/FileServer.h +++ b/server/src/server/file/FileServer.h @@ -72,7 +72,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; class FileClient; //FIXME Valid path @@ -106,14 +106,14 @@ namespace ts { std::shared_ptr generateDownloadTransferKey(std::string &errorMessage, std::string targetFile, size_t offset, const std::shared_ptr&); std::shared_ptr generateUploadTransferKey(std::string &errorMessage, std::string targetFile, size_t size, size_t offset, const std::shared_ptr&); - std::shared_ptr resolveDirectory(const std::shared_ptr &, std::shared_ptr, std::string = ""); - std::shared_ptr iconDirectory(const std::shared_ptr &); - bool iconExists(const std::shared_ptr &, IconId); - std::shared_ptr avatarDirectory(const std::shared_ptr &); + std::shared_ptr resolveDirectory(const std::shared_ptr &, std::shared_ptr, std::string = ""); + std::shared_ptr iconDirectory(const std::shared_ptr &); + bool iconExists(const std::shared_ptr &, IconId); + std::shared_ptr avatarDirectory(const std::shared_ptr &); - std::string server_file_base(const std::shared_ptr &); - void setupServer(const std::shared_ptr &); - void deleteServer(const std::shared_ptr &); + std::string server_file_base(const std::shared_ptr &); + void setupServer(const std::shared_ptr &); + void deleteServer(const std::shared_ptr &); void tickFileClient(std::shared_ptr); void instanceTick(); diff --git a/server/src/terminal/CommandHandler.cpp b/server/src/terminal/CommandHandler.cpp index acb6730..c0fdf9b 100644 --- a/server/src/terminal/CommandHandler.cpp +++ b/server/src/terminal/CommandHandler.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include diff --git a/server/src/weblist/TeamSpeakWebClient.cpp b/server/src/weblist/TeamSpeakWebClient.cpp index c792cbc..e5f0de4 100644 --- a/server/src/weblist/TeamSpeakWebClient.cpp +++ b/server/src/weblist/TeamSpeakWebClient.cpp @@ -1,4 +1,4 @@ -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "TeamSpeakWebClient.h" #include "log/LogUtils.h" #include "src/server/VoiceServer.h" @@ -7,7 +7,7 @@ using namespace ts; using namespace ts::weblist; using namespace ts::server; -TSWebClient::TSWebClient(const std::shared_ptr &server, struct event_base *event_base, uint16_t session_index, bool resend_name) : server(server), event_base(event_base), session_index(session_index), send_name(resend_name) { } +TSWebClient::TSWebClient(const std::shared_ptr &server, struct event_base *event_base, uint16_t session_index, bool resend_name) : server(server), event_base(event_base), session_index(session_index), send_name(resend_name) { } TSWebClient::~TSWebClient() { this->unregister_events(true); diff --git a/server/src/weblist/TeamSpeakWebClient.h b/server/src/weblist/TeamSpeakWebClient.h index a5d8319..30728f1 100644 --- a/server/src/weblist/TeamSpeakWebClient.h +++ b/server/src/weblist/TeamSpeakWebClient.h @@ -7,7 +7,7 @@ namespace ts { namespace server { - class TSServer; + class VirtualServer; } namespace weblist { @@ -21,7 +21,7 @@ namespace ts { S_FINALIZED }; - TSWebClient(const std::shared_ptr &server, struct event_base *event_base, uint16_t session_index, bool /* resend name */); + TSWebClient(const std::shared_ptr &server, struct event_base *event_base, uint16_t session_index, bool /* resend name */); virtual ~TSWebClient(); void report(); @@ -32,7 +32,7 @@ namespace ts { std::function callback_error; std::function callback_success; private: - std::shared_ptr server; + std::shared_ptr server; struct event_base* event_base = nullptr; std::thread close_thread; State state; diff --git a/server/src/weblist/WebListManager.cpp b/server/src/weblist/WebListManager.cpp index 0ddec06..b9c3477 100644 --- a/server/src/weblist/WebListManager.cpp +++ b/server/src/weblist/WebListManager.cpp @@ -1,6 +1,6 @@ #include #include -#include "src/TSServer.h" +#include "src/VirtualServer.h" #include "log/LogUtils.h" #include "TeamSpeakWebClient.h" #include "WebListManager.h" @@ -33,7 +33,7 @@ WebListManager::~WebListManager() { event_base_free(base); } -void WebListManager::enable_report(const std::shared_ptr &server) { +void WebListManager::enable_report(const std::shared_ptr &server) { { unique_lock lock(this->entry_lock); for(const auto& entry : this->entries) { @@ -49,7 +49,7 @@ void WebListManager::enable_report(const std::shared_ptr & } } -bool WebListManager::reports_enabled(const std::shared_ptr &server) { +bool WebListManager::reports_enabled(const std::shared_ptr &server) { { lock_guard lock(this->entry_lock); for(const auto& entry : this->entries) { @@ -59,7 +59,7 @@ bool WebListManager::reports_enabled(const std::shared_ptr return false; } -void WebListManager::disable_report(const std::shared_ptr &server) { +void WebListManager::disable_report(const std::shared_ptr &server) { if(!server) return; unique_lock lock(this->entry_lock); diff --git a/server/src/weblist/WebListManager.h b/server/src/weblist/WebListManager.h index c2f84b2..30d3243 100644 --- a/server/src/weblist/WebListManager.h +++ b/server/src/weblist/WebListManager.h @@ -9,14 +9,14 @@ struct event_base; namespace ts { namespace server { - class TSServer; + class VirtualServer; } namespace weblist { class TSWebClient; class WebListManager { private: struct Entry { - std::shared_ptr server; + std::shared_ptr server; std::shared_ptr current_request; std::chrono::system_clock::time_point last_success; @@ -30,9 +30,9 @@ namespace ts { WebListManager(); ~WebListManager(); - void enable_report(const std::shared_ptr& /* server */); - bool reports_enabled(const std::shared_ptr& /* server */); - void disable_report(const std::shared_ptr& /* server */); + void enable_report(const std::shared_ptr& /* server */); + bool reports_enabled(const std::shared_ptr& /* server */); + void disable_report(const std::shared_ptr& /* server */); void tick();