Fixed YatQa rror

This commit is contained in:
WolverinDEV 2020-05-19 09:51:54 +02:00
parent c7f989da8b
commit f7924d29df
2 changed files with 6 additions and 4 deletions

View File

@ -486,11 +486,13 @@ command_result QueryClient::handleCommandChannelList(Command& cmd) {
command_builder result{"", 1024, entries.size()};
for(const auto& channel : entries){
if(!channel) continue;
const auto channel_clients = this->server ? this->server->getClientsByChannel(channel).size() : 0;
result.put_unchecked(index, "cid", channel->channelId());
result.put_unchecked(index, "pid", channel->properties()[property::CHANNEL_PID].as<string>());
result.put_unchecked(index, "channel_name", channel->name());
result.put_unchecked(index, "channel_order", channel->channelOrder());
result.put_unchecked(index, "total_clients", this->server ? this->server->getClientsByChannel(channel).size() : 0);
result.put_unchecked(index, "total_clients", channel_clients);
/* result.put_unchecked(index, "channel_needed_subscribe_power", channel->permissions()->getPermissionValue(permission::i_channel_needed_subscribe_power, channel, 0)); */
if(cmd.hasParm("flags")){
@ -522,8 +524,8 @@ command_result QueryClient::handleCommandChannelList(Command& cmd) {
if(cmd.hasParm("topic")) {
result.put_unchecked(index, "channel_topic", channel->properties()[property::CHANNEL_TOPIC].as<string>());
}
if(cmd.hasParm("times")){
result.put_unchecked(index, "seconds_empty", channel->emptySince());
if(cmd.hasParm("times") || cmd.hasParm("secondsempty")){
result.put_unchecked(index, "seconds_empty", channel_clients == 0 ? channel->emptySince() : 0);
}
index++;
}

View File

@ -10,7 +10,7 @@ namespace ts {
virtual ~SqlDataManager();
[[nodiscard]] inline int get_database_version() const { return this->_database_version; }
[[nodiscard]] inline int get_permissions_version() const { return this->_database_version; }
[[nodiscard]] inline int get_permissions_version() const { return this->_permissions_version; }
bool initialize(std::string&);
void finalize();