From 1a3d9dd1870b1f45e252ff636adfd0c1f0ccf521 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 30 Jul 2024 11:00:36 +0200 Subject: [PATCH] set backend on objects and more cleanup --- .../tox_messages/tox_transfer_manager.cpp | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/solanaceae/tox_messages/tox_transfer_manager.cpp b/solanaceae/tox_messages/tox_transfer_manager.cpp index 5d219bb..13ab02c 100644 --- a/solanaceae/tox_messages/tox_transfer_manager.cpp +++ b/solanaceae/tox_messages/tox_transfer_manager.cpp @@ -143,31 +143,21 @@ Message3Handle ToxTransferManager::toxSendFilePath(const Contact3 c, uint32_t fi // TODO: move this to backend ObjectHandle o {_os.registry(), _os.registry().create()}; - //reg_ptr->emplace(e); o.emplace(); - //reg_ptr->emplace(e); o.emplace(); - //reg_ptr->emplace(e, file_kind); o.emplace(file_kind); - //reg_ptr->emplace(e, file_id); o.emplace(file_id); - { // file info - //auto& file_info = reg_ptr->emplace(e); - //file_info.file_list.emplace_back() = {std::string{file_name}, file_impl->_file_size}; - //file_info.total_size = file_impl->_file_size; - o.emplace(std::string{file_name}, file_impl->_file_size); + // file info + o.emplace(std::string{file_name}, file_impl->_file_size); + o.emplace(std::string{file_path}); + o.emplace(std::string{file_path}); // ? - //reg_ptr->emplace(e, std::vector{std::string{file_path}}); - o.emplace(std::string{file_path}); - o.emplace(std::string{file_path}); // ? - } + o.emplace(&_ftb); - //reg_ptr->emplace(e); o.emplace(); - // TODO: determine if this is true - //reg_ptr->emplace(e); + // TODO: replace with better state tracking o.emplace(); Message3Handle msg {*reg_ptr, reg_ptr->create()}; @@ -182,21 +172,15 @@ Message3Handle ToxTransferManager::toxSendFilePath(const Contact3 c, uint32_t fi const auto&& [transfer_id, err] = _t.toxFileSend(friend_number, file_kind, file_impl->_file_size, file_id, file_name); if (err == TOX_ERR_FILE_SEND_OK) { assert(transfer_id.has_value()); - //reg_ptr->emplace(e, friend_number, transfer_id.value()); o.emplace(friend_number, transfer_id.value()); - //reg_ptr->emplace(e, std::move(file_impl)); o.emplace(std::move(file_impl)); // TODO: add tag signifying init sent status? - //toxFriendLookupAdd({*reg_ptr, e}); toxFriendLookupAdd(o); } // else queue? _os.throwEventConstruct(o); - - //_rmm.throwEventConstruct(*reg_ptr, e); _rmm.throwEventConstruct(msg); - //return {*reg_ptr, e}; return msg; } @@ -531,6 +515,8 @@ bool ToxTransferManager::onToxEvent(const Tox_Event_File_Recv* e) { o.emplace(); + o.emplace(&_ftb); + toxFriendLookupAdd(o); Message3Handle msg = {*reg_ptr, reg_ptr->create()};