summaryrefslogtreecommitdiff
path: root/src/contact.h
blob: 31deceb151ba64234ecb7b7a5a980c32d371b5ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once

#include <erebos/contact.h>

#include <mutex>
#include <optional>
#include <string>
#include <vector>

namespace erebos {

using std::optional;
using std::string;
using std::vector;

struct ContactData;
struct IdentityData;

struct Contact::Priv
{
	vector<Stored<ContactData>> data;
	Identity identity;

	void init();
	std::once_flag initFlag {};

	optional<string> name {};

	static List<Contact> loadList(vector<Stored<ContactData>> &&, vector<Identity> &&);
};

struct ContactData
{
	static ContactData load(const Ref &);
	Ref store(const Storage &) const;

	vector<Stored<ContactData>> prev;
	vector<Stored<Signed<IdentityData>>> identity;
	optional<string> name;
};

}