avatar sending, uses self in avatar dir
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (push) Has been cancelled
ContinuousDelivery / windows-asan (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
ContinuousIntegration / linux (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
also fix cwd in file selector
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <solanaceae/tox_contacts/components.hpp>
|
||||
|
||||
#include <solanaceae/util/utils.hpp>
|
||||
#include <solanaceae/file/file2.hpp>
|
||||
|
||||
#include <filesystem>
|
||||
#include <string_view>
|
||||
@@ -33,8 +34,9 @@ namespace Components {
|
||||
ToxAvatarManager::ToxAvatarManager(
|
||||
ObjectStore2& os,
|
||||
ContactStore4I& cs,
|
||||
ConfigModelI& conf
|
||||
) : _os(os), _os_sr(_os.newSubRef(this)), _cs(cs), _conf(conf), _sb_tcs(os) {
|
||||
ConfigModelI& conf,
|
||||
ToxI& t
|
||||
) : _os(os), _os_sr(_os.newSubRef(this)), _cs(cs), _conf(conf), _t(t), _sb_tcs(os) {
|
||||
_os_sr
|
||||
.subscribe(ObjectStore_Event::object_construct)
|
||||
.subscribe(ObjectStore_Event::object_update)
|
||||
@@ -126,6 +128,20 @@ void ToxAvatarManager::addAvatarFileToContact(const Contact4 c, const ToxKey& ke
|
||||
std::filesystem::file_size(file_path)
|
||||
);
|
||||
|
||||
{ // toxhash for tox file id, so the remote can optimize cached files
|
||||
auto file = o.get<ObjComp::Ephemeral::BackendFile2>().ptr->file2(o, StorageBackendIFile2::FILE2_READ);
|
||||
if (file) {
|
||||
auto file_buf = file->read(o.get<ObjComp::F::SingleInfo>().file_size);
|
||||
// HACK: tox interface needs bytespan
|
||||
if (file_buf.isOwning()) {
|
||||
o.emplace_or_replace<ObjComp::Tox::FileID>(_t.toxHash(file_buf._data_owner));
|
||||
} else {
|
||||
// TODO: tox bytespan !!
|
||||
o.emplace_or_replace<ObjComp::Tox::FileID>(_t.toxHash(std::vector<uint8_t>(file_buf.cbegin(), file_buf.cend())));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_os.throwEventConstruct(o);
|
||||
|
||||
// avatar file "png" exists
|
||||
|
||||
Reference in New Issue
Block a user