summaryrefslogtreecommitdiff
path: root/src/message.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/message.h')
-rw-r--r--src/message.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/message.h b/src/message.h
new file mode 100644
index 0000000..22da0fd
--- /dev/null
+++ b/src/message.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include <erebos/identity.h>
+#include <erebos/message.h>
+#include <erebos/storage.h>
+#include <erebos/time.h>
+
+#include <chrono>
+#include <mutex>
+#include <vector>
+
+namespace chrono = std::chrono;
+using chrono::system_clock;
+using std::mutex;
+using std::optional;
+using std::string;
+using std::vector;
+
+namespace erebos {
+
+struct DirectMessageData
+{
+ static DirectMessageData load(const Ref &);
+ Ref store(const Storage &) const;
+
+ vector<Stored<DirectMessageData>> prev;
+ optional<Identity> from;
+ optional<ZonedTime> time;
+ optional<string> text;
+};
+
+struct DirectMessage::Priv
+{
+ Stored<DirectMessageData> data;
+};
+
+struct DirectMessageThread::Priv
+{
+ const Identity peer;
+ const vector<Stored<DirectMessageData>> head;
+};
+
+struct DirectMessageThread::Iterator::Priv
+{
+ optional<DirectMessage> current;
+ vector<Stored<DirectMessageData>> next;
+};
+
+struct DirectMessageState
+{
+ static DirectMessageState load(const Ref &);
+ Ref store(const Storage &) const;
+
+ vector<Stored<DirectMessageState>> prev;
+ optional<Identity> peer;
+
+ vector<Stored<DirectMessageData>> ready {};
+ vector<Stored<DirectMessageData>> sent {};
+ vector<Stored<DirectMessageData>> received {};
+ vector<Stored<DirectMessageData>> seen {};
+};
+
+}