Improved abort signal printing and some reformats

This commit is contained in:
WolverinDEV
2021-01-14 22:16:56 +01:00
parent f2c5b5d750
commit 94c7eb2f39
14 changed files with 143 additions and 95 deletions
+6 -4
View File
@@ -40,7 +40,6 @@ using namespace ts::token;
constexpr static auto kFileAPITimeout = std::chrono::milliseconds{500};
constexpr static auto kMaxClientTransfers = 10;
#define QUERY_PASSWORD_LENGTH 12
//ftgetfilelist cid=1 cpw path=\/ return_code=1:x
//Answer:
@@ -90,8 +89,9 @@ command_result ConnectedClient::handleCommandFTGetFileList(Command &cmd) {
}
}
if(!query_result->wait_for(kFileAPITimeout))
if(!query_result->wait_for(kFileAPITimeout)) {
return command_result{error::file_api_timeout};
}
if(!query_result->succeeded()) {
debugMessage(this->getServerId(), "{} Failed to query directory: {} / {}", CLIENT_STR_LOG_PREFIX, file::filesystem::directory_query_error_messages[(int) query_result->error().error_type], query_result->error().error_message);
@@ -118,8 +118,9 @@ command_result ConnectedClient::handleCommandFTGetFileList(Command &cmd) {
}
const auto& files = query_result->response();
if(files.empty())
if(files.empty()) {
return command_result{error::database_empty_result};
}
auto return_code = cmd["return_code"].size() > 0 ? cmd["return_code"].string() : "";
@@ -131,8 +132,9 @@ command_result ConnectedClient::handleCommandFTGetFileList(Command &cmd) {
notify_file_list.reset();
notify_file_list.put_unchecked(0, "path", cmd["path"].string());
notify_file_list.put_unchecked(0, "cid", cmd["cid"].string());
if(!return_code.empty())
if(!return_code.empty()){
notify_file_list.put_unchecked(0, "return_code", return_code);
}
}
auto bulk = notify_file_list.bulk(bulk_index++);
+4 -2
View File
@@ -663,8 +663,9 @@ command_result ConnectedClient::handleCommandBanList(Command &cmd) {
CMD_CHK_AND_INC_FLOOD_POINTS(25);
ServerId sid = this->getServerId();
if (cmd[0].has("sid"))
if (cmd[0].has("sid")) {
sid = cmd["sid"];
}
if (sid == 0) {
ACTION_REQUIRES_GLOBAL_PERMISSION(permission::b_client_ban_list_global, 1);
@@ -672,8 +673,9 @@ command_result ConnectedClient::handleCommandBanList(Command &cmd) {
auto server = serverInstance->getVoiceServerManager()->findServerById(sid);
if (!server) return command_result{error::parameter_invalid};
if (!permission::v2::permission_granted(1, server->calculate_permission(permission::b_client_ban_list, this->getClientDatabaseId(), this->getType(), 0)))
if (!permission::v2::permission_granted(1, server->calculate_permission(permission::b_client_ban_list, this->getClientDatabaseId(), this->getType(), 0))) {
return command_result{permission::b_client_ban_list};
}
}
//When empty: return command_result{error::database_empty_result};