merging gxs_phase2 branch

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6401 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2013-06-04 21:00:43 +00:00
parent 1150366913
commit 325fa4f222
116 changed files with 6050 additions and 3596 deletions

View file

@ -50,6 +50,10 @@ typedef std::string RsCircleInternalId;
#define GXS_CIRCLE_TYPE_PUBLIC 0x0001
#define GXS_CIRCLE_TYPE_EXTERNAL 0x0002
#define GXS_CIRCLE_TYPE_YOUREYESONLY 0x0003
#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
/* Permissions is part of GroupMetaData
*/
@ -71,6 +75,7 @@ class RsGxsCircleGroup
public:
RsGroupMetaData mMeta; // includes GxsPermissions, for control of group distribution.
std::list<RsPgpId> mLocalFriends;
std::list<RsGxsId> mInvitedMembers;
std::list<RsGxsCircleId> mSubCircles;
@ -94,6 +99,10 @@ class RsGxsCircleDetails
public:
RsGxsCircleId mCircleId;
std::string mCircleName;
uint32_t mCircleType;
bool mIsExternal;
std::set<RsGxsId> mUnknownPeers;
std::map<RsPgpId, std::list<RsGxsId> > mAllowedPeers;
};
@ -112,7 +121,8 @@ virtual ~RsGxsCircles() { return; }
/* External Interface (Cached stuff) */
virtual bool getCircleDetails(const RsGxsCircleId &id, RsGxsCircleDetails &details) = 0;
virtual bool getCircleIdList(std::list<RsGxsCircleId> &circleIds) = 0;
virtual bool getCircleExternalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
virtual bool getCirclePersonalIdList(std::list<RsGxsCircleId> &circleIds) = 0;
/* standard load */
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsCircleGroup> &groups) = 0;

View file

@ -69,6 +69,21 @@ static void release(void *data);
#define GXS_VOTE_DOWN 0x0001
#define GXS_VOTE_UP 0x0002
// Status Flags to indicate Voting....
// All Services that use the Comment service must not Use This space.
namespace GXS_SERV {
/* Msg Vote Status */
static const uint32_t GXS_MSG_STATUS_GXSCOMMENT_MASK = 0x000f0000;
static const uint32_t GXS_MSG_STATUS_VOTE_MASK = 0x00030000;
static const uint32_t GXS_MSG_STATUS_VOTE_UP = 0x00010000;
static const uint32_t GXS_MSG_STATUS_VOTE_DOWN = 0x00020000;
}
class RsGxsVote
{
public:

View file

@ -89,15 +89,23 @@ namespace GXS_SERV {
/** START GXS Msg status flags **/
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x0000001;
/*!
* Two lower bytes are reserved for Generic STATUS Flags listed here.
* Services are free to use the two upper bytes. (16 flags).
*
* NOTE: RsGxsCommentService uses 0x000f0000.
*/
static const uint32_t GXS_MSG_STATUS_GEN_MASK = 0x0000ffff;
static const uint32_t GXS_MSG_STATUS_UNREAD = 0x000002;
static const uint32_t GXS_MSG_STATUS_UNPROCESSED = 0x00000001;
static const uint32_t GXS_MSG_STATUS_READ = 0x000004;
static const uint32_t GXS_MSG_STATUS_UNREAD = 0x00000002;
static const uint32_t GXS_MSG_STATUS_KEEP = 0x000008;
static const uint32_t GXS_MSG_STATUS_READ = 0x00000004;
static const uint32_t GXS_MSG_STATUS_DELETE = 0x0000020;
static const uint32_t GXS_MSG_STATUS_KEEP = 0x00000008;
static const uint32_t GXS_MSG_STATUS_DELETE = 0x000000020;
/** END GXS Msg status flags **/

View file

@ -93,7 +93,7 @@ public:
/*!
* The msg changed. \n
* class can reimplement to use to tailor
* class can be reimplemented to use to tailor
* the msg actually set for ui notification.
* If receivedChanges is not passed RsGxsNotify changes
* this function does nothing

View file

@ -10,6 +10,9 @@
#include <map>
#include <vector>
#include <string>
#include <inttypes.h>
typedef std::string RsGxsGroupId;
typedef std::string RsGxsMessageId;
@ -60,6 +63,7 @@ public:
// for circles
std::string mCircleId;
uint32_t mCircleType;
uint32_t mAuthenFlags;
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.

View file

@ -18,8 +18,11 @@ typedef std::map<RsGxsGrpMsgIdPair, std::vector<RsMsgMetaData> > GxsMsgRelatedMe
class RsGxsNotify
{
public:
RsGxsNotify(){ return; }
enum NotifyType { TYPE_PUBLISH, TYPE_RECEIVE, TYPE_PROCESSED };
virtual ~RsGxsNotify() {return; }
virtual NotifyType getType() = 0;
};
@ -30,7 +33,11 @@ public:
class RsGxsGroupChange : public RsGxsNotify
{
public:
RsGxsGroupChange(NotifyType type) : NOTIFY_TYPE(type) {}
std::list<RsGxsGroupId> mGrpIdList;
NotifyType getType(){ return NOTIFY_TYPE;}
private:
const NotifyType NOTIFY_TYPE;
};
/*!
@ -40,7 +47,11 @@ public:
class RsGxsMsgChange : public RsGxsNotify
{
public:
RsGxsMsgChange(NotifyType type) : NOTIFY_TYPE(type) {}
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgChangeMap;
NotifyType getType(){ return NOTIFY_TYPE;}
private:
const NotifyType NOTIFY_TYPE;
};

View file

@ -100,14 +100,20 @@ class RsGxsIdOpinion
//std::string mPeerId; (mAuthorId) ???
uint32_t mOpinion;
std::string mComment;
uint32_t mReputation;
/* these convert To/From uint32 to expected scale. */
int getOpinion();
int getReputation();
int setOpinion(int op);
int setReputation(int rep);
// NOT SERIALISED YET!
double mReputation;
//int mRating;
//int mPeersRating;
//std::string mComment;
};
@ -230,6 +236,7 @@ virtual bool createIdentity(uint32_t& token, RsIdentityParameters &params) = 0;
*/
virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsIdGroup> &groups) = 0;
virtual bool getMsgData(const uint32_t &token, std::vector<RsGxsIdOpinion> &opinions) = 0;
};

View file

@ -75,8 +75,8 @@ class RsPosted : public RsGxsIfaceHelper, public RsGxsCommentService
enum RankType {TopRankType, HotRankType, NewRankType };
static const uint32_t FLAG_MSGTYPE_POST;
static const uint32_t FLAG_MSGTYPE_MASK;
//static const uint32_t FLAG_MSGTYPE_POST;
//static const uint32_t FLAG_MSGTYPE_MASK;
RsPosted(RsGxsIface* gxs) : RsGxsIfaceHelper(gxs) { return; }
virtual ~RsPosted() { return; }
@ -87,15 +87,6 @@ virtual bool getGroupData(const uint32_t &token, std::vector<RsPostedGroup> &gro
virtual bool getPostData(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
virtual bool getRelatedPosts(const uint32_t &token, std::vector<RsPostedPost> &posts) = 0;
// SPECIAL RANKING FNS.
virtual bool requestPostRankings(uint32_t &token, const RankType &rType, uint32_t count, uint32_t page_no, const RsGxsGroupId &groupId) = 0;
virtual bool getPostRanking(const uint32_t &token, std::vector<RsPostedPost> &msgs) = 0;
//virtual bool getPostRanking(const uint32_t& token, std::vector<RsPostedPost> &ranking) = 0;
/* From RsGxsCommentService */
//virtual bool getCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
//virtual bool getRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) = 0;
@ -108,25 +99,6 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
virtual bool createGroup(uint32_t &token, RsPostedGroup &group) = 0;
virtual bool createPost(uint32_t &token, RsPostedPost &post) = 0;
//virtual bool retrieveScores(const std::string& serviceString, uint32_t& upVotes, uint32_t& downVotes, uint32_t& nComments) const = 0;
// Special Ranking Request.
/*!
* Makes request for posts of a topic
* @param token
* @param rType
* @param groupId
*/
//virtual bool requestPostRankings(uint32_t &token, const RankType& rType, const RsGxsGroupId& groupId) = 0;
/*!
* Makes request for ranking of comments for a post
* @param token
* @param rType type of ranking to collect
* @param msgId message id of post as groupid-messageid pair
*/
//virtual bool requestCommentRankings(uint32_t &token, const RankType& rType, const RsGxsGrpMsgIdPair& msgId) = 0;
};
@ -136,22 +108,28 @@ class RsPostedPost
public:
RsPostedPost()
{
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
//mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
mUpVotes = 0;
mDownVotes = 0;
mComments = 0;
mHaveVoted = false;
return;
}
bool calculateScores(time_t ref_time);
RsMsgMetaData mMeta;
std::string mLink;
std::string mNotes;
bool mHaveVoted;
// Calculated.
uint32_t mUpVotes;
uint32_t mDownVotes;
uint32_t mComments;
// and Calculated Scores:???
double mHotScore;
double mTopScore;