Some minor bugfixes

This commit is contained in:
WolverinDEV
2020-07-13 11:13:09 +02:00
parent e01811e20e
commit 9c7223d016
13 changed files with 86 additions and 67 deletions
+9 -15
View File
@@ -93,44 +93,38 @@ void FileServerHandler::callback_transfer_aborted(const std::shared_ptr<transfer
}
//notifystatusfiletransfer clientftfid=4096 status=2568 failed_permid=234 msg=insufficient\sclient\spermissions\s(failed\son\si_ft_needed_file_upload_power) size=0
ts::command_builder notify{"notifystatusfiletransfer"};
notify.put_unchecked(0, "clientftfid", transfer->client_transfer_id);
notify.put(0, "size", 0); /* not sure where TeamSpeak counts from */
notify.put(0, "size", 0);
ts::command_result status{};
using ErrorType = ts::server::file::transfer::TransferError::Type;
switch (error.error_type) {
case ErrorType::TRANSFER_TIMEOUT:
notify.put_unchecked(0, "status", (int) error::file_transfer_connection_timeout);
notify.put_unchecked(0, "msg", findError(error::file_transfer_connection_timeout).message);
status.reset(ts::command_result{error::file_transfer_connection_timeout});
break;
case ErrorType::DISK_IO_ERROR:
case ErrorType::DISK_TIMEOUT:
case ErrorType::DISK_INITIALIZE_ERROR:
notify.put_unchecked(0, "status", (int) error::file_io_error);
notify.put_unchecked(0, "msg", findError(error::file_io_error).message);
status.reset(ts::command_result{error::file_io_error});
break;
case ErrorType::UNKNOWN:
case ErrorType::NETWORK_IO_ERROR:
notify.put_unchecked(0, "status", (int) error::file_connection_lost);
notify.put_unchecked(0, "msg", findError(error::file_connection_lost).message);
status.reset(ts::command_result{error::file_connection_lost});
break;
case ErrorType::UNEXPECTED_CLIENT_DISCONNECT:
case ErrorType::UNEXPECTED_DISK_EOF:
notify.put_unchecked(0, "status", (int) error::file_transfer_interrupted);
notify.put_unchecked(0, "msg", findError(error::file_transfer_interrupted).message);
status.reset(ts::command_result{error::file_transfer_interrupted});
case ErrorType::USER_REQUEST:
notify.put_unchecked(0, "status", (int) error::file_transfer_canceled);
notify.put_unchecked(0, "msg", findError(error::file_transfer_canceled).message);
status.reset(ts::command_result{error::file_transfer_canceled});
break;
}
notify.put_unchecked(0, "extra_msg", error.error_message);
client->writeCommandResult(notify, status, "status");
client->sendCommand(notify);
}
}
@@ -197,7 +191,7 @@ void FileServerHandler::callback_transfer_finished(const std::shared_ptr<transfe
ts::command_builder notify{"notifystatusfiletransfer"};
notify.put_unchecked(0, "clientftfid", transfer->client_transfer_id);
notify.put(0, "size", 0); /* not sure where TeamSpeak counts from */
notify.put(0, "size", transfer->expected_file_size); /* not sure where TeamSpeak counts from */
notify.put_unchecked(0, "status", (int) error::file_transfer_complete);
notify.put_unchecked(0, "msg", findError(error::file_transfer_complete).message);