Merge pull request #1323 from csoler/v0.6-ForumAdmin

V0.6 forum admin
This commit is contained in:
csoler 2018-09-11 15:17:33 +02:00 committed by GitHub
commit b138263878
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 666 additions and 367 deletions

View file

@ -111,7 +111,7 @@ public:
RsTlvKeySignatureSet signSet;
std::string mMsgName;
time_t mPublishTs;
uint32_t mMsgFlags; // Whats this for?
uint32_t mMsgFlags; // used by some services (e.g. by forums to store message moderation flags)
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
// normally READ / UNREAD flags. LOCAL Data.

View file

@ -115,8 +115,7 @@ namespace GXS_SERV {
/** START GXS Grp status flags **/
static const uint32_t GXS_GRP_STATUS_UNPROCESSED = 0x000000100;
static const uint32_t GXS_GRP_STATUS_UNREAD = 0x00000200;
static const uint32_t GXS_GRP_STATUS_UNREAD = 0x000000200;
/** END GXS Grp status flags **/
}

View file

@ -28,8 +28,15 @@
#include "retroshare/rstokenservice.h"
#include "retroshare/rsgxsifacehelper.h"
#include "serialiser/rstlvidset.h"
// Forum Service message flags, to be used in RsMsgMetaData::mMsgFlags
// Gxs imposes to use the first two bytes (lower bytes) of mMsgFlags for private forum flags, the upper bytes being used for internal GXS stuff.
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MASK = 0x0000000f ;
static const uint32_t RS_GXS_FORUM_MSG_FLAGS_MODERATED = 0x00000001 ;
#define IS_FORUM_MSG_MODERATION(flags) (flags & RS_GXS_FORUM_MSG_FLAGS_MODERATED)
/* The Main Interface Class - for information about your Peers */
class RsGxsForums;
@ -40,6 +47,11 @@ class RsGxsForumGroup
public:
RsGroupMetaData mMeta;
std::string mDescription;
// What's below is optional, and handled by the serialiser
RsTlvGxsIdSet mAdminList;
RsTlvGxsMsgIdSet mPinnedPosts;
};
class RsGxsForumMsg

View file

@ -138,7 +138,7 @@ struct RsMsgMetaData : RsSerializable
std::string mMsgName;
time_t mPublishTs;
/// the first 16 bits for service, last 16 for GXS
/// the lower 16 bits for service, upper 16 bits for GXS
uint32_t mMsgFlags;
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.

View file

@ -48,7 +48,16 @@ void RsGxsForumGroupItem::clear()
void RsGxsForumGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
{
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,mGroup.mDescription,"mGroup.Description");
// This is for backward compatibility: normally all members are serialized, but in the previous version, these members are missing.
if(j == RsGenericSerializer::DESERIALIZE && ctx.mOffset == ctx.mSize)
return ;
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,mGroup.mAdminList ,"admin_list" ) ;
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,mGroup.mPinnedPosts,"pinned_posts") ;
}
void RsGxsForumMsgItem::clear()
{
mMsg.mMsg.clear();

View file

@ -200,6 +200,7 @@ const uint16_t TLV_TYPE_RECOGNSET = 0x1024;
const uint16_t TLV_TYPE_GXSIDSET = 0x1025;
const uint16_t TLV_TYPE_GXSCIRCLEIDSET= 0x1026;
const uint16_t TLV_TYPE_NODEGROUPIDSET= 0x1027;
const uint16_t TLV_TYPE_GXSMSGIDSET = 0x1028;
const uint16_t TLV_TYPE_SERVICESET = 0x1030;

View file

@ -114,12 +114,13 @@ template<class ID_CLASS,uint32_t TLV_TYPE> class t_RsTlvIdSet: public RsTlvItem
std::set<ID_CLASS> ids ;
};
typedef t_RsTlvIdSet<RsPeerId, TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
typedef t_RsTlvIdSet<RsPgpId, TLV_TYPE_PGPIDSET> RsTlvPgpIdSet ;
typedef t_RsTlvIdSet<Sha1CheckSum, TLV_TYPE_HASHSET> RsTlvHashSet ;
typedef t_RsTlvIdSet<RsGxsId, TLV_TYPE_GXSIDSET> RsTlvGxsIdSet ;
typedef t_RsTlvIdSet<RsGxsCircleId,TLV_TYPE_GXSCIRCLEIDSET> RsTlvGxsCircleIdSet ;
typedef t_RsTlvIdSet<RsNodeGroupId,TLV_TYPE_NODEGROUPIDSET> RsTlvNodeGroupIdSet ;
typedef t_RsTlvIdSet<RsPeerId, TLV_TYPE_PEERSET> RsTlvPeerIdSet ;
typedef t_RsTlvIdSet<RsPgpId, TLV_TYPE_PGPIDSET> RsTlvPgpIdSet ;
typedef t_RsTlvIdSet<Sha1CheckSum, TLV_TYPE_HASHSET> RsTlvHashSet ;
typedef t_RsTlvIdSet<RsGxsId, TLV_TYPE_GXSIDSET> RsTlvGxsIdSet ;
typedef t_RsTlvIdSet<RsGxsMessageId,TLV_TYPE_GXSMSGIDSET> RsTlvGxsMsgIdSet ;
typedef t_RsTlvIdSet<RsGxsCircleId, TLV_TYPE_GXSCIRCLEIDSET> RsTlvGxsCircleIdSet ;
typedef t_RsTlvIdSet<RsNodeGroupId, TLV_TYPE_NODEGROUPIDSET> RsTlvNodeGroupIdSet ;
class RsTlvServiceIdSet: public RsTlvItem
{

View file

@ -26,8 +26,8 @@
RsPhoto *rsPhoto = NULL;
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
const uint32_t RsPhoto::FLAG_MSG_TYPE_MASK = 0x000f;
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_POST = 0x0001;
const uint32_t RsPhoto::FLAG_MSG_TYPE_PHOTO_COMMENT = 0x0002;