-
Notifications
You must be signed in to change notification settings - Fork 1
/
ExportManager.h
74 lines (70 loc) · 2.01 KB
/
ExportManager.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef EXPORTMANAGER_H
#define EXPORTMANAGER_H
#include <retroshare/rsplugin.h>
#include "jsoncpp/json/json.h"
class ExportManager
{
public:
/*!
* \brief ExportManager constructor
* \param mPeers Retroshare peers to export.
*/
ExportManager(RsPeers* mPeers);
/*!
* \brief getExportCount
*
* Returns how many gpg peers ids were last exported by
* ExportManager::exportJson. It will return 0 if no peers have yet been
* exported.
*
* \return How many peers were last exported.
*/
int getExportCount(){return export_count;}
/*!
* \brief exportJson
*
* Returns a string of json data containing a list of all retroshare peers
* and groups. The format of the json data is as follows:
* \code{.json}
* {
* "gpg_ids" : [
* {
* "email" :
* "gpg_id" :
* "name" :
* "ssl_ids" : [
* {
* "id" :
* "location" :
* "pubkey" :
* "service_perm_flags" :
* }, ...
* ]
* "trustLvl":
* }, ...
* ],
* "groups" : [
* {
* "flag" :
* "name" :
* "peerIds" : [
* gpg_id, ...
* ]
* }
* ]
* }
* \endcode
* \return Json text of Retroshare peers.
*/
std::string exportJson();
private:
Json::Value readGrpInfoList(const std::list<RsGroupInfo> &group_info_list);
// ho ho ho I am seeing a _pattern!_
Json::Value readGPGIds(const std::list<RsPgpId> &gpg_ids);
Json::Value readGPGId(const RsPgpId &gpg_id);
Json::Value readSSLIds(const std::list<RsPeerId>& ssl_ids);
Json::Value readSSLId(const RsPeerId &ssl_id);
RsPeers* mPeers;
int export_count;
};
#endif // EXPORTMANAGER_H