2012-11-29 17:48:28 -05:00
|
|
|
#ifndef RETROSHARE_GXSCIRCLES_INTERFACE_H
|
|
|
|
#define RETROSHARE_GXSCIRCLES_INTERFACE_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* libretroshare/src/retroshare: rsgxscircles.h
|
|
|
|
*
|
|
|
|
* RetroShare C++ Interface.
|
|
|
|
*
|
|
|
|
* Copyright 2012-2012 by Robert Fernie.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License Version 2.1 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
* USA.
|
|
|
|
*
|
|
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <string>
|
|
|
|
#include <list>
|
2013-02-28 16:58:38 -05:00
|
|
|
#include <set>
|
2012-11-29 17:48:28 -05:00
|
|
|
|
2013-03-06 18:33:23 -05:00
|
|
|
#include "retroshare/rstokenservice.h"
|
2013-02-28 16:58:38 -05:00
|
|
|
#include "retroshare/rsgxsifacehelper.h"
|
2012-11-29 17:48:28 -05:00
|
|
|
|
|
|
|
#include "retroshare/rsidentity.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* The Main Interface Class - for information about your Peers */
|
|
|
|
class RsGxsCircles;
|
|
|
|
extern RsGxsCircles *rsGxsCircles;
|
|
|
|
|
|
|
|
|
|
|
|
typedef std::string RsGxsCircleId;
|
|
|
|
typedef std::string RsPeerId; // SSL ID.
|
|
|
|
typedef std::string RsPgpId;
|
|
|
|
typedef std::string RsCircleInternalId;
|
|
|
|
|
2012-12-15 18:07:12 -05:00
|
|
|
#define GXS_CIRCLE_TYPE_PUBLIC 0x0001
|
|
|
|
#define GXS_CIRCLE_TYPE_EXTERNAL 0x0002
|
|
|
|
#define GXS_CIRCLE_TYPE_YOUREYESONLY 0x0003
|
2013-06-04 17:00:43 -04:00
|
|
|
#define GXS_CIRCLE_TYPE_LOCAL 0x0004
|
|
|
|
|
|
|
|
// A special one - used only by Circles themselves - meaning Circle ID == Group ID.
|
|
|
|
#define GXS_CIRCLE_TYPE_EXT_SELF 0x0005
|
2012-11-29 17:48:28 -05:00
|
|
|
|
|
|
|
/* Permissions is part of GroupMetaData
|
|
|
|
*/
|
|
|
|
|
|
|
|
class GxsPermissions
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
uint32_t mCircleType; // PUBLIC, EXTERNAL or YOUREYESONLY.
|
|
|
|
RsGxsCircleId mCircleId; // If EXTERNAL, otherwise Blank.
|
|
|
|
|
|
|
|
// BELOW IS NOT SERIALISED - BUT MUST BE STORED LOCALLY BY GXS. (If YOUREYESONLY)
|
|
|
|
RsPeerId mOriginator;
|
|
|
|
RsCircleInternalId mInternalCircle; // if Originator == ownId, otherwise blank.
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RsGxsCircleGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
|
|
|
|
|
2013-06-04 17:00:43 -04:00
|
|
|
std::list<RsPgpId> mLocalFriends;
|
2012-11-29 17:48:28 -05:00
|
|
|
std::list<RsGxsId> mInvitedMembers;
|
|
|
|
std::list<RsGxsCircleId> mSubCircles;
|
|
|
|
|
|
|
|
// Not Serialised.
|
|
|
|
// Internally inside rsCircles, this will be turned into:
|
|
|
|
// std::list<RsPeerId> mAllowedFriends;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsCircleMsg
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsMsgMetaData mMeta;
|
|
|
|
|
|
|
|
// Signature by user signifying that they want to be part of the group.
|
|
|
|
// maybe Phase 3.
|
2012-11-30 19:16:24 -05:00
|
|
|
std::string stuff;
|
2012-11-29 17:48:28 -05:00
|
|
|
};
|
|
|
|
|
2012-12-15 18:07:12 -05:00
|
|
|
class RsGxsCircleDetails
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGxsCircleId mCircleId;
|
|
|
|
std::string mCircleName;
|
2013-06-04 17:00:43 -04:00
|
|
|
|
|
|
|
uint32_t mCircleType;
|
|
|
|
bool mIsExternal;
|
|
|
|
|
2012-12-15 18:07:12 -05:00
|
|
|
std::set<RsGxsId> mUnknownPeers;
|
|
|
|
std::map<RsPgpId, std::list<RsGxsId> > mAllowedPeers;
|
|
|
|
};
|
|
|
|
|
2012-11-29 17:48:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-28 16:58:38 -05:00
|
|
|
class RsGxsCircles: public RsGxsIfaceHelper
|
2012-11-29 17:48:28 -05:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2013-02-28 16:58:38 -05:00
|
|
|
RsGxsCircles(RsGxsIface *gxs)
|
|
|
|
:RsGxsIfaceHelper(gxs) { return; }
|
2012-11-29 17:48:28 -05:00
|
|
|
virtual ~RsGxsCircles() { return; }
|
|
|
|
|
2012-12-15 18:07:12 -05:00
|
|
|
|
|
|
|
/* External Interface (Cached stuff) */
|
|
|
|
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
|
2013-06-04 17:00:43 -04:00
|
|
|
virtual bool getCircleExternalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
|
|
|
|
virtual bool getCirclePersonalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
|
2012-12-15 18:07:12 -05:00
|
|
|
|
|
|
|
/* standard load */
|
|
|
|
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsCircleGroup> &groups) = 0;
|
|
|
|
|
|
|
|
/* make new group */
|
|
|
|
virtual bool createGroup(uint32_t& token, RsGxsCircleGroup &group) = 0;
|
|
|
|
|
|
|
|
|
2012-11-29 17:48:28 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|