mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
changed internal storage of groups of friend nodes so as to use an abstract ID instead of a string (phase 1 of local circles)
This commit is contained in:
parent
9f7ef8b46b
commit
4ee9effc4e
12 changed files with 420 additions and 349 deletions
|
@ -73,14 +73,13 @@ template<uint32_t ID_SIZE_IN_BYTES,bool UPPER_CASE,uint32_t UNIQUE_IDENTIFIER> c
|
|||
memcpy(bytes,id.toByteArray(),ID_SIZE_IN_BYTES) ;
|
||||
}
|
||||
|
||||
// Random initialization. Can be useful for testing.
|
||||
// Random initialization. Can be useful for testing and to generate new ids.
|
||||
//
|
||||
static t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> random()
|
||||
{
|
||||
t_RsGenericIdType<ID_SIZE_IN_BYTES,UPPER_CASE,UNIQUE_IDENTIFIER> id ;
|
||||
|
||||
for(uint32_t i=0;i<ID_SIZE_IN_BYTES;++i)
|
||||
id.bytes[i] = RSRandom::random_u32() & 0xff ;
|
||||
RSRandom::random_bytes(id.bytes,ID_SIZE_IN_BYTES) ;
|
||||
|
||||
return id ;
|
||||
}
|
||||
|
@ -220,6 +219,7 @@ static const uint32_t RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE = 0x0008 ;
|
|||
static const uint32_t RS_GENERIC_ID_GROUTER_ID_TYPE = 0x0009 ;
|
||||
static const uint32_t RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE = 0x0010 ;
|
||||
static const uint32_t RS_GENERIC_ID_GXS_DISTANT_CHAT_ID_TYPE = 0x0011 ;
|
||||
static const uint32_t RS_GENERIC_ID_NODE_GROUP_ID_TYPE = 0x0012 ;
|
||||
|
||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_SSL_ID_TYPE> SSLIdType ;
|
||||
typedef t_RsGenericIdType< PGP_KEY_ID_SIZE , true, RS_GENERIC_ID_PGP_ID_TYPE> PGPIdType ;
|
||||
|
@ -231,4 +231,5 @@ typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_I
|
|||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_GXS_CIRCLE_ID_TYPE > GXSCircleId ;
|
||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_TUNNEL_ID_TYPE > GXSTunnelId ;
|
||||
typedef t_RsGenericIdType< SSL_ID_SIZE , false, RS_GENERIC_ID_GXS_DISTANT_CHAT_ID_TYPE > DistantChatPeerId ;
|
||||
typedef t_RsGenericIdType< CERT_SIGN_LEN , false, RS_GENERIC_ID_NODE_GROUP_ID_TYPE > RsNodeGroupId ;
|
||||
|
||||
|
|
|
@ -185,11 +185,17 @@ const uint32_t RS_NET_PROXY_STATUS_OK = 0x0001 ;
|
|||
|
||||
|
||||
/* Groups */
|
||||
#define RS_GROUP_ID_FRIENDS "Friends"
|
||||
#define RS_GROUP_ID_FAMILY "Family"
|
||||
#define RS_GROUP_ID_COWORKERS "Co-Workers"
|
||||
#define RS_GROUP_ID_OTHERS "Other Contacts"
|
||||
#define RS_GROUP_ID_FAVORITES "Favorites"
|
||||
static const RsNodeGroupId RS_GROUP_ID_FRIENDS ("00000000000000000000000000000001");
|
||||
static const RsNodeGroupId RS_GROUP_ID_FAMILY ("00000000000000000000000000000002");
|
||||
static const RsNodeGroupId RS_GROUP_ID_COWORKERS ("00000000000000000000000000000003");
|
||||
static const RsNodeGroupId RS_GROUP_ID_OTHERS ("00000000000000000000000000000004");
|
||||
static const RsNodeGroupId RS_GROUP_ID_FAVORITES ("00000000000000000000000000000005");
|
||||
|
||||
#define RS_GROUP_DEFAULT_NAME_FRIENDS "Friends"
|
||||
#define RS_GROUP_DEFAULT_NAME_FAMILY "Family"
|
||||
#define RS_GROUP_DEFAULT_NAME_COWORKERS "Co-Workers"
|
||||
#define RS_GROUP_DEFAULT_NAME_OTHERS "Other Contacts"
|
||||
#define RS_GROUP_DEFAULT_NAME_FAVORITES "Favorites"
|
||||
|
||||
const uint32_t RS_GROUP_FLAG_STANDARD = 0x0001;
|
||||
|
||||
|
@ -295,7 +301,7 @@ class RsGroupInfo
|
|||
public:
|
||||
RsGroupInfo();
|
||||
|
||||
std::string id;
|
||||
RsNodeGroupId id;
|
||||
std::string name;
|
||||
uint32_t flag;
|
||||
|
||||
|
@ -399,14 +405,14 @@ public:
|
|||
virtual bool trustGPGCertificate(const RsPgpId &gpg_id, uint32_t trustlvl) = 0;
|
||||
|
||||
/* Group Stuff */
|
||||
virtual bool addGroup(RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool editGroup(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool removeGroup(const std::string &groupId) = 0;
|
||||
virtual bool getGroupInfo(const std::string &groupId, RsGroupInfo &groupInfo) = 0;
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList) = 0;
|
||||
virtual bool addGroup(RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool editGroup(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool removeGroup(const RsNodeGroupId& groupId) = 0;
|
||||
virtual bool getGroupInfo(const RsNodeGroupId& groupId, RsGroupInfo& groupInfo) = 0;
|
||||
virtual bool getGroupInfoList(std::list<RsGroupInfo>& groupInfoList) = 0;
|
||||
// groupId == "" && assign == false -> remove from all groups
|
||||
virtual bool assignPeerToGroup(const std::string &groupId, const RsPgpId& peerId, bool assign) = 0;
|
||||
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<RsPgpId> &peerIds, bool assign) = 0;
|
||||
virtual bool assignPeerToGroup(const RsNodeGroupId& groupId, const RsPgpId& peerId, bool assign) = 0;
|
||||
virtual bool assignPeersToGroup(const RsNodeGroupId& groupId, const std::list<RsPgpId>& peerIds, bool assign) = 0;
|
||||
|
||||
/* Group sharing permission */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue