Improved some stuff
This commit is contained in:
parent
c7b6c0a3ba
commit
a69100f689
@ -167,7 +167,7 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
|
|||||||
notifyList.emplace_back(property::CLIENT_IS_PRIORITY_SPEAKER);
|
notifyList.emplace_back(property::CLIENT_IS_PRIORITY_SPEAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
block_flood = !!permission_ignore_antiflood.has_value || permission_ignore_antiflood.value <= 0;
|
block_flood = !permission::v2::permission_granted(1, permission_ignore_antiflood);
|
||||||
if(server_ref)
|
if(server_ref)
|
||||||
server_ref->notifyClientPropertyUpdates(_this.lock(), notifyList, notify_self);
|
server_ref->notifyClientPropertyUpdates(_this.lock(), notifyList, notify_self);
|
||||||
this->updateTalkRights(permission_talk_power.has_value ? permission_talk_power.value : 0);
|
this->updateTalkRights(permission_talk_power.has_value ? permission_talk_power.value : 0);
|
||||||
|
@ -483,60 +483,57 @@ command_result QueryClient::handleCommandChannelList(Command& cmd) {
|
|||||||
CMD_RESET_IDLE;
|
CMD_RESET_IDLE;
|
||||||
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_virtualserver_channel_list, 1);
|
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_virtualserver_channel_list, 1);
|
||||||
|
|
||||||
Command result("");
|
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
shared_lock channel_lock(this->server ? this->server->channel_tree_lock : serverInstance->getChannelTreeLock());
|
shared_lock channel_lock(this->server ? this->server->channel_tree_lock : serverInstance->getChannelTreeLock());
|
||||||
auto entries = this->server ? this->channels->channels() : serverInstance->getChannelTree()->channels();
|
auto entries = this->server ? this->channels->channels() : serverInstance->getChannelTree()->channels();
|
||||||
channel_lock.unlock();
|
channel_lock.unlock();
|
||||||
|
|
||||||
|
command_builder result{"", 1024, entries.size()};
|
||||||
for(const auto& channel : entries){
|
for(const auto& channel : entries){
|
||||||
if(!channel) continue;
|
if(!channel) continue;
|
||||||
|
result.put_unchecked(index, "cid", channel->channelId());
|
||||||
auto& bulk = result[index];
|
result.put_unchecked(index, "pid", channel->properties()[property::CHANNEL_PID].as<string>());
|
||||||
bulk["cid"] = channel->channelId();
|
result.put_unchecked(index, "channel_name", channel->name());
|
||||||
bulk["pid"] = channel->properties()[property::CHANNEL_PID].as<string>();
|
result.put_unchecked(index, "channel_order", channel->channelOrder());
|
||||||
bulk["channel_name"] = channel->name();
|
result.put_unchecked(index, "total_clients", this->server ? this->server->getClientsByChannel(channel).size() : 0);
|
||||||
bulk["channel_order"] = channel->channelOrder();
|
/* result.put_unchecked(index, "channel_needed_subscribe_power", channel->permissions()->getPermissionValue(permission::i_channel_needed_subscribe_power, channel, 0)); */
|
||||||
bulk["total_clients"] = this->server ? this->server->getClientsByChannel(channel).size() : 0;
|
|
||||||
/* bulk["channel_needed_subscribe_power"] = channel->permissions()->getPermissionValue(permission::i_channel_needed_subscribe_power, channel, 0); */
|
|
||||||
|
|
||||||
if(cmd.hasParm("flags")){
|
if(cmd.hasParm("flags")){
|
||||||
bulk["channel_flag_default"] = channel->properties()[property::CHANNEL_FLAG_DEFAULT].as<string>();
|
result.put_unchecked(index, "channel_flag_default", channel->properties()[property::CHANNEL_FLAG_DEFAULT].as<string>());
|
||||||
bulk["channel_flag_password"] = channel->properties()[property::CHANNEL_FLAG_PASSWORD].as<string>();
|
result.put_unchecked(index, "channel_flag_password", channel->properties()[property::CHANNEL_FLAG_PASSWORD].as<string>());
|
||||||
bulk["channel_flag_permanent"] = channel->properties()[property::CHANNEL_FLAG_PERMANENT].as<string>();
|
result.put_unchecked(index, "channel_flag_permanent", channel->properties()[property::CHANNEL_FLAG_PERMANENT].as<string>());
|
||||||
bulk["channel_flag_semi_permanent"] = channel->properties()[property::CHANNEL_FLAG_SEMI_PERMANENT].as<string>();
|
result.put_unchecked(index, "channel_flag_semi_permanent", channel->properties()[property::CHANNEL_FLAG_SEMI_PERMANENT].as<string>());
|
||||||
}
|
}
|
||||||
if(cmd.hasParm("voice")){
|
if(cmd.hasParm("voice")){
|
||||||
bulk["channel_codec"] = channel->properties()[property::CHANNEL_CODEC].as<string>();
|
result.put_unchecked(index, "channel_codec", channel->properties()[property::CHANNEL_CODEC].as<string>());
|
||||||
bulk["channel_codec_quality"] = channel->properties()[property::CHANNEL_CODEC_QUALITY].as<string>();
|
result.put_unchecked(index, "channel_codec_quality", channel->properties()[property::CHANNEL_CODEC_QUALITY].as<string>());
|
||||||
bulk["channel_needed_talk_power"] = channel->properties()[property::CHANNEL_NEEDED_TALK_POWER].as<string>();
|
result.put_unchecked(index, "channel_needed_talk_power", channel->properties()[property::CHANNEL_NEEDED_TALK_POWER].as<string>());
|
||||||
}
|
}
|
||||||
if(cmd.hasParm("icon")){
|
if(cmd.hasParm("icon")){
|
||||||
bulk["channel_icon_id"] = channel->properties()[property::CHANNEL_ICON_ID].as<string>();
|
result.put_unchecked(index, "channel_icon_id", channel->properties()[property::CHANNEL_ICON_ID].as<string>());
|
||||||
}
|
}
|
||||||
if(cmd.hasParm("limits")){
|
if(cmd.hasParm("limits")){
|
||||||
bulk["total_clients_family"] = this->server ? this->server->getClientsByChannelRoot(channel, false).size() : 0;
|
result.put_unchecked(index, "total_clients_family", this->server ? this->server->getClientsByChannelRoot(channel, false).size() : 0);
|
||||||
bulk["total_clients"] = this->server ? this->server->getClientsByChannel(channel).size() : 0;
|
result.put_unchecked(index, "total_clients", this->server ? this->server->getClientsByChannel(channel).size() : 0);
|
||||||
|
|
||||||
bulk["channel_maxclients"] = channel->properties()[property::CHANNEL_MAXCLIENTS].as<string>();
|
result.put_unchecked(index, "channel_maxclients", channel->properties()[property::CHANNEL_MAXCLIENTS].as<string>());
|
||||||
bulk["channel_maxfamilyclients"] = channel->properties()[property::CHANNEL_MAXFAMILYCLIENTS].as<string>();
|
result.put_unchecked(index, "channel_maxfamilyclients", channel->properties()[property::CHANNEL_MAXFAMILYCLIENTS].as<string>());
|
||||||
|
|
||||||
{
|
{
|
||||||
auto needed_power = channel->permissions()->permission_value_flagged(permission::i_channel_subscribe_power);
|
auto needed_power = channel->permissions()->permission_value_flagged(permission::i_channel_subscribe_power);
|
||||||
bulk["channel_needed_subscribe_power"] = needed_power.has_value ? needed_power.value : 0;
|
result.put_unchecked(index, "channel_needed_subscribe_power", needed_power.has_value ? needed_power.value : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(cmd.hasParm("topic")) {
|
if(cmd.hasParm("topic")) {
|
||||||
bulk["channel_topic"] = channel->properties()[property::CHANNEL_TOPIC].as<string>();
|
result.put_unchecked(index, "channel_topic", channel->properties()[property::CHANNEL_TOPIC].as<string>());
|
||||||
}
|
}
|
||||||
if(cmd.hasParm("times")){
|
if(cmd.hasParm("times")){
|
||||||
bulk["seconds_empty"] = channel->emptySince();
|
result.put_unchecked(index, "seconds_empty", channel->emptySince());
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->sendCommand(result);
|
this->sendCommand(result, false);
|
||||||
return command_result{error::ok};
|
return command_result{error::ok};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,33 +541,34 @@ command_result QueryClient::handleCommandServerList(Command& cmd) {
|
|||||||
CMD_RESET_IDLE;
|
CMD_RESET_IDLE;
|
||||||
ACTION_REQUIRES_INSTANCE_PERMISSION(permission::b_serverinstance_virtualserver_list, 1);
|
ACTION_REQUIRES_INSTANCE_PERMISSION(permission::b_serverinstance_virtualserver_list, 1);
|
||||||
|
|
||||||
Command res("");
|
auto servers = serverInstance->getVoiceServerManager()->serverInstances();
|
||||||
|
command_builder result{"", 256, servers.size()};
|
||||||
|
|
||||||
int index = 0;
|
size_t index = 0;
|
||||||
for(const auto& server : serverInstance->getVoiceServerManager()->serverInstances()) {
|
for(const auto& server : serverInstance->getVoiceServerManager()->serverInstances()) {
|
||||||
res[index]["virtualserver_id"] = server->getServerId();
|
result.put_unchecked(index, "virtualserver_id", server->getServerId());
|
||||||
res[index]["virtualserver_host"] = server->properties()[property::VIRTUALSERVER_HOST].as<string>();
|
result.put_unchecked(index, "virtualserver_host", server->properties()[property::VIRTUALSERVER_HOST].as<string>());
|
||||||
res[index]["virtualserver_port"] = server->properties()[property::VIRTUALSERVER_PORT].as<string>();
|
result.put_unchecked(index, "virtualserver_port", server->properties()[property::VIRTUALSERVER_PORT].as<string>());
|
||||||
res[index]["virtualserver_web_host"] = server->properties()[property::VIRTUALSERVER_WEB_HOST].as<string>();
|
result.put_unchecked(index, "virtualserver_web_host", server->properties()[property::VIRTUALSERVER_WEB_HOST].as<string>());
|
||||||
res[index]["virtualserver_web_port"] = server->properties()[property::VIRTUALSERVER_WEB_PORT].as<string>();
|
result.put_unchecked(index, "virtualserver_web_port", server->properties()[property::VIRTUALSERVER_WEB_PORT].as<string>());
|
||||||
res[index]["virtualserver_status"] = ServerState::string(server->state);
|
result.put_unchecked(index, "virtualserver_status", ServerState::string(server->state));
|
||||||
res[index]["virtualserver_clientsonline"] = server->properties()[property::VIRTUALSERVER_CLIENTS_ONLINE].as<string>();
|
result.put_unchecked(index, "virtualserver_clientsonline", server->properties()[property::VIRTUALSERVER_CLIENTS_ONLINE].as<string>());
|
||||||
res[index]["virtualserver_queryclientsonline"] = server->properties()[property::VIRTUALSERVER_QUERYCLIENTS_ONLINE].as<string>();
|
result.put_unchecked(index, "virtualserver_queryclientsonline", server->properties()[property::VIRTUALSERVER_QUERYCLIENTS_ONLINE].as<string>());
|
||||||
res[index]["virtualserver_maxclients"] = server->properties()[property::VIRTUALSERVER_MAXCLIENTS].as<string>();
|
result.put_unchecked(index, "virtualserver_maxclients", server->properties()[property::VIRTUALSERVER_MAXCLIENTS].as<string>());
|
||||||
if(server->startTimestamp.time_since_epoch().count() > 0 && server->state == ServerState::ONLINE)
|
if(server->startTimestamp.time_since_epoch().count() > 0 && server->state == ServerState::ONLINE)
|
||||||
res[index]["virtualserver_uptime"] = duration_cast<seconds>(system_clock::now() - server->startTimestamp).count();
|
result.put_unchecked(index, "virtualserver_uptime", duration_cast<seconds>(system_clock::now() - server->startTimestamp).count());
|
||||||
else
|
else
|
||||||
res[index]["virtualserver_uptime"] = 0;
|
result.put_unchecked(index, "virtualserver_uptime", 0);
|
||||||
res[index]["virtualserver_name"] = server->properties()[property::VIRTUALSERVER_NAME].as<string>();
|
result.put_unchecked(index, "virtualserver_name", server->properties()[property::VIRTUALSERVER_NAME].as<string>());
|
||||||
res[index]["virtualserver_autostart"] = server->properties()[property::VIRTUALSERVER_AUTOSTART].as<string>();
|
result.put_unchecked(index, "virtualserver_autostart", server->properties()[property::VIRTUALSERVER_AUTOSTART].as<string>());
|
||||||
res[index]["virtualserver_machine_id"] = server->properties()[property::VIRTUALSERVER_MACHINE_ID].as<string>();
|
result.put_unchecked(index, "virtualserver_machine_id", server->properties()[property::VIRTUALSERVER_MACHINE_ID].as<string>());
|
||||||
if(cmd.hasParm("uid"))
|
if(cmd.hasParm("uid"))
|
||||||
res[index]["virtualserver_unique_identifier"] = server->properties()[property::VIRTUALSERVER_UNIQUE_IDENTIFIER].as<string>();
|
result.put_unchecked(index, "virtualserver_unique_identifier", server->properties()[property::VIRTUALSERVER_UNIQUE_IDENTIFIER].as<string>());
|
||||||
else res[index]["virtualserver_unique_identifier"] = "";
|
else result.put_unchecked(index, "virtualserver_unique_identifier", "");
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->sendCommand(res);
|
this->sendCommand(result, false);
|
||||||
return command_result{error::ok};
|
return command_result{error::ok};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
shared
2
shared
@ -1 +1 @@
|
|||||||
Subproject commit 23a9385afebbbdb2cba88c5ea5f84daf4c85acc4
|
Subproject commit 00e8aca68ea5257d2fef20912428577171b640e2
|
Loading…
Reference in New Issue
Block a user