set backend on objects and more cleanup
This commit is contained in:
parent
53d5229391
commit
1a3d9dd187
@ -143,31 +143,21 @@ Message3Handle ToxTransferManager::toxSendFilePath(const Contact3 c, uint32_t fi
|
|||||||
// TODO: move this to backend
|
// TODO: move this to backend
|
||||||
ObjectHandle o {_os.registry(), _os.registry().create()};
|
ObjectHandle o {_os.registry(), _os.registry().create()};
|
||||||
|
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::TagHaveAll>(e);
|
|
||||||
o.emplace<ObjComp::F::TagLocalHaveAll>();
|
o.emplace<ObjComp::F::TagLocalHaveAll>();
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::TagSending>(e);
|
|
||||||
o.emplace<ObjComp::Tox::TagOutgoing>();
|
o.emplace<ObjComp::Tox::TagOutgoing>();
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::FileKind>(e, file_kind);
|
|
||||||
o.emplace<ObjComp::Tox::FileKind>(file_kind);
|
o.emplace<ObjComp::Tox::FileKind>(file_kind);
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::FileID>(e, file_id);
|
|
||||||
o.emplace<ObjComp::Tox::FileID>(file_id);
|
o.emplace<ObjComp::Tox::FileID>(file_id);
|
||||||
|
|
||||||
{ // file info
|
// file info
|
||||||
//auto& file_info = reg_ptr->emplace<Message::Components::Transfer::FileInfo>(e);
|
o.emplace<ObjComp::F::SingleInfo>(std::string{file_name}, file_impl->_file_size);
|
||||||
//file_info.file_list.emplace_back() = {std::string{file_name}, file_impl->_file_size};
|
o.emplace<ObjComp::F::SingleInfoLocal>(std::string{file_path});
|
||||||
//file_info.total_size = file_impl->_file_size;
|
o.emplace<ObjComp::Ephemeral::FilePath>(std::string{file_path}); // ?
|
||||||
o.emplace<ObjComp::F::SingleInfo>(std::string{file_name}, file_impl->_file_size);
|
|
||||||
|
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::FileInfoLocal>(e, std::vector{std::string{file_path}});
|
o.emplace<ObjComp::Ephemeral::Backend>(&_ftb);
|
||||||
o.emplace<ObjComp::F::SingleInfoLocal>(std::string{file_path});
|
|
||||||
o.emplace<ObjComp::Ephemeral::FilePath>(std::string{file_path}); // ?
|
|
||||||
}
|
|
||||||
|
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::BytesSent>(e);
|
|
||||||
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
|
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
|
||||||
|
|
||||||
// TODO: determine if this is true
|
// TODO: replace with better state tracking
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::TagPaused>(e);
|
|
||||||
o.emplace<ObjComp::Ephemeral::File::TagTransferPaused>();
|
o.emplace<ObjComp::Ephemeral::File::TagTransferPaused>();
|
||||||
|
|
||||||
Message3Handle msg {*reg_ptr, reg_ptr->create()};
|
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);
|
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) {
|
if (err == TOX_ERR_FILE_SEND_OK) {
|
||||||
assert(transfer_id.has_value());
|
assert(transfer_id.has_value());
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::ToxTransferFriend>(e, friend_number, transfer_id.value());
|
|
||||||
o.emplace<ObjComp::Ephemeral::ToxTransferFriend>(friend_number, transfer_id.value());
|
o.emplace<ObjComp::Ephemeral::ToxTransferFriend>(friend_number, transfer_id.value());
|
||||||
//reg_ptr->emplace<Message::Components::Transfer::File>(e, std::move(file_impl));
|
|
||||||
o.emplace<Components::TFTFile2>(std::move(file_impl));
|
o.emplace<Components::TFTFile2>(std::move(file_impl));
|
||||||
// TODO: add tag signifying init sent status?
|
// TODO: add tag signifying init sent status?
|
||||||
|
|
||||||
//toxFriendLookupAdd({*reg_ptr, e});
|
|
||||||
toxFriendLookupAdd(o);
|
toxFriendLookupAdd(o);
|
||||||
} // else queue?
|
} // else queue?
|
||||||
|
|
||||||
_os.throwEventConstruct(o);
|
_os.throwEventConstruct(o);
|
||||||
|
|
||||||
//_rmm.throwEventConstruct(*reg_ptr, e);
|
|
||||||
_rmm.throwEventConstruct(msg);
|
_rmm.throwEventConstruct(msg);
|
||||||
//return {*reg_ptr, e};
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,6 +515,8 @@ bool ToxTransferManager::onToxEvent(const Tox_Event_File_Recv* e) {
|
|||||||
|
|
||||||
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
|
o.emplace<ObjComp::Ephemeral::File::TransferStats>();
|
||||||
|
|
||||||
|
o.emplace<ObjComp::Ephemeral::Backend>(&_ftb);
|
||||||
|
|
||||||
toxFriendLookupAdd(o);
|
toxFriendLookupAdd(o);
|
||||||
|
|
||||||
Message3Handle msg = {*reg_ptr, reg_ptr->create()};
|
Message3Handle msg = {*reg_ptr, reg_ptr->create()};
|
||||||
|
Loading…
Reference in New Issue
Block a user