os backend refactor

This commit is contained in:
Green Sky
2025-01-18 01:53:46 +01:00
parent 09300c1702
commit d91ad4bfa9
3 changed files with 15 additions and 13 deletions

View File

@@ -11,6 +11,8 @@
#include <solanaceae/message3/components.hpp>
#include "./msg_components.hpp"
#include "./obj_components.hpp"
#include "solanaceae/object_store/meta_components.hpp"
#include "solanaceae/util/span.hpp"
#include <sodium.h>
@@ -146,8 +148,7 @@ Message3Handle ToxTransferManager::toxSendFilePath(const Contact3 c, uint32_t fi
return {};
}
// TODO: move this to backend
ObjectHandle o {_os.registry(), _os.registry().create()};
auto o = _ftb.newObject(ByteSpan{file_id}, false);
o.emplace<ObjComp::F::TagLocalHaveAll>();
o.emplace<ObjComp::Tox::TagOutgoing>();
@@ -159,8 +160,6 @@ Message3Handle ToxTransferManager::toxSendFilePath(const Contact3 c, uint32_t fi
o.emplace<ObjComp::F::SingleInfoLocal>(std::string{file_path});
o.emplace<ObjComp::Ephemeral::FilePath>(std::string{file_path}); // ?
o.emplace<ObjComp::Ephemeral::Backend>(&_ftb);
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
// TODO: replace with better state tracking
@@ -507,7 +506,7 @@ bool ToxTransferManager::onToxEvent(const Tox_Event_File_Recv* e) {
auto self_c = _cr.get<Contact::Components::Self>(c).self;
o = {_os.registry(), _os.registry().create()};
o = _ftb.newObject(ByteSpan{f_id_opt.value()}, false);
o.emplace<ObjComp::Tox::TagIncomming>();
o.emplace<ObjComp::Ephemeral::File::TagTransferPaused>();
@@ -521,8 +520,6 @@ bool ToxTransferManager::onToxEvent(const Tox_Event_File_Recv* e) {
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
o.emplace<ObjComp::Ephemeral::Backend>(&_ftb);
toxFriendLookupAdd(o);
Message3Handle msg = {*reg_ptr, reg_ptr->create()};