Files
tomato/src/tox_avatar_manager.hpp
Green Sky 3a929569ee
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
avatar sending, uses self in avatar dir
also fix cwd in file selector
2025-05-06 15:27:18 +02:00

58 lines
1.3 KiB
C++

#pragma once
#include <solanaceae/object_store/object_store.hpp>
#include <solanaceae/contact/fwd.hpp>
#include <solanaceae/toxcore/tox_interface.hpp>
#include "./backends/std_fs.hpp"
#include <string>
#include <vector>
// RIP fishy c=<
struct ConfigModelI;
struct ToxKey;
class ToxAvatarManager : public ObjectStoreEventI {
ObjectStore2& _os;
ObjectStore2::SubscriptionReference _os_sr;
ContactStore4I& _cs;
ConfigModelI& _conf;
ToxI& _t;
Backends::STDFS _sb_tcs;
struct AcceptEntry {
ObjectHandle m;
std::string file_path;
};
std::vector<AcceptEntry> _accept_queue;
public:
ToxAvatarManager(
ObjectStore2& os,
ContactStore4I& cs,
ConfigModelI& conf,
ToxI& t
);
void iterate(void);
protected:
// TODO: become backend and work in objects instead
std::string getAvatarPath(const ToxKey& key) const;
std::string getAvatarFileName(const ToxKey& key) const;
void addAvatarFileToContact(const Contact4 c, const ToxKey& key);
void clearAvatarFromContact(const Contact4 c);
void checkObj(ObjectHandle o);
protected: // os
// on new obj, check for ToxTransferFriend and emplace own contact tracker
bool onEvent(const ObjectStore::Events::ObjectConstruct& e) override;
bool onEvent(const ObjectStore::Events::ObjectUpdate& e) override;
bool onEvent(const ObjectStore::Events::ObjectDestory& e) override;
};