Using property wrapper for all property accesses
This commit is contained in:
parent
1bdb178a3f
commit
db71461646
@ -42,9 +42,8 @@ namespace ts {
|
|||||||
bool startInstance();
|
bool startInstance();
|
||||||
void stopInstance();
|
void stopInstance();
|
||||||
|
|
||||||
ts::PropertyManager& properties(){
|
inline PropertyWrapper properties() { return PropertyWrapper{this->_properties}; }
|
||||||
return *_properties;
|
inline const PropertyWrapper properties() const { return PropertyWrapper{this->_properties}; }
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<ts::server::InternalClient> getInitialServerAdmin(){ return globalServerAdmin; }
|
std::shared_ptr<ts::server::InternalClient> getInitialServerAdmin(){ return globalServerAdmin; }
|
||||||
std::shared_ptr<ts::GroupManager> getGroupManager(){ return groupManager; }
|
std::shared_ptr<ts::GroupManager> getGroupManager(){ return groupManager; }
|
||||||
@ -75,16 +74,16 @@ namespace ts {
|
|||||||
|
|
||||||
[[nodiscard]] inline const auto& general_task_executor(){ return this->general_task_executor_; }
|
[[nodiscard]] inline const auto& general_task_executor(){ return this->general_task_executor_; }
|
||||||
|
|
||||||
std::shared_ptr<stats::ConnectionStatistics> getStatistics(){ return statistics; }
|
[[nodiscard]] inline std::shared_ptr<stats::ConnectionStatistics> getStatistics(){ return statistics; }
|
||||||
std::shared_ptr<license::InstanceLicenseInfo> generateLicenseData();
|
[[nodiscard]] std::shared_ptr<license::InstanceLicenseInfo> generateLicenseData();
|
||||||
|
|
||||||
std::shared_ptr<TeamSpeakLicense> getTeamSpeakLicense() { return this->teamspeak_license; }
|
[[nodiscard]] inline std::shared_ptr<TeamSpeakLicense> getTeamSpeakLicense() { return this->teamspeak_license; }
|
||||||
std::shared_ptr<ts::PropertyManager> getDefaultServerProperties() { return this->default_server_properties; }
|
[[nodiscard]] inline PropertyWrapper getDefaultServerProperties() { return PropertyWrapper{this->default_server_properties}; }
|
||||||
std::shared_ptr<webio::LoopManager> getWebIoLoop() { return this->web_event_loop; }
|
[[nodiscard]] inline std::shared_ptr<webio::LoopManager> getWebIoLoop() { return this->web_event_loop; }
|
||||||
std::shared_ptr<weblist::WebListManager> getWebList() { return this->web_list; }
|
[[nodiscard]] inline std::shared_ptr<weblist::WebListManager> getWebList() { return this->web_list; }
|
||||||
|
|
||||||
std::shared_ptr<permission::PermissionNameMapper> getPermissionMapper() { return this->permission_mapper; }
|
[[nodiscard]] inline std::shared_ptr<permission::PermissionNameMapper> getPermissionMapper() { return this->permission_mapper; }
|
||||||
std::shared_ptr<ts::event::EventExecutor> getConversationIo() { return this->conversation_io; }
|
[[nodiscard]] inline std::shared_ptr<ts::event::EventExecutor> getConversationIo() { return this->conversation_io; }
|
||||||
|
|
||||||
[[nodiscard]] inline const auto& server_command_executor() { return this->server_command_executor_; }
|
[[nodiscard]] inline const auto& server_command_executor() { return this->server_command_executor_; }
|
||||||
|
|
||||||
|
@ -782,7 +782,7 @@ bool VirtualServerManager::createServerSnapshot(Command &cmd, shared_ptr<Virtual
|
|||||||
//Server
|
//Server
|
||||||
{
|
{
|
||||||
cmd[index]["begin_virtualserver"] = "";
|
cmd[index]["begin_virtualserver"] = "";
|
||||||
for(const auto& serverProperty : server->properties().list_properties(property::FLAG_SNAPSHOT)) {
|
for(const auto& serverProperty : server->properties()->list_properties(property::FLAG_SNAPSHOT)) {
|
||||||
if(version == 0) {
|
if(version == 0) {
|
||||||
switch (serverProperty.type().property_index) {
|
switch (serverProperty.type().property_index) {
|
||||||
case property::VIRTUALSERVER_DOWNLOAD_QUOTA:
|
case property::VIRTUALSERVER_DOWNLOAD_QUOTA:
|
||||||
@ -803,7 +803,7 @@ bool VirtualServerManager::createServerSnapshot(Command &cmd, shared_ptr<Virtual
|
|||||||
{
|
{
|
||||||
cmd[index]["begin_channels"] = "";
|
cmd[index]["begin_channels"] = "";
|
||||||
for(const auto& channel : server->getChannelTree()->channels()) {
|
for(const auto& channel : server->getChannelTree()->channels()) {
|
||||||
for(const auto& channelProperty : channel->properties().list_properties(property::FLAG_SNAPSHOT)) {
|
for(const auto& channelProperty : channel->properties()->list_properties(property::FLAG_SNAPSHOT)) {
|
||||||
if(channelProperty.type() == property::CHANNEL_ID) {
|
if(channelProperty.type() == property::CHANNEL_ID) {
|
||||||
cmd[index]["channel_id"] = channelProperty.value();
|
cmd[index]["channel_id"] = channelProperty.value();
|
||||||
} else if(channelProperty.type() == property::CHANNEL_PID) {
|
} else if(channelProperty.type() == property::CHANNEL_PID) {
|
||||||
|
@ -183,10 +183,7 @@ void VirtualServer::executeServerTick() {
|
|||||||
if(server_channel->client_count() > 0 || !this->getClientsByChannelRoot(channel, true).empty())
|
if(server_channel->client_count() > 0 || !this->getClientsByChannelRoot(channel, true).empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
seconds deleteTimeout(0);
|
seconds deleteTimeout{channel->properties()[property::CHANNEL_DELETE_DELAY].as_or<uint64_t>(0)};
|
||||||
if(channel->properties().hasProperty(property::CHANNEL_DELETE_DELAY))
|
|
||||||
deleteTimeout = seconds(
|
|
||||||
channel->properties()[property::CHANNEL_DELETE_DELAY].as_or<uint64_t>(0));
|
|
||||||
|
|
||||||
auto last_left = time_point<system_clock>() + milliseconds(
|
auto last_left = time_point<system_clock>() + milliseconds(
|
||||||
channel->properties()[property::CHANNEL_LAST_LEFT].as_or<int64_t>(0));
|
channel->properties()[property::CHANNEL_LAST_LEFT].as_or<int64_t>(0));
|
||||||
|
@ -252,7 +252,7 @@ bool VirtualServer::initialize(bool test_properties) {
|
|||||||
this->properties()[property::VIRTUALSERVER_NAME].value(), false);
|
this->properties()[property::VIRTUALSERVER_NAME].value(), false);
|
||||||
this->serverRoot->initialize_weak_reference(this->serverRoot);
|
this->serverRoot->initialize_weak_reference(this->serverRoot);
|
||||||
|
|
||||||
this->properties().registerNotifyHandler([&](Property& property) {
|
this->properties()->registerNotifyHandler([&](Property& property) {
|
||||||
if(property.type() == property::VIRTUALSERVER_NAME) {
|
if(property.type() == property::VIRTUALSERVER_NAME) {
|
||||||
static_pointer_cast<InternalClient>(this->serverRoot)->properties()[property::CLIENT_NICKNAME] = property.value();
|
static_pointer_cast<InternalClient>(this->serverRoot)->properties()[property::CLIENT_NICKNAME] = property.value();
|
||||||
}
|
}
|
||||||
@ -655,6 +655,7 @@ OnlineClientReport VirtualServer::onlineStats() {
|
|||||||
|
|
||||||
switch (cl->getType()) {
|
switch (cl->getType()) {
|
||||||
case CLIENT_TEAMSPEAK:
|
case CLIENT_TEAMSPEAK:
|
||||||
|
case CLIENT_TEASPEAK:
|
||||||
response.clients_ts++;
|
response.clients_ts++;
|
||||||
break;
|
break;
|
||||||
case CLIENT_WEB:
|
case CLIENT_WEB:
|
||||||
@ -666,6 +667,8 @@ OnlineClientReport VirtualServer::onlineStats() {
|
|||||||
case CLIENT_MUSIC:
|
case CLIENT_MUSIC:
|
||||||
response.bots++;
|
response.bots++;
|
||||||
break;
|
break;
|
||||||
|
case CLIENT_INTERNAL:
|
||||||
|
case MAX:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,8 @@ namespace ts {
|
|||||||
ecc_key* serverKey(){ return _serverKey; }
|
ecc_key* serverKey(){ return _serverKey; }
|
||||||
std::string publicServerKey();
|
std::string publicServerKey();
|
||||||
|
|
||||||
PropertyManager& properties(){ return *this->_properties; }
|
inline PropertyWrapper properties() { return PropertyWrapper{this->_properties}; }
|
||||||
|
inline const PropertyWrapper properties() const { return PropertyWrapper{this->_properties}; }
|
||||||
|
|
||||||
inline sql::SqlManager * getSql(){ return this->sql; }
|
inline sql::SqlManager * getSql(){ return this->sql; }
|
||||||
sql::AsyncSqlPool* getSqlPool(){ return this->sql->pool; }
|
sql::AsyncSqlPool* getSqlPool(){ return this->sql->pool; }
|
||||||
|
@ -230,12 +230,18 @@ uint16_t VirtualServerManager::next_available_port(const std::string& host_strin
|
|||||||
switch (net::address_available(baddress, net::binding_type::TCP)) {
|
switch (net::address_available(baddress, net::binding_type::TCP)) {
|
||||||
case net::binding_result::ADDRESS_USED:
|
case net::binding_result::ADDRESS_USED:
|
||||||
goto next_port;
|
goto next_port;
|
||||||
|
|
||||||
|
case net::binding_result::ADDRESS_FREE:
|
||||||
|
case net::binding_result::INTERNAL_ERROR:
|
||||||
default:
|
default:
|
||||||
break; /* if we've an internal error we ignore it */
|
break; /* if we've an internal error we ignore it */
|
||||||
}
|
}
|
||||||
switch (net::address_available(baddress, net::binding_type::UDP)) {
|
switch (net::address_available(baddress, net::binding_type::UDP)) {
|
||||||
case net::binding_result::ADDRESS_USED:
|
case net::binding_result::ADDRESS_USED:
|
||||||
goto next_port;
|
goto next_port;
|
||||||
|
|
||||||
|
case net::binding_result::ADDRESS_FREE:
|
||||||
|
case net::binding_result::INTERNAL_ERROR:
|
||||||
default:
|
default:
|
||||||
break; /* if we've an internal error we ignore it */
|
break; /* if we've an internal error we ignore it */
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ std::shared_ptr<BasicChannel> ServerChannelTree::createChannel(ChannelId parentI
|
|||||||
|
|
||||||
/* TODO: Speed up (skip the database query) */
|
/* TODO: Speed up (skip the database query) */
|
||||||
auto properties = serverInstance->databaseHelper()->loadChannelProperties(this->server_ref.lock(), channel->channelId());
|
auto properties = serverInstance->databaseHelper()->loadChannelProperties(this->server_ref.lock(), channel->channelId());
|
||||||
for(const auto& prop : channel->properties().list_properties()) {
|
for(const auto& prop : channel->properties()->list_properties()) {
|
||||||
if(prop.isModified()) { //Copy the already set properties
|
if(prop.isModified()) { //Copy the already set properties
|
||||||
(*properties)[prop.type()] = prop.value();
|
(*properties)[prop.type()] = prop.value();
|
||||||
}
|
}
|
||||||
@ -135,8 +135,7 @@ bool ServerChannelTree::initializeTempParents() {
|
|||||||
auto channel = dynamic_pointer_cast<BasicChannel>(linked_channel->entry);
|
auto channel = dynamic_pointer_cast<BasicChannel>(linked_channel->entry);
|
||||||
assert(channel);
|
assert(channel);
|
||||||
|
|
||||||
if(channel->properties().hasProperty(property::CHANNEL_PID) &&
|
if(channel->properties()[property::CHANNEL_PID].as_or<ChannelId>(0) != 0){
|
||||||
channel->properties()[property::CHANNEL_PID].as_or<ChannelId>(0) != 0){
|
|
||||||
if(!channel->parent())
|
if(!channel->parent())
|
||||||
linked_channel->parent = findLinkedChannelByPool(this->tmpChannelList, channel->properties()[property::CHANNEL_PID]);
|
linked_channel->parent = findLinkedChannelByPool(this->tmpChannelList, channel->properties()[property::CHANNEL_PID]);
|
||||||
if(!channel->parent()){
|
if(!channel->parent()){
|
||||||
|
@ -677,7 +677,7 @@ inline void send_channels(ConnectedClient* client, ChannelIT begin, const Channe
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &elm : channel->properties().list_properties(property::FLAG_CHANNEL_VIEW, client->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
for (const auto &elm : channel->properties()->list_properties(property::FLAG_CHANNEL_VIEW, client->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
if(elm.type() == property::CHANNEL_ORDER)
|
if(elm.type() == property::CHANNEL_ORDER)
|
||||||
builder.put_unchecked(index, elm.type().name, override_orderid ? 0 : (*begin)->previous_channel);
|
builder.put_unchecked(index, elm.type().name, override_orderid ? 0 : (*begin)->previous_channel);
|
||||||
else
|
else
|
||||||
@ -799,7 +799,7 @@ void ConnectedClient::tick_server(const std::chrono::system_clock::time_point &t
|
|||||||
void ConnectedClient::sendServerInit() {
|
void ConnectedClient::sendServerInit() {
|
||||||
Command command("initserver");
|
Command command("initserver");
|
||||||
|
|
||||||
for(const auto& prop : this->server->properties().list_properties(property::FLAG_SERVER_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
for(const auto& prop : this->server->properties()->list_properties(property::FLAG_SERVER_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
command[std::string{prop.type().name}] = prop.value();
|
command[std::string{prop.type().name}] = prop.value();
|
||||||
}
|
}
|
||||||
command["virtualserver_maxclients"] = 32;
|
command["virtualserver_maxclients"] = 32;
|
||||||
|
@ -471,7 +471,7 @@ bool ConnectedClient::notifyChannelMoved(const std::shared_ptr<BasicChannel> &ch
|
|||||||
|
|
||||||
bool ConnectedClient::notifyChannelCreate(const std::shared_ptr<BasicChannel> &channel, ChannelId orderId, const std::shared_ptr<ConnectedClient> &invoker) {
|
bool ConnectedClient::notifyChannelCreate(const std::shared_ptr<BasicChannel> &channel, ChannelId orderId, const std::shared_ptr<ConnectedClient> &invoker) {
|
||||||
Command notify("notifychannelcreated");
|
Command notify("notifychannelcreated");
|
||||||
for (auto &prop : channel->properties().list_properties(property::FLAG_CHANNEL_VARIABLE | property::FLAG_CHANNEL_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
for (auto &prop : channel->properties()->list_properties(property::FLAG_CHANNEL_VARIABLE | property::FLAG_CHANNEL_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
if(prop.type() == property::CHANNEL_ORDER)
|
if(prop.type() == property::CHANNEL_ORDER)
|
||||||
notify[prop.type().name] = orderId;
|
notify[prop.type().name] = orderId;
|
||||||
else if(prop.type() == property::CHANNEL_DESCRIPTION)
|
else if(prop.type() == property::CHANNEL_DESCRIPTION)
|
||||||
@ -536,7 +536,7 @@ bool ConnectedClient::notifyChannelShow(const std::shared_ptr<ts::BasicChannel>
|
|||||||
result = this->notifyChannelCreate(channel, orderId, this->server->serverRoot);
|
result = this->notifyChannelCreate(channel, orderId, this->server->serverRoot);
|
||||||
} else {
|
} else {
|
||||||
Command notify("notifychannelshow");
|
Command notify("notifychannelshow");
|
||||||
for (auto &prop : channel->properties().list_properties(property::FLAG_CHANNEL_VARIABLE | property::FLAG_CHANNEL_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
for (auto &prop : channel->properties()->list_properties(property::FLAG_CHANNEL_VARIABLE | property::FLAG_CHANNEL_VIEW, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
if(prop.type() == property::CHANNEL_ORDER) {
|
if(prop.type() == property::CHANNEL_ORDER) {
|
||||||
notify[prop.type().name] = orderId;
|
notify[prop.type().name] = orderId;
|
||||||
} else if(prop.type() == property::CHANNEL_DESCRIPTION) {
|
} else if(prop.type() == property::CHANNEL_DESCRIPTION) {
|
||||||
@ -730,7 +730,7 @@ bool ConnectedClient::notifyChannelDeleted(const deque<ChannelId>& channel_ids,
|
|||||||
bool ConnectedClient::notifyServerUpdated(std::shared_ptr<ConnectedClient> invoker) {
|
bool ConnectedClient::notifyServerUpdated(std::shared_ptr<ConnectedClient> invoker) {
|
||||||
Command response("notifyserverupdated");
|
Command response("notifyserverupdated");
|
||||||
|
|
||||||
for (const auto& elm : this->server->properties().list_properties(property::FLAG_SERVER_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
for (const auto& elm : this->server->properties()->list_properties(property::FLAG_SERVER_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
if(elm.type() == property::VIRTUALSERVER_MIN_WINPHONE_VERSION)
|
if(elm.type() == property::VIRTUALSERVER_MIN_WINPHONE_VERSION)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -24,45 +24,11 @@ namespace ts {
|
|||||||
friend class QueryServer;
|
friend class QueryServer;
|
||||||
friend class music::MusicBotManager;
|
friend class music::MusicBotManager;
|
||||||
public:
|
public:
|
||||||
struct PropertyWrapper {
|
|
||||||
std::shared_ptr<PropertyManager> handle;
|
|
||||||
|
|
||||||
PropertyManager* operator->() {
|
|
||||||
return handle.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
const PropertyManager* operator->() const {
|
|
||||||
return handle.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class F>
|
|
||||||
std::result_of_t<F(PropertyManager &)> operator->*(F &&f) {
|
|
||||||
return std::forward<F>(f)(*handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class F>
|
|
||||||
std::result_of_t<F(PropertyManager const &)> operator->*(F &&f) const {
|
|
||||||
return std::forward<F>(f)(*handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
template <typename T>
|
|
||||||
ts::PropertyWrapper operator[](T type) {
|
|
||||||
return (*handle)[type];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
ts::Property operator[](const T& type) {
|
|
||||||
return (*handle)[type];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
DataClient(sql::SqlManager*, const std::shared_ptr<VirtualServer>&);
|
DataClient(sql::SqlManager*, const std::shared_ptr<VirtualServer>&);
|
||||||
virtual ~DataClient();
|
virtual ~DataClient();
|
||||||
|
|
||||||
|
inline PropertyWrapper properties() { return PropertyWrapper{this->_properties}; }
|
||||||
PropertyWrapper properties(){ return { this->_properties }; }
|
inline const PropertyWrapper properties() const { return PropertyWrapper{this->_properties}; }
|
||||||
|
|
||||||
/* main permission calculate function */
|
/* main permission calculate function */
|
||||||
/**
|
/**
|
||||||
|
@ -32,9 +32,10 @@ using namespace std;
|
|||||||
using namespace ts;
|
using namespace ts;
|
||||||
using namespace ts::server;
|
using namespace ts::server;
|
||||||
|
|
||||||
//{findError("parameter_invalid"), "could not resolve permission " + (cmd[index].has("permid") ? cmd[index]["permid"].as<string>() : cmd[index]["permsid"].as<string>())}; \
|
/*
|
||||||
//TODO: Log missing permissions?
|
TODO: Log missing permissions?
|
||||||
|
{findError("parameter_invalid"), "could not resolve permission " + (cmd[index].has("permid") ? cmd[index]["permid"].as<string>() : cmd[index]["permsid"].as<string>())};
|
||||||
|
*/
|
||||||
command_result ConnectedClient::handleCommandChannelGetDescription(Command &cmd) {
|
command_result ConnectedClient::handleCommandChannelGetDescription(Command &cmd) {
|
||||||
CMD_CHK_AND_INC_FLOOD_POINTS(0);
|
CMD_CHK_AND_INC_FLOOD_POINTS(0);
|
||||||
RESOLVE_CHANNEL_R(cmd["cid"], true);
|
RESOLVE_CHANNEL_R(cmd["cid"], true);
|
||||||
@ -1182,7 +1183,6 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
bool updating_max_family_clients{false};
|
bool updating_max_family_clients{false};
|
||||||
bool updating_talk_power{false};
|
bool updating_talk_power{false};
|
||||||
bool updating_type{false};
|
bool updating_type{false};
|
||||||
bool updating_conversation{false};
|
|
||||||
bool updating_sort_order{false};
|
bool updating_sort_order{false};
|
||||||
|
|
||||||
/* Step 1: Parse all values which are possible and validate them without any context. */
|
/* Step 1: Parse all values which are possible and validate them without any context. */
|
||||||
@ -1411,7 +1411,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Step 2: Remove all not changed properties and test the updates */
|
/* Step 2: Remove all not changed properties and test the updates */
|
||||||
auto& channel_properties = channel->properties();
|
auto channel_properties = channel->properties();
|
||||||
std::map<property::ChannelProperties, std::string> changed_values{};
|
std::map<property::ChannelProperties, std::string> changed_values{};
|
||||||
|
|
||||||
for(auto& [ key, value ] : values) {
|
for(auto& [ key, value ] : values) {
|
||||||
@ -1478,7 +1478,6 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
|
|
||||||
case property::CHANNEL_CONVERSATION_HISTORY_LENGTH:
|
case property::CHANNEL_CONVERSATION_HISTORY_LENGTH:
|
||||||
case property::CHANNEL_CONVERSATION_MODE:
|
case property::CHANNEL_CONVERSATION_MODE:
|
||||||
updating_conversation = true;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* non updatable properties */
|
/* non updatable properties */
|
||||||
@ -1553,7 +1552,7 @@ ts::command_result ConnectedClient::execute_channel_edit(ChannelId& channel_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ChannelType::ChannelType target_channel_type;
|
ChannelType::ChannelType target_channel_type;
|
||||||
{
|
if(updating_type) {
|
||||||
auto flag_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_PERMANENT));
|
auto flag_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_PERMANENT));
|
||||||
auto flag_semi_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_SEMI_PERMANENT));
|
auto flag_semi_permanent = converter<bool>::from_string_view(target_channel_property_value(property::CHANNEL_FLAG_SEMI_PERMANENT));
|
||||||
|
|
||||||
@ -2477,7 +2476,7 @@ command_result ConnectedClient::handleCommandChannelInfo(Command &cmd) {
|
|||||||
|
|
||||||
Command res("");
|
Command res("");
|
||||||
|
|
||||||
for (const auto &prop : channel->properties().list_properties(property::FLAG_CHANNEL_VIEW | property::FLAG_CHANNEL_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0))
|
for (const auto &prop : channel->properties()->list_properties(property::FLAG_CHANNEL_VIEW | property::FLAG_CHANNEL_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0))
|
||||||
res[prop.type().name] = prop.value();
|
res[prop.type().name] = prop.value();
|
||||||
|
|
||||||
res["seconds_empty"] = channel->emptySince();
|
res["seconds_empty"] = channel->emptySince();
|
||||||
|
@ -212,7 +212,7 @@ command_result ConnectedClient::handleCommandServerEdit(Command &cmd) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto property = target_server ? target_server->properties()[info] : (*serverInstance->getDefaultServerProperties())[info];
|
auto property = target_server ? target_server->properties()[info] : serverInstance->getDefaultServerProperties()[info];
|
||||||
if(property.value() == elm.second)
|
if(property.value() == elm.second)
|
||||||
continue;
|
continue;
|
||||||
auto old_value = property.value();
|
auto old_value = property.value();
|
||||||
|
@ -459,7 +459,8 @@ command_result QueryClient::handleCommandServerInfo(Command &) {
|
|||||||
|
|
||||||
Command cmd("");
|
Command cmd("");
|
||||||
|
|
||||||
for(const auto &prop : (this->server ? this->server->properties() : *serverInstance->getDefaultServerProperties()).list_properties(property::FLAG_SERVER_VIEW | property::FLAG_SERVER_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
auto properties = this->server ? this->server->properties() : serverInstance->getDefaultServerProperties();
|
||||||
|
for(const auto &prop : properties->list_properties(property::FLAG_SERVER_VIEW | property::FLAG_SERVER_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0)) {
|
||||||
cmd[prop.type().name] = prop.as_unchecked<string>();
|
cmd[prop.type().name] = prop.as_unchecked<string>();
|
||||||
if(prop.type() == property::VIRTUALSERVER_HOST)
|
if(prop.type() == property::VIRTUALSERVER_HOST)
|
||||||
cmd["virtualserver_ip"] = prop.as_unchecked<string>();
|
cmd["virtualserver_ip"] = prop.as_unchecked<string>();
|
||||||
@ -813,8 +814,8 @@ command_result QueryClient::handleCommandInstanceInfo(Command& cmd) {
|
|||||||
ACTION_REQUIRES_INSTANCE_PERMISSION(permission::b_serverinstance_info_view, 1);
|
ACTION_REQUIRES_INSTANCE_PERMISSION(permission::b_serverinstance_info_view, 1);
|
||||||
|
|
||||||
Command res("");
|
Command res("");
|
||||||
for(const auto& e : serverInstance->properties().list_properties(property::FLAG_INSTANCE_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0))
|
for(const auto& e : serverInstance->properties()->list_properties(property::FLAG_INSTANCE_VARIABLE, this->getType() == CLIENT_TEAMSPEAK ? property::FLAG_NEW : (uint16_t) 0))
|
||||||
res[e.type().name] = e.as_unchecked<string>();
|
res[e.type().name] = e.value();
|
||||||
if(!this->properties()[property::CLIENT_LOGIN_NAME].value().empty())
|
if(!this->properties()[property::CLIENT_LOGIN_NAME].value().empty())
|
||||||
res["serverinstance_teaspeak"] = true;
|
res["serverinstance_teaspeak"] = true;
|
||||||
res["serverinstance_serverquery_max_connections_per_ip"] = res["serverinstance_query_max_connections_per_ip"].as<std::string>();
|
res["serverinstance_serverquery_max_connections_per_ip"] = res["serverinstance_query_max_connections_per_ip"].as<std::string>();
|
||||||
|
2
shared
2
shared
@ -1 +1 @@
|
|||||||
Subproject commit 465975e9cadf9a6b6e768dc6551c947a0ff32b3c
|
Subproject commit 206e0052d1dbe64072e1ce145c380b12114d78d5
|
Loading…
x
Reference in New Issue
Block a user