diff --git a/server/src/client/query/QueryClientCommands.cpp b/server/src/client/query/QueryClientCommands.cpp index 58b125f..9aff148 100644 --- a/server/src/client/query/QueryClientCommands.cpp +++ b/server/src/client/query/QueryClientCommands.cpp @@ -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()); 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()); } - 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++; } diff --git a/server/src/manager/SqlDataManager.h b/server/src/manager/SqlDataManager.h index 6ff625e..80544e6 100644 --- a/server/src/manager/SqlDataManager.h +++ b/server/src/manager/SqlDataManager.h @@ -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();