add syncedBy and remote state components

This commit is contained in:
Green Sky 2024-01-12 12:46:01 +01:00
parent d0a53a6366
commit 4ae7c4068f
No known key found for this signature in database
3 changed files with 35 additions and 3 deletions

View File

@ -5,8 +5,11 @@
//fwd
struct FileI;
#include <string>
#include <entt/container/dense_map.hpp>
#include <memory>
#include <string>
#include <vector>
namespace Message::Components {
@ -18,15 +21,17 @@ namespace Message::Components {
Contact3 c;
};
// best guess as to how this should be displayed in the global order
struct Timestamp {
uint64_t ts {0};
};
struct TimestampProcessed {
struct TimestampWritten {
uint64_t ts {0};
};
struct TimestampWritten {
// local start TODO: namespace ?
struct TimestampProcessed {
uint64_t ts {0};
};
@ -36,6 +41,29 @@ namespace Message::Components {
// TODO: too much?
uint64_t ts {0};
};
// local end
namespace Remote {
// TODO: milliseconds sound excessive
struct TimestampReceived {
// Due to a lack of info with most protocols,
// this is often the timestamp we heard they already have the message.
entt::dense_map<Contact3, uint64_t> ts;
};
struct TimestampRead {
// Due to a lack of info with most protocols,
// this is often the timestamp we heard they have read it the message.
entt::dense_map<Contact3, uint64_t> ts;
};
} // Remote
struct SyncedBy {
// ts is not updated once set
entt::dense_map<Contact3, uint64_t> ts;
};
struct MessageText {
std::string text;

View File

@ -19,6 +19,9 @@ DEFINE_COMP_ID(Message::Components::TimestampProcessed)
DEFINE_COMP_ID(Message::Components::TimestampWritten)
DEFINE_COMP_ID(Message::Components::TagUnread)
DEFINE_COMP_ID(Message::Components::Read)
DEFINE_COMP_ID(Message::Components::Remote::TimestampReceived)
DEFINE_COMP_ID(Message::Components::Remote::TimestampRead)
DEFINE_COMP_ID(Message::Components::SyncedBy)
DEFINE_COMP_ID(Message::Components::MessageText)
DEFINE_COMP_ID(Message::Components::TagMessageIsAction)

View File

@ -36,6 +36,7 @@ namespace Events {
} // Events
// get unix time in milliseconds
// TODO: move to util
uint64_t getTimeMS(void);
} // Message