added new events for circles

This commit is contained in:
csoler 2019-12-12 00:00:51 +01:00
parent 27793627e3
commit eef5a5a8ef
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
10 changed files with 289 additions and 120 deletions

View file

@ -123,7 +123,7 @@ struct RsGxsCircleDetails : RsSerializable
{
RsGxsCircleDetails() :
mCircleType(static_cast<uint32_t>(RsGxsCircleType::EXTERNAL)),
mAmIAllowed(false) {}
mAmIAllowed(false),mAmIAdmin(false) {}
~RsGxsCircleDetails() override;
RsGxsCircleId mCircleId;
@ -136,6 +136,9 @@ struct RsGxsCircleDetails : RsSerializable
* list & subscribed list). */
bool mAmIAllowed;
/// true when we're an administrator of the circle group, meaning that we can add/remove members from the invitee list.
bool mAmIAdmin;
/// This crosses admin list and subscribed list
std::set<RsGxsId> mAllowedGxsIds;
std::set<RsPgpId> mAllowedNodes;
@ -152,12 +155,41 @@ struct RsGxsCircleDetails : RsSerializable
RS_SERIAL_PROCESS(mCircleType);
RS_SERIAL_PROCESS(mRestrictedCircleId);
RS_SERIAL_PROCESS(mAmIAllowed);
RS_SERIAL_PROCESS(mAmIAdmin);
RS_SERIAL_PROCESS(mAllowedGxsIds);
RS_SERIAL_PROCESS(mAllowedNodes);
RS_SERIAL_PROCESS(mSubscriptionFlags);
}
};
struct RsGxsCircleEvent: RsEvent
{
RsGxsCircleEvent()
: RsEvent(RsEventType::GXS_CIRCLES), mCircleEventType(UNKNOWN) {}
enum CircleEventType: uint8_t {
UNKNOWN = 0x00,
CIRCLE_MEMBERSHIP_REQUEST = 0x01, // mCircleId contains the circle id and mGxsId is the id requesting membership
CIRCLE_MEMBERSHIP_INVITE = 0x02, // mCircleId is the circle that invites me, and mGxsId is my own Id that is invited
CIRCLE_MEMBERSHIP_LEAVE = 0x03, // mCircleId contains the circle id and mGxsId is the id dropping membership
CIRCLE_MEMBERSHIP_JOIN = 0x04, // mCircleId contains the circle id and mGxsId is the id of the new member
CIRCLE_MEMBERSHIP_REVOQUED= 0x05, // mCircleId contains the circle id and mGxsId is the id that was revoqued by admin
};
CircleEventType mCircleEventType;
RsGxsCircleId mCircleId;
RsGxsId mGxsId;
///* @see RsEvent @see RsSerializable
void serial_process( RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx) override
{
RsEvent::serial_process(j, ctx);
RS_SERIAL_PROCESS(mCircleEventType);
RS_SERIAL_PROCESS(mCircleId);
RS_SERIAL_PROCESS(mGxsId);
}
};
class RsGxsCircles: public RsGxsIfaceHelper
{
public:
@ -243,6 +275,17 @@ public:
*/
virtual bool getCircleRequests( const RsGxsGroupId& circleId,
std::vector<RsGxsCircleMsg>& requests ) = 0;
/**
* @brief Get specific circle request
* @jsonapi{development}
* @param[in] circleId id of the circle of which the requests are requested
* @param[in] msgId id of the request
* @param[out] msg storage for the circle request
* @return false if something failed, true otherwhise
*/
virtual bool getCircleRequest(const RsGxsGroupId& circleId,
const RsGxsMessageId& msgId,
RsGxsCircleMsg& msg) =0;
/**
* @brief Invite identities to circle