forked from Green-Sky/tomato
2abf09ac06
* part 1 move files from messages to objects tomato - did not touch chat_gui yet, but image loaders and other stuff * part 1.1 * part 2, mostly chatgui - also ngcft1 behind the scenes * part 3 - port over rest, except for avatar_manager, which is effectivly disabled * fix surface missused causing bmp loader to crash * fixing small issues and small forward refactor
47 lines
999 B
C++
47 lines
999 B
C++
#pragma once
|
|
|
|
#include <solanaceae/object_store/object_store.hpp>
|
|
#include <solanaceae/contact/contact_model3.hpp>
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
|
|
// RIP fishy c=<
|
|
|
|
struct ConfigModelI;
|
|
struct ToxKey;
|
|
|
|
class ToxAvatarManager : public ObjectStoreEventI {
|
|
ObjectStore2& _os;
|
|
Contact3Registry& _cr;
|
|
ConfigModelI& _conf;
|
|
|
|
struct AcceptEntry {
|
|
ObjectHandle m;
|
|
std::string file_path;
|
|
};
|
|
std::vector<AcceptEntry> _accept_queue;
|
|
|
|
public:
|
|
ToxAvatarManager(
|
|
ObjectStore2& os,
|
|
Contact3Registry& cr,
|
|
ConfigModelI& conf
|
|
);
|
|
|
|
void iterate(void);
|
|
|
|
protected:
|
|
// TODO: become backend and work in objects instead
|
|
std::string getAvatarPath(const ToxKey& key) const;
|
|
void addAvatarFileToContact(const Contact3 c, const ToxKey& key);
|
|
void clearAvatarFromContact(const Contact3 c);
|
|
void checkObj(ObjectHandle o);
|
|
|
|
protected: // os
|
|
bool onEvent(const ObjectStore::Events::ObjectConstruct& e) override;
|
|
bool onEvent(const ObjectStore::Events::ObjectUpdate& e) override;
|
|
};
|
|
|