* Refinement of new Cache Interface:

- Defined expected parameters for GxsGroups (see comments in rsidentity.h)
	- Added Various #defines for Groups / Msgs (again in rsidentity.h)
	- Converted new Group / new Msg into async "token" calls, returing MetaData.
	- Refined Grp/Msg Status Flags... similarly to how Forums used them...
		Expect UNREAD & UNPROCESSED flags to be set for a new msg, 
		and UPDATED flag to be set for the corresponding group. 
		There is flexibility for services to add their own flags too.
	- removed groupsChanged(). This can alternatively be implemented using.
		getGroupList(opts.Status == UPDATED)...
	- refined SubscribeFlags in a similar manner.
	- Added "ServiceString" to Group/Msg MetaData. This is freeform cache
	  storage for service to use... currently p3Posted uses it to count Votes.
	- Added MsgStatus & SubscribeFlag filtering to Cache Requests.
	- Implemented these filters in GxsDataProxy (no efficient yet!)

 * Cleaned up all 6 new Cache Services to conform to new interface.
 * Removed old interface code that was #ifdef'd out.

 * Implemented Basic Ranking algorithms for p3posted:
	- Background process to process new votes/comments.
	- getRanking(token) interface call.
	- Intercept StatusRequests, etc to hide internal data requests.
	- While the basic code is complete, it needs much testing / tweaking.
		- Should shift work to a seperate thread.
		- Comment Ranking has still to be done.
		- Interfacing with GUI not yet attempted.




git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5276 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-07-06 23:14:18 +00:00
parent 081b59ee1a
commit 8387c538f1
20 changed files with 1793 additions and 514 deletions

View File

@ -82,47 +82,12 @@ class RsForumsV2: public RsTokenService
RsForumsV2() { return; }
virtual ~RsForumsV2() { return; }
/* changed? */
virtual bool updated() = 0;
/* Data Requests */
//virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) = 0;
/* Generic Lists */
//virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds) = 0;
//virtual bool getMsgList( const uint32_t &token, std::list<std::string> &msgIds) = 0;
/* Generic Summary */
//virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) = 0;
//virtual bool getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) = 0;
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group) = 0;
virtual bool getMsgData(const uint32_t &token, RsForumV2Msg &msg) = 0;
/* FUNCTIONS THAT HAVE BEEN COPIED FROM THE ORIGINAL FORUMS....
* -> TODO, Split into generic and specific functions!
*/
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
//virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
// Get Message Status - is retrived via MessageSummary.
//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) = 0;
//
//virtual bool groupSubscribe(const std::string &groupId, bool subscribe) = 0;
//virtual bool groupRestoreKeys(const std::string &groupId) = 0;
//virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers) = 0;
// ONES THAT WE ARE NOT IMPLEMENTING. (YET!)
//virtual bool getMessageStatus(const std::string& fId, const std::string& mId, uint32_t& status) = 0;
// THINK WE CAN GENERALISE THIS TO: a list function, and you can just count the list entries...
@ -130,10 +95,9 @@ virtual bool getMsgData(const uint32_t &token, RsForumV2Msg &msg) = 0;
//virtual bool getMessageCount(const std::string &groupId, unsigned int &newCount, unsigned int &unreadCount) = 0;
/* details are updated in group - to choose GroupID */
virtual bool createGroup(RsForumV2Group &group) = 0;
virtual bool createMsg(RsForumV2Msg &msg) = 0;
virtual bool createGroup(uint32_t &token, RsForumV2Group &group, bool isNew) = 0;
virtual bool createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew) = 0;
};

View File

@ -49,6 +49,12 @@
#define RS_TOKREQOPT_MSG_AUTHOR 0x0040 // MSGLIST: Messages from this AuthorId
// Status Filtering... should it be a different Option Field.
#define RS_TOKREQOPT_GROUP_UPDATED 0x0100 // GROUPLIST: Groups that have been updated.
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
#define RS_TOKREQOPT_MSG_UPDATED 0x0200 // MSGLIST: Msg that have been updated from specified groups.
// Read Status.
#define RS_TOKREQOPT_READ 0x0001
@ -60,27 +66,148 @@
// TEMP FLAGS... TO FIX.
#define RSGXS_MSG_STATUS_MASK 0x000f
#define RSGXS_MSG_STATUS_READ 0x0001
#define RSGXS_MSG_STATUS_UNREAD_BY_USER 0x0002
#define RSGXS_MSG_STATUS_PROCESSED 0x0004 // By the Service.
class RsTokReqOptions
{
public:
RsTokReqOptions() { mOptions = 0; mBefore = 0; mAfter = 0; }
RsTokReqOptions()
{
mOptions = 0;
mStatusFilter = 0; mStatusMask = 0; mSubscribeFilter = 0;
mBefore = 0; mAfter = 0;
}
uint32_t mOptions;
// Request specific matches with Group / Message Status.
// Should be usable with any Options... applied afterwards.
uint32_t mStatusFilter;
uint32_t mStatusMask;
uint32_t mSubscribeFilter; // Only for Groups.
// Time range... again applied after Options.
time_t mBefore;
time_t mAfter;
};
/*********************************************************
* Documentation for Groups Definitions.
*
* A Group is defined by:
* - TWO RSA Keys. (Admin Key & Publish Key)
* - Publish TS: Used to select the latest definition.
*
* - Operating Mode:
* - Circle (Public, External, Private).
* - Publish Mode: Encrypted / All-Signed / Only ThreadHead / None Required.
* - AuthorId: GPG Required / Any Required / Only if no Publish Signature.
*
* - Description:
* - Name & Description.
* - Optional AuthorId.
*
* Most of this information is contained inside the GroupMetaData.
* except for Actual Admin / Publish Keys, which are maintained internally.
*
*******
* - Group Definition must be signed by Admin Key, otherwise invalid.
* - Circle Definition controls distribution of Group and Messages, see section on this for more details.
* - Public parts of Keys are distributed with Definition.
* - Private parts can be distributed to select people via alternative channels.
* - A Message Requires at least one signature: publish or Author. This signature will be used as MsgId.
*
* Groups will operate in the following modes:
* 1) Public Forum: PublishMode = None Required, AuthorId: Required.
* 2) Closed Forum: PublishMode = All-Signed, AuthorId: Required.
* 3) Private Forum: PublishMode = Encrypted, AuthorId: Required.
*
* 4) Anon Channel: PublishMode = All-Signed, AuthorId: None.
* 5) Anon Channel with Comments: PublishMode = Only ThreadHead, AuthorId: If No Publish Signature.
* 6) Private Channel: PublishMode = Encrypted.
*
* 7) Personal Photos - with comments: PublishMode = Only ThreadHead, AuthorId: Required.
* 8) Personal Photos - no comments: PublishMode = All-Signed, AuthorId: Required.
*
* 9 ) Public Wiki: PublishMode = None Required, AuthorId: Required.
* 10) Closed Wiki: PublishMode = All-Signed, AuthorId: Required.
* 11) Private Wiki: PublishMode = Encrypted, AuthorId: Required.
*
* 12) Twitter: PublishMode = Only ThreadHead, AuthorId: Required.
*
* 13) Posted: PublishMode = None Required, AuthorId: Required.
*
*
******
*
* Additionally to this information. The MetaData also contains several fields which can
* be used to store local information for the benefit of the service.
*
* In Particular: MsgStatus & GroupStatus inform the service if the user has read the message or if anything has changed.
*
***/
// Control of Publish Signatures.
#define RSGXS_GROUP_SIGN_PUBLISH_MASK 0x000000ff
#define RSGXS_GROUP_SIGN_PUBLISH_ENCRYPTED 0x00000001
#define RSGXS_GROUP_SIGN_PUBLISH_ALLSIGNED 0x00000002
#define RSGXS_GROUP_SIGN_PUBLISH_THREADHEAD 0x00000004
#define RSGXS_GROUP_SIGN_PUBLISH_NONEREQ 0x00000008
// Author Signature.
#define RSGXS_GROUP_SIGN_AUTHOR_MASK 0x0000ff00
#define RSGXS_GROUP_SIGN_AUTHOR_GPG 0x00000100
#define RSGXS_GROUP_SIGN_AUTHOR_REQUIRED 0x00000200
#define RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN 0x00000400
#define RSGXS_GROUP_SIGN_AUTHOR_NONE 0x00000800
// NB: That one signature is required...
// so some combinations are not possible. e.g.
// SIGN_PUBLISH_NONEREQ && SIGN_AUTHOR_NONE is not allowed.
// SIGN_PUBLISH_THREADHEAD && SIGN_AUTHOR_NONE is also invalid.
#define RSGXS_GROUP_SIGN_RESERVED_MASK 0xffff0000
// STATUS FLAGS: There is space here for Service specific flags - if they so desire.
//
// Msgs: UNREAD_BY_USER & PROCESSED are useful.
// Groups: NEW_MESSAGES & GROUP_UPDATED.
#define RSGXS_MSG_STATUS_MASK 0x0000000f
#define RSGXS_MSG_STATUS_READ 0x00000001 // New or Not New
#define RSGXS_MSG_STATUS_UNREAD_BY_USER 0x00000002
#define RSGXS_MSG_STATUS_UNPROCESSED 0x00000004 // By the Service.
#define RSGXS_MSG_STATUS_SERVICE_MASK 0xffff0000
#define RSGXS_GROUP_STATUS_MASK 0x0000000f
#define RSGXS_GROUP_STATUS_UPDATED 0x00000001
#define RSGXS_GROUP_STATUS_NEWGROUP 0x00000002
#define RSGXS_GROUP_STATUS_SERVICE_MASK 0xffff0000
// Subscription Flags. (LOCAL)
#define RSGXS_GROUP_SUBSCRIBE_MASK 0x0000000f
#define RSGXS_GROUP_SUBSCRIBE_ADMIN 0x00000001
#define RSGXS_GROUP_SUBSCRIBE_PUBLISH 0x00000002
#define RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED 0x00000004
#define RSGXS_GROUP_SUBSCRIBE_MONITOR 0x00000008
// Some MACROS for EASE OF USE. (USED BY FORUMSV2 At the moment.
#define IS_MSG_UNREAD(status) ((status & RSGXS_MSG_STATUS_READ) == 0 || (status & RSGXS_MSG_STATUS_UNREAD_BY_USER))
#define IS_GROUP_ADMIN(subscribeFlags) (subscribeFlags & RSGXS_GROUP_SUBSCRIBE_ADMIN)
#define IS_GROUP_SUBSCRIBED(subscribeFlags) (subscribeFlags & (RSGXS_GROUP_SUBSCRIBE_ADMIN | RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED))
#define RSGXS_MAX_SERVICE_STRING 200 // Sensible limit for dbase usage.
class RsGroupMetaData
{
@ -89,6 +216,7 @@ class RsGroupMetaData
RsGroupMetaData()
{
mGroupFlags = 0;
mSignFlags = 0;
mSubscribeFlags = 0;
mPop = 0;
@ -101,7 +229,8 @@ class RsGroupMetaData
std::string mGroupId;
std::string mGroupName;
uint32_t mGroupFlags;
uint32_t mGroupFlags; // Service Specific Options ????
uint32_t mSignFlags; // Combination of RSGXS_GROUP_SIGN_PUBLISH_MASK & RSGXS_GROUP_SIGN_AUTHOR_MASK.
time_t mPublishTs; // Mandatory.
std::string mAuthorId; // Optional.
@ -116,6 +245,7 @@ class RsGroupMetaData
uint32_t mGroupStatus;
std::string mServiceString; // Service Specific Free-Form extra storage.
};
@ -145,13 +275,15 @@ class RsMsgMetaData
std::string mMsgName;
time_t mPublishTs;
uint32_t mMsgFlags; // Whats this for?
uint32_t mMsgFlags; // Whats this for? (Optional Service Specific - e.g. flag MsgType)
// BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
// normally READ / UNREAD flags. LOCAL Data.
uint32_t mMsgStatus;
time_t mChildTs;
std::string mServiceString; // Service Specific Free-Form extra storage.
};
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta);
@ -164,6 +296,9 @@ class RsTokenService
RsTokenService() { return; }
virtual ~RsTokenService() { return; }
/* changed? */
virtual bool updated() = 0;
/* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
@ -190,14 +325,21 @@ virtual bool cancelRequest(const uint32_t &token) = 0;
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
// Groups Changed is now part of requestGroupInfo request.
//virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
// Get Message Status - is retrived via MessageSummary.
// Message/Group Status - is retrived via requests...
// These operations could have a token, but for the moment we are going to assume
// they are async and always succeed - (or fail silently).
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) = 0;
virtual bool setGroupStatus(const std::string &grpId, const uint32_t status, const uint32_t statusMask) = 0;
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe) = 0;
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) = 0;
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str) = 0;
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str) = 0;
// (FUTURE WORK).
virtual bool groupRestoreKeys(const std::string &groupId) = 0;
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers) = 0;
@ -305,10 +447,6 @@ class RsIdentity: public RsTokenService
virtual ~RsIdentity() { return; }
/* changed? */
virtual bool updated() = 0;
/* INCLUDES INTERFACE FROM RS TOKEN SERVICE */
//////////////////////////////////////////////////////////////////////////////
@ -317,10 +455,8 @@ virtual bool updated() = 0;
virtual bool getGroupData(const uint32_t &token, RsIdGroup &group) = 0;
virtual bool getMsgData(const uint32_t &token, RsIdMsg &msg) = 0;
virtual bool createGroup(RsIdGroup &group) = 0;
virtual bool createMsg(RsIdMsg &msg) = 0;
virtual bool createGroup(uint32_t &token, RsIdGroup &group, bool isNew) = 0;
virtual bool createMsg(uint32_t &token, RsIdMsg &msg, bool isNew) = 0;
/* In the Identity System - You don't access the Messages Directly.
* as they represent idividuals opinions....

View File

@ -166,54 +166,12 @@ class RsPhoto: public RsTokenService
RsPhoto() { return; }
virtual ~RsPhoto() { return; }
/* changed? */
virtual bool updated() = 0;
/* Data Requests */
//virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) = 0;
/* Generic Lists */
//virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds) = 0;
//virtual bool getMsgList( const uint32_t &token, std::list<std::string> &msgIds) = 0;
/* Generic Summary */
//virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) = 0;
//virtual bool getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) = 0;
/* Actual Data -> specific to Interface */
/* Poll */
//virtual uint32_t requestStatus(const uint32_t token) = 0;
/* Cancel Request */
//virtual bool cancelRequest(const uint32_t &token) = 0;
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
//virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
// Get Message Status - is retrived via MessageSummary.
//virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) = 0;
//
//virtual bool groupSubscribe(const std::string &groupId, bool subscribe) = 0;
//virtual bool groupRestoreKeys(const std::string &groupId) = 0;
//virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers) = 0;
/* Specific Service Data */
virtual bool getAlbum(const uint32_t &token, RsPhotoAlbum &album) = 0;
virtual bool getPhoto(const uint32_t &token, RsPhotoPhoto &photo) = 0;
/* details are updated in album - to choose Album ID, and storage path */
virtual bool submitAlbumDetails(RsPhotoAlbum &album, bool isNew) = 0;
virtual bool submitPhoto(RsPhotoPhoto &photo, bool isNew) = 0;
virtual bool submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew) = 0;
virtual bool submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew) = 0;
};

View File

@ -53,29 +53,52 @@ class RsPostedMsg
uint32_t postedType;
};
#define RSPOSTED_MSG_POST 1
#define RSPOSTED_MSG_VOTE 1
#define RSPOSTED_MSG_COMMENT 1
#define RSPOSTED_MSGTYPE_POST 0x0001
#define RSPOSTED_MSGTYPE_VOTE 0x0002
#define RSPOSTED_MSGTYPE_COMMENT 0x0004
#define RSPOSTED_PERIOD_YEAR 1
#define RSPOSTED_PERIOD_MONTH 2
#define RSPOSTED_PERIOD_WEEK 3
#define RSPOSTED_PERIOD_DAY 4
#define RSPOSTED_PERIOD_HOUR 5
#define RSPOSTED_VIEWMODE_LATEST 1
#define RSPOSTED_VIEWMODE_TOP 2
#define RSPOSTED_VIEWMODE_HOT 3
#define RSPOSTED_VIEWMODE_COMMENTS 4
class RsPostedPost: public RsPostedMsg
{
public:
RsPostedPost(): RsPostedMsg(RSPOSTED_MSG_POST) { return; }
RsPostedPost(): RsPostedMsg(RSPOSTED_MSGTYPE_POST)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_POST;
return;
}
};
class RsPostedVote: public RsPostedMsg
{
public:
RsPostedVote(): RsPostedMsg(RSPOSTED_MSG_VOTE) { return; }
RsPostedVote(): RsPostedMsg(RSPOSTED_MSGTYPE_VOTE)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_VOTE;
return;
}
};
class RsPostedComment: public RsPostedMsg
{
public:
RsPostedComment(): RsPostedMsg(RSPOSTED_MSG_COMMENT) { return; }
RsPostedComment(): RsPostedMsg(RSPOSTED_MSGTYPE_COMMENT)
{
mMeta.mMsgFlags = RSPOSTED_MSGTYPE_COMMENT;
return;
}
};
@ -92,19 +115,15 @@ class RsPosted: public RsTokenService
RsPosted() { return; }
virtual ~RsPosted() { return; }
/* changed? */
virtual bool updated() = 0;
/* Specific Service Data */
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;
virtual bool getPost(const uint32_t &token, RsPostedPost &post) = 0;
virtual bool getComment(const uint32_t &token, RsPostedComment &comment) = 0;
/* details are updated in album - to choose Album ID, and storage path */
virtual bool submitGroup(RsPostedGroup &group, bool isNew) = 0;
virtual bool submitPost(RsPostedPost &post, bool isNew) = 0;
virtual bool submitVote(RsPostedVote &vote, bool isNew) = 0;
virtual bool submitComment(RsPostedComment &comment, bool isNew) = 0;
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group, bool isNew) = 0;
virtual bool submitPost(uint32_t &token, RsPostedPost &post, bool isNew) = 0;
virtual bool submitVote(uint32_t &token, RsPostedVote &vote, bool isNew) = 0;
virtual bool submitComment(uint32_t &token, RsPostedComment &comment, bool isNew) = 0;
};

View File

@ -91,42 +91,12 @@ class RsWiki: public RsTokenService
RsWiki() { return; }
virtual ~RsWiki() { return; }
/* changed? */
virtual bool updated() = 0;
/* Data Requests (from RsTokenService) */
//virtual bool requestGroupList( uint32_t &token, const RsTokReqOptions &opts) = 0;
//virtual bool requestMsgList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgRelatedList(uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) = 0;
//virtual bool requestGroupData( uint32_t &token, const std::list<std::string> &groupIds) = 0;
//virtual bool requestMsgData( uint32_t &token, const std::list<std::string> &msgIds) = 0;
/* Poll */
//virtual uint32_t requestStatus(const uint32_t token) = 0;
/* Generic List Data */
virtual bool getGroupList(const uint32_t &token, std::list<std::string> &groupIds) = 0;
virtual bool getMsgList(const uint32_t &token, std::list<std::string> &msgIds) = 0;
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsWikiGroup &group) = 0;
virtual bool getMsgData(const uint32_t &token, RsWikiPage &page) = 0;
/* details are updated in group - to choose GroupID */
virtual bool createGroup(RsWikiGroup &group) = 0;
virtual bool createPage(RsWikiPage &page) = 0;
#if 0
virtual bool getGroupList(std::list<std::string> &groups) = 0;
virtual bool getGroup(const std::string &groupid, RsWikiGroup &group) = 0;
virtual bool getPage(const std::string &pageid, RsWikiPage &page) = 0;
virtual bool getPageVersions(const std::string &origPageId, std::list<std::string> &pages) = 0;
virtual bool getOrigPageList(const std::string &groupid, std::list<std::string> &pageIds) = 0;
virtual bool getLatestPage(const std::string &origPageId, std::string &pageId) = 0;
#endif
virtual bool createGroup(uint32_t &token, RsWikiGroup &group, bool isNew) = 0;
virtual bool createPage(uint32_t &token, RsWikiPage &page, bool isNew) = 0;
};

View File

@ -88,16 +88,13 @@ class RsWire: public RsTokenService
RsWire() { return; }
virtual ~RsWire() { return; }
/* changed? */
virtual bool updated() = 0;
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsWireGroup &group) = 0;
virtual bool getMsgData(const uint32_t &token, RsWirePulse &pulse) = 0;
/* Create Stuff */
virtual bool createGroup(RsWireGroup &group) = 0;
virtual bool createPulse(RsWirePulse &pulse) = 0;
virtual bool createGroup(uint32_t &token, RsWireGroup &group, bool isNew) = 0;
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew) = 0;
};

View File

@ -354,25 +354,33 @@ bool p3ForumsV2::cancelRequest(const uint32_t &token)
}
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
bool p3ForumsV2::groupsChanged(std::list<std::string> &groupIds)
{
return false;
}
// Get Message Status - is retrived via MessageSummary.
bool p3ForumsV2::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mForumProxy->setMessageStatus(msgId, status, statusMask);
}
//
bool p3ForumsV2::groupSubscribe(const std::string &groupId, bool subscribe)
bool p3ForumsV2::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mForumProxy->setGroupStatus(groupId, status, statusMask);
}
bool p3ForumsV2::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
return mForumProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
}
bool p3ForumsV2::setMessageServiceString(const std::string &msgId, const std::string &str)
{
return mForumProxy->setMessageServiceString(msgId, str);
}
bool p3ForumsV2::setGroupServiceString(const std::string &grpId, const std::string &str)
{
return mForumProxy->setGroupServiceString(grpId, str);
}
bool p3ForumsV2::groupRestoreKeys(const std::string &groupId)
{
@ -384,20 +392,6 @@ bool p3ForumsV2::groupShareKeys(const std::string &groupId, std::list<std::strin
return false;
}
#if 0
/* details are updated in album - to choose Album ID, and storage path */
bool p3ForumsV2::submitAlbumDetails(RsForumAlbum &album)
{
return false;
}
bool p3ForumsV2::submitForum(RsForumForum &photo)
{
return false;
}
#endif
@ -415,7 +409,7 @@ std::string p3ForumsV2::genRandomId()
return randomId;
}
bool p3ForumsV2::createGroup(RsForumV2Group &group)
bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
{
if (group.mMeta.mGroupId.empty())
{
@ -431,11 +425,22 @@ bool p3ForumsV2::createGroup(RsForumV2Group &group)
return false;
}
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mForumProxy->addForumGroup(group);
}
mForumProxy->addForumGroup(group);
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3ForumsV2::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true;
}
@ -443,7 +448,7 @@ bool p3ForumsV2::createGroup(RsForumV2Group &group)
bool p3ForumsV2::createMsg(RsForumV2Msg &msg)
bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
{
if (msg.mMeta.mGroupId.empty())
{
@ -479,11 +484,22 @@ bool p3ForumsV2::createMsg(RsForumV2Msg &msg)
std::cerr << "p3ForumsV2::createForumMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId;
std::cerr << std::endl;
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mForumProxy->addForumMsg(msg);
}
mForumProxy->addForumMsg(msg);
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(msg.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3ForumsV2::createMsg() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
}
@ -640,12 +656,12 @@ bool p3ForumsV2::generateDummyData()
float rnd = RSRandom::random_f32();
if (rnd < 0.1)
{
forum.mMeta.mSubscribeFlags = RS_DISTRIB_ADMIN;
forum.mMeta.mSubscribeFlags = RSGXS_GROUP_SUBSCRIBE_ADMIN;
}
else if (rnd < 0.3)
{
forum.mMeta.mSubscribeFlags = RS_DISTRIB_SUBSCRIBED;
forum.mMeta.mSubscribeFlags = RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED;
}
else
{

View File

@ -34,17 +34,6 @@
#include <string>
/*
* Wiki Service
*
* This is an example service for the new cache system.
* For the moment, it will only hold data passed to it from the GUI.
* and spew that back when asked....
*
* We are doing it like this - so we can check the required interface functionality.
*
* Expect it won't take long before it'll be properly linked into the backend!
*
* This will be transformed into a Plugin Service, once the basics have been worked out.
*
*/
@ -107,22 +96,17 @@ virtual uint32_t requestStatus(const uint32_t token);
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
virtual bool createGroup(RsForumV2Group &group);
virtual bool createMsg(RsForumV2Msg &msg);
virtual bool createGroup(uint32_t &token, RsForumV2Group &group, bool isNew);
virtual bool createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew);
private:
@ -137,73 +121,6 @@ bool generateDummyData();
bool mUpdated;
#if 0
/* Data Requests */
virtual bool requestGroupList( uint32_t &token, const RsTokReqOptions &opts);
virtual bool requestMsgList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedList(uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &msgIds);
virtual bool requestGroupData( uint32_t &token, const std::list<std::string> &groupIds);
virtual bool requestMsgData( uint32_t &token, const std::list<std::string> &msgIds);
virtual bool getGroupList(const uint32_t &token, std::list<std::string> &groupIds);
virtual bool getMsgList(const uint32_t &token, std::list<std::string> &msgIds);
virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group);
virtual bool getMsgData(const uint32_t &token, RsForumV2Msg &msg);
/* Poll */
virtual uint32_t requestStatus(const uint32_t token);
virtual bool createGroup(RsForumV2Group &group);
virtual bool createPage(RsForumV2Msg &msg);
/************* Old Extern Interface *******/
virtual bool updated();
virtual bool getGroupList(std::list<std::string> &group);
virtual bool getGroup(const std::string &groupid, RsWikiGroup &group);
virtual bool getPage(const std::string &pageid, RsWikiPage &page);
virtual bool getPageVersions(const std::string &origPageId, std::list<std::string> &pages);
virtual bool getOrigPageList(const std::string &groupid, std::list<std::string> &pageIds);
virtual bool getLatestPage(const std::string &origPageId, std::string &page);
virtual bool createGroup(RsWikiGroup &group);
virtual bool createPage(RsWikiPage &page);
private:
virtual bool InternalgetGroupList(std::list<std::string> &group);
virtual bool InternalgetGroup(const std::string &groupid, RsForumV2Group &group);
virtual bool InternalgetPage(const std::string &pageid, RsForumV2Msg &msg);
virtual bool InternalgetPageVersions(const std::string &origPageId, std::list<std::string> &pages);
virtual bool InternalgetOrigPageList(const std::string &groupid, std::list<std::string> &pageIds);
virtual bool InternalgetLatestPage(const std::string &origPageId, std::string &page);
std::string genRandomId();
ForumDataProxy *mForumProxy;
RsMutex mForumMtx;
/***** below here is locked *****/
bool mUpdated;
std::map<std::string, std::list<std::string > > mGroupToOrigPages;
std::map<std::string, std::list<std::string > > mOrigToPageVersions;
std::map<std::string, std::string> mOrigPageToLatestPage;
std::map<std::string, RsForumV2Group> mGroups;
std::map<std::string, RsForumV2Msg> mPages;
#endif
};
#endif

View File

@ -341,6 +341,141 @@ GxsDataProxy::GxsDataProxy()
}
static bool checkGroupFilter(const RsTokReqOptions &opts, const RsGroupMetaData &group)
{
bool statusMatch = false;
if (opts.mStatusMask)
{
// Exact Flags match required.
if ((opts.mStatusMask & opts.mStatusFilter) == (opts.mStatusMask & group.mGroupStatus))
{
statusMatch = true;
}
else
{
std::cerr << "checkGroupFilter() Dropping Group due to !StatusMatch ";
std::cerr << " Mask: " << opts.mStatusMask << " StatusFilter: " << opts.mStatusFilter;
std::cerr << " GroupStatus: " << group.mGroupStatus << " GroupId: " << group.mGroupId;
std::cerr << std::endl;
}
}
else
{
// no status comparision,
statusMatch = true;
}
bool subMatch = false;
if (opts.mSubscribeFilter)
{
// Exact Flags match required.
if (opts.mSubscribeFilter & group.mSubscribeFlags)
{
subMatch = true;
}
else
{
std::cerr << "checkGroupFilter() Dropping Group due to !SubscribeMatch ";
std::cerr << " SubscribeFilter: " << opts.mSubscribeFilter;
std::cerr << " GroupSubscribeFlags: " << group.mSubscribeFlags << " GroupId: " << group.mGroupId;
std::cerr << std::endl;
}
}
else
{
// no subscribe comparision,
subMatch = true;
}
return (statusMatch && subMatch);
}
static bool checkMsgFilter(const RsTokReqOptions &opts, const RsMsgMetaData &msg)
{
bool statusMatch = false;
if (opts.mStatusMask)
{
// Exact Flags match required.
if ((opts.mStatusMask & opts.mStatusFilter) == (opts.mStatusMask & msg.mMsgStatus))
{
statusMatch = true;
}
else
{
std::cerr << "checkMsgFilter() Dropping Msg due to !StatusMatch ";
std::cerr << " Mask: " << opts.mStatusMask << " StatusFilter: " << opts.mStatusFilter;
std::cerr << " MsgStatus: " << msg.mMsgStatus << " MsgId: " << msg.mMsgId;
std::cerr << std::endl;
}
}
else
{
// no status comparision,
statusMatch = true;
}
return statusMatch;
}
bool GxsDataProxy::filterGroupList(const RsTokReqOptions &opts, std::list<std::string> &groupIds)
{
std::list<std::string>::iterator it;
for(it = groupIds.begin(); it != groupIds.end(); )
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
bool keep = false;
/* find group */
std::map<std::string, RsGroupMetaData>::iterator mit;
mit = mGroupMetaData.find(*it);
if (mit != mGroupMetaData.end())
{
keep = checkGroupFilter(opts, mit->second);
}
if (keep)
{
it++;
}
else
{
it = groupIds.erase(it);
}
}
return true;
}
bool GxsDataProxy::filterMsgList(const RsTokReqOptions &opts, std::list<std::string> &msgIds)
{
std::list<std::string>::iterator it;
for(it = msgIds.begin(); it != msgIds.end(); )
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
bool keep = false;
/* find msg */
std::map<std::string, RsMsgMetaData>::iterator mit;
mit = mMsgMetaData.find(*it);
if (mit != mMsgMetaData.end())
{
keep = checkMsgFilter(opts, mit->second);
}
if (keep)
{
it++;
}
else
{
it = msgIds.erase(it);
}
}
return true;
}
bool GxsDataProxy::getGroupList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds, std::list<std::string> &outGroupIds)
{
@ -368,6 +503,8 @@ bool GxsDataProxy::getGroupList( uint32_t &token, const RsTokReqOptions &opt
outGroupIds = groupIds;
}
filterGroupList(opts, outGroupIds);
return true;
}
@ -415,9 +552,11 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
{
if (onlyLatestMsgs) // THIS ONE IS HARD -> LOTS OF COMP.
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
// RUN THROUGH ALL MSGS... in map origId -> TS.
std::map<std::string, std::pair<std::string, uint32_t> > origMsgTs;
std::map<std::string, std::pair<std::string, uint32_t> >::iterator oit;
std::map<std::string, std::pair<std::string, time_t> > origMsgTs;
std::map<std::string, std::pair<std::string, time_t> >::iterator oit;
for(mit = mMsgMetaData.begin(); mit != mMsgMetaData.end(); mit++)
{
if (mit->second.mGroupId != *it)
@ -474,6 +613,8 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
}
else // ALL OTHER CASES.
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
for(mit = mMsgMetaData.begin(); mit != mMsgMetaData.end(); mit++)
{
if (mit->second.mGroupId == *it)
@ -510,6 +651,9 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
}
}
}
filterMsgList(opts, outMsgIds);
return true;
}
@ -573,6 +717,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
std::cerr << std::endl;
/* just copy */
outMsgIds = msgIds;
filterMsgList(opts, outMsgIds);
return true;
}
@ -582,6 +727,8 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
for(it = msgIds.begin(); it != msgIds.end(); it++)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
/* getOriginal Message */
mit = mMsgMetaData.find(*it);
if (mit == mMsgMetaData.end())
@ -596,8 +743,8 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if (onlyChildMsgs)
{
// RUN THROUGH ALL MSGS... in map origId -> TS.
std::map<std::string, std::pair<std::string, uint32_t> > origMsgTs;
std::map<std::string, std::pair<std::string, uint32_t> >::iterator oit;
std::map<std::string, std::pair<std::string, time_t> > origMsgTs;
std::map<std::string, std::pair<std::string, time_t> >::iterator oit;
for(mit = mMsgMetaData.begin(); mit != mMsgMetaData.end(); mit++)
{
// skip msgs that aren't children.
@ -665,6 +812,8 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
}
else if (onlyAllVersions)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
for(mit = mMsgMetaData.begin(); mit != mMsgMetaData.end(); mit++)
{
if (mit->second.mOrigMsgId == origMsgId)
@ -675,6 +824,8 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
}
}
filterMsgList(opts, outMsgIds);
return true;
}
@ -693,6 +844,11 @@ bool GxsDataProxy::createGroup(void *groupData)
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
/* Set the Group Status Flags */
meta.mGroupStatus |= (RSGXS_GROUP_STATUS_UPDATED | RSGXS_GROUP_STATUS_NEWGROUP);
/* push into maps */
mGroupData[meta.mGroupId] = groupData;
mGroupMetaData[meta.mGroupId] = meta;
@ -720,6 +876,25 @@ bool GxsDataProxy::createMsg(void *msgData)
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
/* find the group */
std::map<std::string, RsGroupMetaData>::iterator git;
git = mGroupMetaData.find(meta.mGroupId);
if (git == mGroupMetaData.end())
{
std::cerr << "GxsDataProxy::createMsg() ERROR GroupId Doesn't exist, discarding";
std::cerr << std::endl;
return false;
}
/* flag the group as changed */
git->second.mGroupStatus |= RSGXS_GROUP_STATUS_UPDATED;
/* Set the Msg Status Flags */
meta.mMsgStatus |= (RSGXS_MSG_STATUS_UNREAD_BY_USER | RSGXS_MSG_STATUS_UNPROCESSED);
/* Set the Msg->GroupId Status Flags */
/* push into maps */
mMsgData[meta.mMsgId] = msgData;
mMsgMetaData[meta.mMsgId] = meta;
@ -733,6 +908,124 @@ bool GxsDataProxy::createMsg(void *msgData)
}
// Get Message Status - is retrived via MessageSummary.
bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t status, const uint32_t statusMask)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
std::map<std::string, RsMsgMetaData>::iterator mit;
mit = mMsgMetaData.find(msgId);
if (mit == mMsgMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
}
else
{
/* tweak status */
mit->second.mMsgStatus &= ~statusMask;
mit->second.mMsgStatus |= (status & statusMask);
}
// always return true - as this is supposed to be async operation.
return true;
}
bool GxsDataProxy::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
std::map<std::string, RsGroupMetaData>::iterator git;
git = mGroupMetaData.find(groupId);
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupStatus() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
else
{
/* tweak status */
git->second.mGroupStatus &= ~statusMask;
git->second.mGroupStatus |= (status & statusMask);
}
// always return true - as this is supposed to be async operation.
return true;
}
bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
std::map<std::string, RsGroupMetaData>::iterator git;
git = mGroupMetaData.find(groupId);
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupSubscribeFlags() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
else
{
/* tweak subscribe Flags */
git->second.mSubscribeFlags &= ~subscribeMask;
git->second.mSubscribeFlags |= (subscribeFlags & subscribeMask);
}
// always return true - as this is supposed to be async operation.
return true;
}
bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::string &str)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
std::map<std::string, RsMsgMetaData>::iterator mit;
mit = mMsgMetaData.find(msgId);
if (mit == mMsgMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setMessageServiceString() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
}
else
{
mit->second.mServiceString = str;
}
// always return true - as this is supposed to be async operation.
return true;
}
bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::string &str)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
std::map<std::string, RsGroupMetaData>::iterator git;
git = mGroupMetaData.find(groupId);
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupServiceString() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
else
{
git->second.mServiceString = str;
}
// always return true - as this is supposed to be async operation.
return true;
}
/* These Functions must be overloaded to complete the service */
bool GxsDataProxy::convertGroupToMetaData(void *groupData, RsGroupMetaData &meta)

View File

@ -114,6 +114,10 @@ virtual bool getMsgList( uint32_t &token, const RsTokReqOptions &opts, con
virtual bool getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &msgIds, std::list<std::string> &outMsgIds);
/* This functions return a token - which can be used to retrieve the RsGroupMetaData, later
* This is required, as signatures and keys might have to be generated in the background
* Though at the moment: for this test system it won't change anything? FIXME.
*/
virtual bool createGroup(void *groupData);
virtual bool createMsg(void *msgData);
@ -137,6 +141,26 @@ virtual bool convertMsgToMetaData(void *groupData, RsMsgMetaData &meta);
bool isUniqueMsg(const std::string &msgId);
/* Handle Status & Subscribe Modes */
// This is removed as redundant - use getGroupList - with OptFlags to find these.
//virtual bool requestGroupsChanged(uint32_t &token); //std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
// These operations could have a token, but for the moment we are going to assume
// they are async and always succeed - (or fail silently).
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
protected:
bool filterGroupList(const RsTokReqOptions &opts, std::list<std::string> &groupIds);
bool filterMsgList(const RsTokReqOptions &opts, std::list<std::string> &msgIds);
RsMutex mDataMtx;
std::map<std::string, void *> mGroupData;

View File

@ -354,23 +354,29 @@ bool p3IdService::cancelRequest(const uint32_t &token)
}
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
bool p3IdService::groupsChanged(std::list<std::string> &groupIds)
{
return false;
}
// Get Message Status - is retrived via MessageSummary.
bool p3IdService::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mIdProxy->setMessageStatus(msgId, status, statusMask);
}
//
bool p3IdService::groupSubscribe(const std::string &groupId, bool subscribe)
bool p3IdService::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mIdProxy->setGroupStatus(groupId, status, statusMask);
}
bool p3IdService::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
return mIdProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
}
bool p3IdService::setMessageServiceString(const std::string &msgId, const std::string &str)
{
return mIdProxy->setMessageServiceString(msgId, str);
}
bool p3IdService::setGroupServiceString(const std::string &grpId, const std::string &str)
{
return mIdProxy->setGroupServiceString(grpId, str);
}
@ -399,7 +405,7 @@ std::string p3IdService::genRandomId()
return randomId;
}
bool p3IdService::createGroup(RsIdGroup &group)
bool p3IdService::createGroup(uint32_t &token, RsIdGroup &group, bool isNew)
{
if (group.mMeta.mGroupId.empty())
{
@ -415,11 +421,23 @@ bool p3IdService::createGroup(RsIdGroup &group)
return false;
}
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mIdProxy->addGroup(group);
}
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3IdService::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
mIdProxy->addGroup(group);
return true;
}
@ -427,7 +445,7 @@ bool p3IdService::createGroup(RsIdGroup &group)
bool p3IdService::createMsg(RsIdMsg &msg)
bool p3IdService::createMsg(uint32_t &token, RsIdMsg &msg, bool isNew)
{
if (msg.mMeta.mGroupId.empty())
{
@ -463,11 +481,22 @@ bool p3IdService::createMsg(RsIdMsg &msg)
std::cerr << "p3IdService::createMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId;
std::cerr << std::endl;
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mIdMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mIdProxy->addMsg(msg);
}
mIdProxy->addMsg(msg);
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(msg.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3IdService::createMsg() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
}

View File

@ -84,6 +84,8 @@ virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaD
virtual bool getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo);
/* Actual Data -> specific to Interface */
virtual bool getGroupData(const uint32_t &token, RsIdGroup &group);
virtual bool getMsgData(const uint32_t &token, RsIdMsg &msg);
/* Poll */
virtual uint32_t requestStatus(const uint32_t token);
@ -91,70 +93,24 @@ virtual uint32_t requestStatus(const uint32_t token);
/* Cancel Request */
virtual bool cancelRequest(const uint32_t &token);
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
//////////////////////////////////////////////////////////////////////////////
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe) ;
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
//////////////////////////////////////////////////////////////////////////////
virtual bool createGroup(uint32_t &token, RsIdGroup &group, bool isNew);
virtual bool createMsg(uint32_t &token, RsIdMsg &msg, bool isNew);
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsIdGroup &group);
virtual bool getMsgData(const uint32_t &token, RsIdMsg &msg);
virtual bool createGroup(RsIdGroup &group);
virtual bool createMsg(RsIdMsg &msg);
/* Interface now a request / poll / answer system */
#if 0
/* Data Requests */
virtual bool requestIdentityList(uint32_t &token);
virtual bool requestIdentities(uint32_t &token, const std::list<std::string> &ids);
virtual bool requestIdReputations(uint32_t &token, const std::list<std::string> &ids);
virtual bool requestIdPeerOpinion(uint32_t &token, const std::string &aboutId, const std::string &peerId);
//virtual bool requestIdGpgDetails(uint32_t &token, const std::list<std::string> &ids);
/* Poll */
virtual uint32_t requestStatus(const uint32_t token);
/* Retrieve Data */
virtual bool getIdentityList(const uint32_t token, std::list<std::string> &ids);
virtual bool getIdentity(const uint32_t token, RsIdData &data);
virtual bool getIdReputation(const uint32_t token, RsIdReputation &reputation);
virtual bool getIdPeerOpinion(const uint32_t token, RsIdOpinion &opinion);
//virtual bool getIdGpgDetails(const uint32_t token, RsIdGpgDetails &gpgData);
/* Updates */
virtual bool updateIdentity(RsIdData &data);
virtual bool updateOpinion(RsIdOpinion &opinion);
/* below here not part of the interface */
bool fakeprocessrequests();
virtual bool InternalgetIdentityList(std::list<std::string> &ids);
virtual bool InternalgetIdentity(const std::string &id, RsIdData &data);
virtual bool InternalgetIdReputation(const std::string &id, RsIdReputation &reputation);
virtual bool InternalgetIdPeerOpinion(const std::string &aboutid, const std::string &peerid, RsIdOpinion &opinion);
#endif
virtual void generateDummyData();
private:
virtual void generateDummyData();
std::string genRandomId();
IdDataProxy *mIdProxy;

View File

@ -57,7 +57,7 @@ int p3PhotoService::tick()
return 0;
}
bool p3PhotoService::updated()
bool p3PhotoService::updated()
{
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
@ -70,7 +70,6 @@ bool p3PhotoService::updated()
}
/* Data Requests */
bool p3PhotoService::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds)
{
@ -351,24 +350,30 @@ bool p3PhotoService::cancelRequest(const uint32_t &token)
return clearRequest(token);
}
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
bool p3PhotoService::groupsChanged(std::list<std::string> &groupIds)
{
return false;
}
// Get Message Status - is retrived via MessageSummary.
bool p3PhotoService::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mPhotoProxy->setMessageStatus(msgId, status, statusMask);
}
//
bool p3PhotoService::groupSubscribe(const std::string &groupId, bool subscribe)
bool p3PhotoService::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mPhotoProxy->setGroupStatus(groupId, status, statusMask);
}
bool p3PhotoService::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
return mPhotoProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
}
bool p3PhotoService::setMessageServiceString(const std::string &msgId, const std::string &str)
{
return mPhotoProxy->setMessageServiceString(msgId, str);
}
bool p3PhotoService::setGroupServiceString(const std::string &grpId, const std::string &str)
{
return mPhotoProxy->setGroupServiceString(grpId, str);
}
@ -384,7 +389,8 @@ bool p3PhotoService::groupShareKeys(const std::string &groupId, std::list<std::s
/* details are updated in album - to choose Album ID, and storage path */
bool p3PhotoService::submitAlbumDetails(RsPhotoAlbum &album, bool isNew)
bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew)
{
/* check if its a modification or a new album */
@ -406,18 +412,29 @@ bool p3PhotoService::submitAlbumDetails(RsPhotoAlbum &album, bool isNew)
album.mModFlags = 0; // These are always cleared.
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
/* add / modify */
mPhotoProxy->addAlbum(album);
/* add / modify */
mPhotoProxy->addAlbum(album);
}
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(album.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3PhotoService::submitAlbumDetails() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true;
}
bool p3PhotoService::submitPhoto(RsPhotoPhoto &photo, bool isNew)
bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew)
{
if (photo.mMeta.mGroupId.empty())
{
@ -450,11 +467,22 @@ bool p3PhotoService::submitPhoto(RsPhotoPhoto &photo, bool isNew)
std::cerr << " MsgId: " << photo.mMeta.mMsgId;
std::cerr << std::endl;
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mPhotoProxy->addPhoto(photo);
}
mPhotoProxy->addPhoto(photo);
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(photo.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3PhotoService::submitPhoto() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
}
@ -612,6 +640,7 @@ bool RsPhotoThumbnail::deleteImage()
data = NULL;
size = 0;
}
return true;
}

View File

@ -79,6 +79,7 @@ virtual int tick();
// NEW INTERFACE.
/************* Extern Interface *******/
/* changed? */
virtual bool updated();
/* Data Requests */
@ -106,22 +107,19 @@ virtual uint32_t requestStatus(const uint32_t token);
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
/* details are updated in album - to choose Album ID, and storage path */
virtual bool submitAlbumDetails(RsPhotoAlbum &album, bool isNew);
virtual bool submitPhoto(RsPhotoPhoto &photo, bool isNew);
virtual bool submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew);
virtual bool submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew);

File diff suppressed because it is too large Load Diff

View File

@ -102,28 +102,54 @@ virtual uint32_t requestStatus(const uint32_t token);
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
/* details are updated in album - to choose Album ID, and storage path */
virtual bool submitGroup(RsPostedGroup &group, bool isNew);
virtual bool submitPost(RsPostedPost &post, bool isNew);
virtual bool submitVote(RsPostedVote &vote, bool isNew);
virtual bool submitComment(RsPostedComment &comment, bool isNew);
virtual bool submitGroup(uint32_t &token, RsPostedGroup &group, bool isNew);
virtual bool submitPost(uint32_t &token, RsPostedPost &post, bool isNew);
virtual bool submitVote(uint32_t &token, RsPostedVote &vote, bool isNew);
virtual bool submitComment(uint32_t &token, RsPostedComment &comment, bool isNew);
// Extended Interface for Collated Data View.
virtual bool setViewMode(uint32_t mode);
virtual bool setViewPeriod(uint32_t period);
virtual bool setViewRange(uint32_t first, uint32_t count);
virtual bool requestRanking(uint32_t &token, std::string groupId);
virtual bool getRankedPost(const uint32_t &token, RsPostedPost &post);
// These are exposed for GUI usage.
virtual bool encodePostedCache(std::string &str, uint32_t votes, uint32_t comments);
virtual bool extractPostedCache(const std::string &str, uint32_t &votes, uint32_t &comments);
private:
//
bool checkRankingRequest();
float calcPostScore(const RsMsgMetaData &meta);
bool processPosts();
// background processing of Votes.
// NB: These should probably be handled by a background thread.
// At the moment they are run from the tick() thread.
bool background_checkTokenRequest();
bool background_requestGroups();
bool background_requestNewMessages();
bool background_processNewMessages();
bool background_updateVoteCounts();
bool background_cleanup();
std::string genRandomId();
bool generateDummyData();
@ -132,6 +158,27 @@ bool generateDummyData();
RsMutex mPostedMtx;
bool mUpdated;
// Ranking view mode, stored here.
uint32_t mViewMode;
uint32_t mViewPeriod;
uint32_t mViewStart;
uint32_t mViewCount;
// Processing Ranking stuff.
bool mProcessingRanking;
uint32_t mRankingState;
uint32_t mRankingExternalToken;
uint32_t mRankingInternalToken;
// background processing - Mutex protected.
time_t mLastBgCheck;
bool mBgProcessing;
uint32_t mBgPhase;
uint32_t mBgToken;
std::map<std::string, uint32_t> mBgVoteMap; // ParentId -> Vote Count.
std::map<std::string, uint32_t> mBgCommentMap; // ThreadId -> Comment Count.
};

View File

@ -346,24 +346,31 @@ bool p3WikiService::cancelRequest(const uint32_t &token)
return clearRequest(token);
}
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
bool p3WikiService::groupsChanged(std::list<std::string> &groupIds)
{
return false;
}
// Get Message Status - is retrived via MessageSummary.
//////////////////////////////////////////////////////////////////////////////
bool p3WikiService::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mWikiProxy->setMessageStatus(msgId, status, statusMask);
}
//
bool p3WikiService::groupSubscribe(const std::string &groupId, bool subscribe)
bool p3WikiService::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mWikiProxy->setGroupStatus(groupId, status, statusMask);
}
bool p3WikiService::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
return mWikiProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
}
bool p3WikiService::setMessageServiceString(const std::string &msgId, const std::string &str)
{
return mWikiProxy->setMessageServiceString(msgId, str);
}
bool p3WikiService::setGroupServiceString(const std::string &grpId, const std::string &str)
{
return mWikiProxy->setGroupServiceString(grpId, str);
}
@ -392,7 +399,7 @@ std::string p3WikiService::genRandomId()
return randomId;
}
bool p3WikiService::createGroup(RsWikiGroup &group)
bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
{
if (group.mMeta.mGroupId.empty())
{
@ -408,19 +415,29 @@ bool p3WikiService::createGroup(RsWikiGroup &group)
return false;
}
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mWikiProxy->addGroup(group);
}
mWikiProxy->addGroup(group);
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3WikiService::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true;
}
bool p3WikiService::createPage(RsWikiPage &page)
bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
{
if (page.mMeta.mGroupId.empty())
{
@ -456,11 +473,22 @@ bool p3WikiService::createPage(RsWikiPage &page)
std::cerr << "p3WikiService::createPage() OrigPageId: " << page.mMeta.mOrigMsgId;
std::cerr << std::endl;
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mWikiProxy->addPage(page);
}
mWikiProxy->addPage(page);
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(page.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3WikiService::createPage() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
}

View File

@ -101,21 +101,17 @@ virtual uint32_t requestStatus(const uint32_t token);
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
virtual bool createGroup(RsWikiGroup &group);
virtual bool createPage(RsWikiPage &page);
virtual bool createGroup(uint32_t &token, RsWikiGroup &group, bool isNew);
virtual bool createPage(uint32_t &token, RsWikiPage &page, bool isNew);
private:

View File

@ -347,23 +347,31 @@ bool p3Wire::cancelRequest(const uint32_t &token)
}
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
bool p3Wire::groupsChanged(std::list<std::string> &groupIds)
{
return false;
}
// Get Message Status - is retrived via MessageSummary.
bool p3Wire::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mWireProxy->setMessageStatus(msgId, status, statusMask);
}
//
bool p3Wire::groupSubscribe(const std::string &groupId, bool subscribe)
bool p3Wire::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{
return false;
return mWireProxy->setGroupStatus(groupId, status, statusMask);
}
bool p3Wire::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{
return mWireProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
}
bool p3Wire::setMessageServiceString(const std::string &msgId, const std::string &str)
{
return mWireProxy->setMessageServiceString(msgId, str);
}
bool p3Wire::setGroupServiceString(const std::string &grpId, const std::string &str)
{
return mWireProxy->setGroupServiceString(grpId, str);
}
@ -392,7 +400,8 @@ std::string p3Wire::genRandomId()
return randomId;
}
bool p3Wire::createGroup(RsWireGroup &group)
bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
{
if (group.mMeta.mGroupId.empty())
{
@ -408,11 +417,22 @@ bool p3Wire::createGroup(RsWireGroup &group)
return false;
}
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mWireProxy->addGroup(group);
}
mWireProxy->addGroup(group);
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3Wiree::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true;
}
@ -420,7 +440,7 @@ bool p3Wire::createGroup(RsWireGroup &group)
bool p3Wire::createPulse(RsWirePulse &pulse)
bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
{
if (pulse.mMeta.mGroupId.empty())
{
@ -456,11 +476,22 @@ bool p3Wire::createPulse(RsWirePulse &pulse)
std::cerr << "p3Wire::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId;
std::cerr << std::endl;
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
{
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
mUpdated = true;
mUpdated = true;
mWireProxy->addPulse(pulse);
}
mWireProxy->addPulse(pulse);
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(pulse.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3Wire::createPulse() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
}

View File

@ -91,22 +91,17 @@ virtual uint32_t requestStatus(const uint32_t token);
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
/* Functions from Forums -> need to be implemented generically */
virtual bool groupsChanged(std::list<std::string> &groupIds);
// Get Message Status - is retrived via MessageSummary.
virtual bool setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask);
//
virtual bool groupSubscribe(const std::string &groupId, bool subscribe);
virtual bool setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask);
virtual bool setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask);
virtual bool setMessageServiceString(const std::string &msgId, const std::string &str);
virtual bool setGroupServiceString(const std::string &grpId, const std::string &str);
virtual bool groupRestoreKeys(const std::string &groupId);
virtual bool groupShareKeys(const std::string &groupId, std::list<std::string>& peers);
virtual bool createGroup(RsWireGroup &group);
virtual bool createPulse(RsWirePulse &pulse);
virtual bool createGroup(uint32_t &token, RsWireGroup &group, bool isNew);
virtual bool createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew);
private: