Reorganisation of the New GXS Services.

* The Example services have been renamed eg. p3posted => p3postedVEG, to allow the real services to be added.
 * The ServiceIDs have been shifted, to allow both VEG and GXS versions of services to run side-by-side for now.
 * The DataTypes have not been renamed - but potentially should be in the future - if they cause clashes.
 * Interface variables have also been renamed. eg. rsPosted => rsPostedVEG.
 * This means that the GUI will not operate without changes too - TODO.

Minor changes to GXS services to better seperate them from the VEG versions.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5551 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-09-15 00:16:06 +00:00
parent 9f20c75f83
commit bfef2c659f
29 changed files with 2994 additions and 1078 deletions

View File

@ -645,31 +645,35 @@ linux-*:isEmpty(PREFIX) {
} }
newservices { newservices {
HEADERS += services/p3photoservice.h \ HEADERS += services/p3photoserviceVEG.h \
serialiser/rsphotoitems.h \ retroshare/rsphotoVEG.h \
retroshare/rsphoto.h \ services/p3gxsserviceVEG.h \
services/p3gxsservice.h \ retroshare/rsidentityVEG.h \
retroshare/rsidentity.h \ services/p3wikiserviceVEG.h \
services/p3wikiservice.h \ retroshare/rswikiVEG.h \
retroshare/rswiki.h \ retroshare/rswireVEG.h \
retroshare/rswire.h \ services/p3wireVEG.h \
services/p3wire.h \ services/p3idserviceVEG.h \
services/p3idservice.h \ retroshare/rsforumsVEG.h \
retroshare/rsforumsv2.h \ services/p3forumsVEG.h \
services/p3forumsv2.h \ retroshare/rspostedVEG.h \
retroshare/rsposted.h \ services/p3postedVEG.h \
services/p3posted.h \ services/p3photoserviceV2VEG.h \
services/p3photoserviceV2.h \ retroshare/rsphotoVEG.h
retroshare/rsphotoV2.h
SOURCES += services/p3photoservice.cc \ # Do I need this?
serialiser/rsphotoitems.cc \ #serialiser/rsphotoitemsVEG.h \
services/p3gxsservice.cc \
services/p3wikiservice.cc \ SOURCES += services/p3photoserviceVEG.cc \
services/p3wire.cc \ services/p3gxsserviceVEG.cc \
services/p3idservice.cc \ services/p3wikiserviceVEG.cc \
services/p3forumsv2.cc \ services/p3wireVEG.cc \
services/p3posted.cc services/p3idserviceVEG.cc \
services/p3forumsVEG.cc \
services/p3postedVEG.cc
# Do I need this?
# serialiser/rsphotoitemsVEG.cc \
} }

View File

@ -30,11 +30,11 @@
#include <string> #include <string>
#include <list> #include <list>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentityVEG.h>
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsForumsV2; class RsForumsVEG;
extern RsForumsV2 *rsForumsV2; extern RsForumsVEG *rsForumsVEG;
class RsForumV2Group class RsForumV2Group
{ {
@ -75,12 +75,12 @@ class RsForumV2Msg
//std::string mHashTags; //std::string mHashTags;
}; };
class RsForumsV2: public RsTokenService class RsForumsVEG: public RsTokenServiceVEG
{ {
public: public:
RsForumsV2() { return; } RsForumsVEG() { return; }
virtual ~RsForumsV2() { return; } virtual ~RsForumsVEG() { return; }
/* Specific Service Data */ /* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group) = 0; virtual bool getGroupData(const uint32_t &token, RsForumV2Group &group) = 0;

View File

@ -0,0 +1,535 @@
#ifndef RETROSHARE_IDENTITY_GUI_INTERFACE_H
#define RETROSHARE_IDENTITY_GUI_INTERFACE_H
/*
* libretroshare/src/retroshare: rsidentity.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 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>
// FLAGS WILL BE REUSED FROM RSDISTRIB -> FOR NOW.
#include <retroshare/rsdistrib.h>
/********** Generic Token Request Interface ***********************
* This is packaged here, as most TokenServices will require ID Services too.
* The requests can be generic, but the reponses are service specific (dependent on data types).
*/
// This bit will be filled out over time.
#define RS_TOKREQOPT_MSG_VERSIONS 0x0001 // MSGRELATED: Returns All MsgIds with OrigMsgId = MsgId.
#define RS_TOKREQOPT_MSG_ORIGMSG 0x0002 // MSGLIST: All Unique OrigMsgIds in a Group.
#define RS_TOKREQOPT_MSG_LATEST 0x0004 // MSGLIST: All Latest MsgIds in Group. MSGRELATED: Latest MsgIds for Input Msgs.
#define RS_TOKREQOPT_MSG_THREAD 0x0010 // MSGRELATED: All Msgs in Thread. MSGLIST: All Unique Thread Ids in Group.
#define RS_TOKREQOPT_MSG_PARENT 0x0020 // MSGRELATED: All Children Msgs.
#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
#define RS_TOKREQOPT_UNREAD 0x0002
#define RS_TOKREQ_ANSTYPE_LIST 0x0001
#define RS_TOKREQ_ANSTYPE_SUMMARY 0x0002
#define RS_TOKREQ_ANSTYPE_DATA 0x0003
#define RS_TOKREQ_ANSTYPE_ACK 0x0004
class RsTokReqOptionsVEG
{
public:
RsTokReqOptionsVEG()
{
mOptions = 0;
mStatusFilter = 0; mStatusMask = 0;
mFlagsFilter = 0; mFlagsMask = 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;
// MsgFlags or GroupsFlags, depends on Request.
uint32_t mFlagsFilter;
uint32_t mFlagsMask;
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_NEWMSG 0x00000004
#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.
#include "serialiser/rsgxsitems.h"
//class RsGroupMetaData
//{
// public:
//
// RsGroupMetaData()
// {
// mGroupFlags = 0;
// mSignFlags = 0;
// mSubscribeFlags = 0;
//
// mPop = 0;
// mMsgCount = 0;
// mLastPost = 0;
// mGroupStatus = 0;
//
// //mPublishTs = 0;
// }
//
// std::string mGroupId;
// std::string mGroupName;
// 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.
//
// // BELOW HERE IS LOCAL DATA, THAT IS NOT FROM MSG.
//
// uint32_t mSubscribeFlags;
//
// uint32_t mPop; // HOW DO WE DO THIS NOW.
// uint32_t mMsgCount; // ???
// time_t mLastPost; // ???
//
// uint32_t mGroupStatus;
//
// std::string mServiceString; // Service Specific Free-Form extra storage.
//};
//
//
//
//
//class RsMsgMetaData
//{
// public:
//
// RsMsgMetaData()
// {
// mPublishTs = 0;
// mMsgFlags = 0;
// mMsgStatus = 0;
// mChildTs = 0;
// }
//
// std::string mGroupId;
// std::string mMsgId;
//
// std::string mThreadId;
// std::string mParentId;
// std::string mOrigMsgId;
//
// std::string mAuthorId;
//
// std::string mMsgName;
// time_t mPublishTs;
//
// 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);
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta);
class RsTokenServiceVEG
{
public:
RsTokenServiceVEG() { return; }
virtual ~RsTokenServiceVEG() { return; }
/* changed? */
virtual bool updated() = 0;
/* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds) = 0;
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds) = 0;
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &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 */
// Groups Changed is now part of requestGroupInfo request.
//virtual bool groupsChanged(std::list<std::string> &groupIds) = 0;
// 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 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;
};
/* The Main Interface Class - for information about your Peers */
class RsIdentity;
extern RsIdentity *rsIdentity;
#define RSID_TYPE_MASK 0xff00
#define RSID_RELATION_MASK 0x00ff
#define RSID_TYPE_REALID 0x0100
#define RSID_TYPE_PSEUDONYM 0x0200
#define RSID_RELATION_YOURSELF 0x0001
#define RSID_RELATION_FRIEND 0x0002
#define RSID_RELATION_FOF 0x0004
#define RSID_RELATION_OTHER 0x0008
#define RSID_RELATION_UNKNOWN 0x0010
std::string rsIdTypeToString(uint32_t idtype);
class RsIdGroup
{
public:
RsGroupMetaData mMeta;
// In GroupMetaData.
//std::string mNickname; (mGroupName)
//std::string mKeyId; (mGroupId)
uint32_t mIdType;
std::string mGpgIdHash; // SHA(KeyId + Gpg Fingerprint) -> can only be IDed if GPG known.
// NOTE: These cannot be transmitted as part of underlying messages....
// Must use ServiceString.
bool mGpgIdKnown; // if GpgIdHash has been identified.
std::string mGpgId; // if known.
std::string mGpgName; // if known.
std::string mGpgEmail; // if known.
};
class RsIdMsg
{
public:
RsMsgMetaData mMeta;
// In MsgMetaData.
//std::string mKeyId; (mGroupId)
//std::string mPeerId; (mAuthorId) ???
int mOpinion;
double mReputation;
//int mRating;
//int mPeersRating;
//std::string mComment;
};
std::ostream &operator<<(std::ostream &out, const RsIdGroup &meta);
std::ostream &operator<<(std::ostream &out, const RsIdMsg &meta);
#if 0
class RsIdReputation
{
public:
std::string mKeyId;
int mYourRating;
int mPeersRating;
int mFofRating;
int mTotalRating;
std::string mComment;
};
class RsIdOpinion
{
public:
std::string mKeyId;
std::string mPeerId;
int mRating;
int mPeersRating;
std::string mComment;
};
#endif
class RsIdentityVEG: public RsTokenServiceVEG
{
public:
RsIdentityVEG() { return; }
virtual ~RsIdentityVEG() { return; }
/* INCLUDES INTERFACE FROM RS TOKEN SERVICE */
//////////////////////////////////////////////////////////////////////////////
/* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsIdGroup &group) = 0;
virtual bool getMsgData(const uint32_t &token, 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....
* This is reflected in the TokenService calls returning false.
*
* Below is the additional interface to look at reputation.
*/
/* So we will want to cache much of the identity stuff, so that we have quick access to the results.
* The following bits of data will not use the request/response interface, and should be available immediately.
*
* ID => Nickname, knownGPG, reputation.
*
* This will require quite a bit of data...
* 20 Bytes + 50 + 1 + 4 Bytes? (< 100 Bytes).
* x 10,000 IDs. => ~1 MB of cache (Good).
* x 100,000 IDs. => ~10 MB of cache (Good).
* x 1,000,000 IDs. => ~100 MB of cache (Too Big).
*
* We also need to store quick access to your OwnIds.
*/
//virtual uint32_t getIdDetails(const std::string &id, std::string &nickname, bool &isGpgKnown,
// uint32_t &ownOpinion, float &reputation);
//virtual uint32_t getOwnIds(std::list<std::string> &ownIds);
//virtual bool setOpinion(const std::string &id, uint32_t opinion);
virtual void generateDummyData() = 0;
#if 0
/* Data Requests */
virtual bool requestIdentityList(uint32_t &token) = 0;
virtual bool requestIdentities(uint32_t &token, const std::list<std::string> &ids) = 0;
virtual bool requestIdReputations(uint32_t &token, const std::list<std::string> &ids) = 0;
virtual bool requestIdPeerOpinion(uint32_t &token, const std::string &aboutId, const std::string &peerId) = 0;
//virtual bool requestIdGpgDetails(uint32_t &token, const std::list<std::string> &ids) = 0;
/* Poll */
virtual uint32_t requestStatus(const uint32_t token) = 0;
/* Retrieve Data */
virtual bool getIdentityList(const uint32_t token, std::list<std::string> &ids) = 0;
virtual bool getIdentity(const uint32_t token, RsIdData &data) = 0;
virtual bool getIdReputation(const uint32_t token, RsIdReputation &reputation) = 0;
virtual bool getIdPeerOpinion(const uint32_t token, RsIdOpinion &opinion) = 0;
/* Updates */
virtual bool updateIdentity(RsIdData &data) = 0;
virtual bool updateOpinion(RsIdOpinion &opinion) = 0;
#endif
};
#endif

View File

@ -30,7 +30,7 @@
#include <string> #include <string>
#include <list> #include <list>
#include "rsgxsservice.h" #include "rsgxsservice.h"
#include "rsphoto.h" #include "rsphotoVEG.h"
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsPhotoV2; class RsPhotoV2;

View File

@ -29,11 +29,11 @@
#include <inttypes.h> #include <inttypes.h>
#include <string> #include <string>
#include <list> #include <list>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentityVEG.h>
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsPhoto; class RsPhotoVEG;
extern RsPhoto *rsPhoto; extern RsPhotoVEG *rsPhotoVEG;
/******************* NEW STUFF FOR NEW CACHE SYSTEM *********/ /******************* NEW STUFF FOR NEW CACHE SYSTEM *********/
@ -159,12 +159,12 @@ std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo);
std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album); std::ostream &operator<<(std::ostream &out, const RsPhotoAlbum &album);
class RsPhoto: public RsTokenService class RsPhotoVEG: public RsTokenServiceVEG
{ {
public: public:
RsPhoto() { return; } RsPhotoVEG() { return; }
virtual ~RsPhoto() { return; } virtual ~RsPhotoVEG() { return; }
/* Specific Service Data */ /* Specific Service Data */
virtual bool getAlbum(const uint32_t &token, RsPhotoAlbum &album) = 0; virtual bool getAlbum(const uint32_t &token, RsPhotoAlbum &album) = 0;

View File

@ -29,11 +29,11 @@
#include <inttypes.h> #include <inttypes.h>
#include <string> #include <string>
#include <list> #include <list>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentityVEG.h>
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsPosted; class RsPostedVEG;
extern RsPosted *rsPosted; extern RsPostedVEG *rsPostedVEG;
class RsPostedGroup class RsPostedGroup
@ -113,12 +113,12 @@ std::ostream &operator<<(std::ostream &out, const RsPostedVote &vote);
std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment); std::ostream &operator<<(std::ostream &out, const RsPostedComment &comment);
class RsPosted: public RsTokenService class RsPostedVEG: public RsTokenServiceVEG
{ {
public: public:
RsPosted() { return; } RsPostedVEG() { return; }
virtual ~RsPosted() { return; } virtual ~RsPostedVEG() { return; }
/* Specific Service Data */ /* Specific Service Data */
virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0; virtual bool getGroup(const uint32_t &token, RsPostedGroup &group) = 0;

View File

@ -30,11 +30,11 @@
#include <string> #include <string>
#include <list> #include <list>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentityVEG.h>
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsWiki; class RsWikiVEG;
extern RsWiki *rsWiki; extern RsWikiVEG *rsWikiVEG;
class RsWikiGroupShare class RsWikiGroupShare
{ {
@ -84,12 +84,12 @@ class RsWikiPage
std::string mHashTags; std::string mHashTags;
}; };
class RsWiki: public RsTokenService class RsWikiVEG: public RsTokenServiceVEG
{ {
public: public:
RsWiki() { return; } RsWikiVEG() { return; }
virtual ~RsWiki() { return; } virtual ~RsWikiVEG() { return; }
/* Specific Service Data */ /* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsWikiGroup &group) = 0; virtual bool getGroupData(const uint32_t &token, RsWikiGroup &group) = 0;

View File

@ -30,11 +30,11 @@
#include <string> #include <string>
#include <list> #include <list>
#include <retroshare/rsidentity.h> #include <retroshare/rsidentityVEG.h>
/* The Main Interface Class - for information about your Peers */ /* The Main Interface Class - for information about your Peers */
class RsWire; class RsWireVEG;
extern RsWire *rsWire; extern RsWireVEG *rsWireVEG;
class RsWireGroupShare class RsWireGroupShare
{ {
@ -64,6 +64,38 @@ class RsWireGroup
RsWireGroupShare mShareOptions; RsWireGroupShare mShareOptions;
}; };
/***********************************************************************
* So pulses operate in the following modes.
*
* => Standard, a post to your own group.
* => @User, gets duplicated on each user's group.
* => RT, duplicated as child of original post.
*
* From Twitter:
* twitter can be: embedded, replied to, favourited, unfavourited,
* retweeted, unretweeted and deleted
*
* See: https://dev.twitter.com/docs/platform-objects
*
* Format of message: ....
*
* #HashTags.
* @68769381495134 => ID of Sender.
* <http>
*
***********************************************************************/
class RsWirePlace
{
public:
};
class RsWirePulse class RsWirePulse
{ {
public: public:
@ -78,15 +110,27 @@ class RsWirePulse
std::string mPulse; // all the text is stored here. std::string mPulse; // all the text is stored here.
std::string mHashTags; std::string mInReplyPulse;
uint32_t mPulseFlags;
std::list<std::string> mMentions;
std::list<std::string> mHashTags;
std::list<std::string> mUrls;
RsWirePlace mPlace;
}; };
class RsWire: public RsTokenService
class RsWireVEG: public RsTokenServiceVEG
{ {
public: public:
RsWire() { return; } RsWireVEG() { return; }
virtual ~RsWire() { return; } virtual ~RsWireVEG() { return; }
/* Specific Service Data */ /* Specific Service Data */
virtual bool getGroupData(const uint32_t &token, RsWireGroup &group) = 0; virtual bool getGroupData(const uint32_t &token, RsWireGroup &group) = 0;

View File

@ -1806,7 +1806,7 @@ RsTurtle *rsTurtle = NULL ;
#include "services/p3blogs.h" #include "services/p3blogs.h"
#include "turtle/p3turtle.h" #include "turtle/p3turtle.h"
#define ENABLE_GXS_SERVICES 1 #define ENABLE_GXS_VEG_SERVICES 1
#define ENABLE_GXS_CORE 1 #define ENABLE_GXS_CORE 1
#ifdef ENABLE_GXS_CORE #ifdef ENABLE_GXS_CORE
@ -1816,13 +1816,13 @@ RsTurtle *rsTurtle = NULL ;
#include "gxs/rsgxsnetservice.h" #include "gxs/rsgxsnetservice.h"
#endif #endif
#ifdef ENABLE_GXS_SERVICES #ifdef ENABLE_GXS_VEG_SERVICES
#include "services/p3photoservice.h" #include "services/p3photoserviceVEG.h"
#include "services/p3wikiservice.h" #include "services/p3wikiserviceVEG.h"
#include "services/p3wire.h" #include "services/p3wireVEG.h"
#include "services/p3idservice.h" #include "services/p3idserviceVEG.h"
#include "services/p3forumsv2.h" #include "services/p3forumsVEG.h"
#include "services/p3posted.h" #include "services/p3postedVEG.h"
#endif #endif
#ifndef PQI_DISABLE_TUNNEL #ifndef PQI_DISABLE_TUNNEL
@ -2272,7 +2272,7 @@ int RsServer::StartupRetroShare()
// first prep the core // first prep the core
RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db", RsGeneralDataService* photo_ds = new RsDataService("./", "photoV2_db",
RS_SERVICE_TYPE_PHOTO, NULL); RS_SERVICE_GXSV1_TYPE_PHOTO, NULL);
photo_ds->resetDataStore(); photo_ds->resetDataStore();
@ -2301,31 +2301,31 @@ int RsServer::StartupRetroShare()
#endif #endif
#ifdef ENABLE_GXS_SERVICES #ifdef ENABLE_GXS_VEG_SERVICES
// Testing New Cache Services. // Testing New Cache Services.
p3PhotoService *mPhotos = new p3PhotoService(RS_SERVICE_TYPE_PHOTO); p3PhotoServiceVEG *mPhotosVEG = new p3PhotoServiceVEG(RS_SERVICE_VEG_TYPE_PHOTO);
pqih -> addService(mPhotos); pqih -> addService(mPhotosVEG);
// Testing New Cache Services. // Testing New Cache Services.
p3WikiService *mWikis = new p3WikiService(RS_SERVICE_TYPE_WIKI); p3WikiServiceVEG *mWikisVEG = new p3WikiServiceVEG(RS_SERVICE_VEG_TYPE_WIKI);
pqih -> addService(mWikis); pqih -> addService(mWikisVEG);
// Testing New Cache Services. // Testing New Cache Services.
p3Wire *mWire = new p3Wire(RS_SERVICE_TYPE_WIRE); p3WireVEG *mWireVEG = new p3WireVEG(RS_SERVICE_VEG_TYPE_WIRE);
pqih -> addService(mWire); pqih -> addService(mWireVEG);
// Testing New Cache Services. // Testing New Cache Services.
p3IdService *mIdentity = new p3IdService(RS_SERVICE_TYPE_IDENTITY); p3IdServiceVEG *mIdentityVEG = new p3IdServiceVEG(RS_SERVICE_VEG_TYPE_IDENTITY);
pqih -> addService(mIdentity); pqih -> addService(mIdentityVEG);
// Testing New Cache Services. // Testing New Cache Services.
p3ForumsV2 *mForumsV2 = new p3ForumsV2(RS_SERVICE_TYPE_FORUMSV2); p3ForumsVEG *mForumsVEG = new p3ForumsVEG(RS_SERVICE_VEG_TYPE_FORUMS);
pqih -> addService(mForumsV2); pqih -> addService(mForumsVEG);
// Testing New Cache Services. // Testing New Cache Services.
p3PostedService *mPosted = new p3PostedService(RS_SERVICE_TYPE_POSTED); p3PostedServiceVEG *mPostedVEG = new p3PostedServiceVEG(RS_SERVICE_VEG_TYPE_POSTED);
pqih -> addService(mPosted); pqih -> addService(mPostedVEG);
#endif // ENABLE_GXS_SERVICES #endif // ENABLE_GXS_VEG_SERVICES
#ifndef RS_RELEASE #ifndef RS_RELEASE
@ -2586,15 +2586,18 @@ int RsServer::StartupRetroShare()
#ifdef ENABLE_GXS_SERVICES #ifdef ENABLE_GXS_SERVICES
// Testing of new cache system interfaces. // Testing of new cache system interfaces.
rsIdentity = mIdentity; rsIdentityVEG = mIdentityVEG;
rsPhoto = mPhotos; rsPhotoVEG = mPhotosVEG;
rsPhotoV2 = mPhotoV2; rsWikiVEG = mWikisVEG;
rsWiki = mWikis; rsWireVEG = mWireVEG;
rsWire = mWire; rsForumsVEG = mForumsVEG;
rsForumsV2 = mForumsV2; rsPostedVEG = mPostedVEG;
rsPosted = mPosted;
#endif // ENABLE_GXS_SERVICES #endif // ENABLE_GXS_SERVICES
#ifdef ENABLE_GXS_CORE
rsPhotoV2 = mPhotoV2;
#endif // ENABLE_GXS_CORE
#ifdef RS_USE_BLOGS #ifdef RS_USE_BLOGS
rsBlogs = mBlogs; rsBlogs = mBlogs;

View File

@ -1,290 +0,0 @@
/*
* libretroshare/src/serialiser: rsphotoitems.cc
*
* RetroShare Serialiser.
*
* Copyright 2007-2008 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 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 "serialiser/rsbaseserial.h"
#include "serialiser/rsphotoitems.h"
#include "serialiser/rstlvbase.h"
#define RSSERIAL_DEBUG 1
#include <iostream>
/*************************************************************************/
void RsPhotoItem::clear()
{
srcId.clear();
photoId.clear();
size = 0;
name.clear();
comment.clear();
location.clear();
date.clear();
/* not serialised */
isAvailable = false;
path.clear();
}
std::ostream &RsPhotoItem::print(std::ostream &out, uint16_t indent)
{
printRsItemBase(out, "RsPhotoItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "srcId: " << srcId << std::endl;
printIndent(out, int_Indent);
out << "photoId: " << photoId << std::endl;
printIndent(out, int_Indent);
out << "size: " << size << std::endl;
printIndent(out, int_Indent);
out << "name: " << name << std::endl;
printIndent(out, int_Indent);
std::string cnv_comment(comment.begin(), comment.end());
out << "msg: " << cnv_comment << std::endl;
printIndent(out, int_Indent);
out << "location: " << location << std::endl;
printIndent(out, int_Indent);
out << "date: " << date << std::endl;
printIndent(out, int_Indent);
out << "(NS) isAvailable: " << isAvailable << std::endl;
printIndent(out, int_Indent);
out << "(NS) path: " << path << std::endl;
printRsItemEnd(out, "RsPhotoItem", indent);
return out;
}
/*************************************************************************/
/*************************************************************************/
void RsPhotoShowItem::clear()
{
showId.clear();
name.clear();
comment.clear();
location.clear();
date.clear();
photos.clear();
}
std::ostream &RsPhotoShowItem::print(std::ostream &out, uint16_t indent)
{
printRsItemBase(out, "RsPhotoShowItem", indent);
uint16_t int_Indent = indent + 2;
uint16_t int_Indent2 = int_Indent + 2;
printIndent(out, int_Indent);
out << "showId: " << showId << std::endl;
printIndent(out, int_Indent);
out << "name: " << name << std::endl;
printIndent(out, int_Indent);
std::string cnv_comment(comment.begin(), comment.end());
out << "msg: " << cnv_comment << std::endl;
printIndent(out, int_Indent);
out << "location: " << location << std::endl;
printIndent(out, int_Indent);
out << "date: " << date << std::endl;
printIndent(out, int_Indent);
out << "Photos in Show: " << photos.size() << std::endl;
std::list<RsPhotoRefItem>::iterator it;
for(it = photos.begin(); it != photos.end(); it++)
{
printIndent(out, int_Indent2);
out << "PhotoId: " << it->photoId << std::endl;
printIndent(out, int_Indent2 + 2);
std::string cnv_comment2(it->altComment.begin(), it->altComment.end());
out << "AltComment: " << cnv_comment2 << std::endl;
printIndent(out, int_Indent2 + 2);
out << "Delta T: " << it->deltaT << std::endl;
}
printRsItemEnd(out, "RsPhotoShowItem", indent);
return out;
}
RsPhotoRefItem::RsPhotoRefItem()
:deltaT(0)
{
return;
}
/*************************************************************************/
/*************************************************************************/
/*************************************************************************/
/* TODO serialiser */
#if 0
uint32_t RsPhotoSerialiser::sizeLink(RsPhotoLinkMsg *item)
{
uint32_t s = 8; /* header */
s += GetTlvStringSize(item->rid);
s += 4; /* timestamp */
s += GetTlvWideStringSize(item->title);
s += GetTlvWideStringSize(item->comment);
s += 4; /* linktype */
s += GetTlvWideStringSize(item->link);
return s;
}
/* serialise the data to the buffer */
bool RsPhotoSerialiser::serialiseLink(RsPhotoLinkMsg *item, void *data, uint32_t *pktsize)
{
uint32_t tlvsize = sizeLink(item);
uint32_t offset = 0;
if (*pktsize < tlvsize)
return false; /* not enough space */
*pktsize = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Header: " << ok << std::endl;
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Size: " << tlvsize << std::endl;
/* skip the header */
offset += 8;
/* add mandatory parts first */
ok &= SetTlvString(data, tlvsize, &offset, TLV_TYPE_STR_GENID, item->rid);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() rid: " << ok << std::endl;
ok &= setRawUInt32(data, tlvsize, &offset, item->timestamp);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() timestamp: " << ok << std::endl;
ok &= SetTlvWideString(data, tlvsize, &offset, TLV_TYPE_WSTR_TITLE, item->title);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Title: " << ok << std::endl;
ok &= SetTlvWideString(data, tlvsize, &offset, TLV_TYPE_WSTR_COMMENT, item->comment);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Comment: " << ok << std::endl;
ok &= setRawUInt32(data, tlvsize, &offset, item->linktype);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() linktype: " << ok << std::endl;
ok &= SetTlvWideString(data, tlvsize, &offset, TLV_TYPE_WSTR_LINK, item->link);
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Link: " << ok << std::endl;
if (offset != tlvsize)
{
ok = false;
std::cerr << "RsPhotoLinkSerialiser::serialiseLink() Size Error! " << std::endl;
}
return ok;
}
RsPhotoLinkMsg *RsPhotoSerialiser::deserialiseLink(void *data, uint32_t *pktsize)
{
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_RANK != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_RANK_LINK != getRsItemSubType(rstype)))
{
return NULL; /* wrong type */
}
if (*pktsize < rssize) /* check size */
return NULL; /* not enough data */
/* set the packet length */
*pktsize = rssize;
bool ok = true;
/* ready to load */
RsPhotoLinkMsg *item = new RsPhotoLinkMsg();
item->clear();
/* skip the header */
offset += 8;
/* get mandatory parts first */
ok &= GetTlvString(data, rssize, &offset, TLV_TYPE_STR_GENID, item->rid);
ok &= getRawUInt32(data, rssize, &offset, &(item->timestamp));
ok &= GetTlvWideString(data, rssize, &offset, TLV_TYPE_WSTR_TITLE, item->title);
ok &= GetTlvWideString(data, rssize, &offset, TLV_TYPE_WSTR_COMMENT, item->comment);
ok &= getRawUInt32(data, rssize, &offset, &(item->linktype));
ok &= GetTlvWideString(data, rssize, &offset, TLV_TYPE_WSTR_LINK, item->link);
if (offset != rssize)
{
/* error */
delete item;
return NULL;
}
if (!ok)
{
delete item;
return NULL;
}
return item;
}
uint32_t RsPhotoSerialiser::size(RsItem *item)
{
return sizeLink((RsPhotoLinkMsg *) item);
}
bool RsPhotoSerialiser::serialise(RsItem *item, void *data, uint32_t *pktsize)
{
return serialiseLink((RsPhotoLinkMsg *) item, data, pktsize);
}
RsItem *RsPhotoSerialiser::deserialise(void *data, uint32_t *pktsize)
{
return deserialiseLink(data, pktsize);
}
#endif
/*************************************************************************/

View File

@ -1,138 +0,0 @@
#ifndef P3_PHOTO_ITEMS_H
#define P3_PHOTO_ITEMS_H
/*
* libretroshare/src/serialiser: rsphotoitems.h
*
* RetroShare Serialiser.
*
* Copyright 2007-2008 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 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 <map>
#include "serialiser/rsserviceids.h"
#include "serialiser/rsserial.h"
#include "serialiser/rstlvtypes.h"
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
const uint8_t RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM = 0x04;
/**************************************************************************/
class RsPhotoItem;
class RsPhotoShowItem;
class RsPhotoCommentItem;
class RsPhotoItem: public RsItem
{
public:
RsPhotoItem()
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_ITEM) { return; }
virtual ~RsPhotoItem() { return; }
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
std::string srcId;
std::string photoId; /* same as hash */
uint64_t size; /* file size */
std::string name;
std::wstring comment;
std::string location; /* TODO: change to TLV */
std::string date; /* TODO: change to TLV */
/* not serialised */
bool isAvailable;
std::string path;
};
/* THIS must be turned into a TLV type + set (TOD) */
class RsPhotoRefItem
{
public:
RsPhotoRefItem();
std::string photoId;
std::wstring altComment;
uint32_t deltaT; /* in 100ths of sec? */
};
class RsPhotoShowItem: public RsItem
{
public:
RsPhotoShowItem()
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM) { return; }
virtual ~RsPhotoShowItem() { return; }
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
std::string showId;
std::string name;
std::wstring comment;
std::string location; /* TODO -> TLV */
std::string date; /* TODO -> TLV */
std::list<RsPhotoRefItem> photos; /* list as ordered */
};
class RsPhotoSerialiser: public RsSerialType
{
public:
RsPhotoSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PHOTO)
{ return; }
virtual ~RsPhotoSerialiser()
{ return; }
virtual uint32_t size(RsItem *) { return 0; }
virtual bool serialise (RsItem */*item*/, void */*data*/, uint32_t */*size*/) { return false; }
virtual RsItem * deserialise(void */*data*/, uint32_t */*size*/) { return NULL; }
private:
/* For RS_PKT_SUBTYPE_PHOTO_ITEM */
//virtual uint32_t sizeLink(RsPhotoItem *);
//virtual bool serialiseLink (RsPhotoItem *item, void *data, uint32_t *size);
//virtual RsPhotoItem *deserialiseLink(void *data, uint32_t *size);
/* For RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM */
//virtual uint32_t sizeLink(RsPhotoShowItem *);
//virtual bool serialiseLink (RsPhotoShowItem *item, void *data, uint32_t *size);
//virtual RsPhotoShowItem *deserialiseLink(void *data, uint32_t *size);
/* For RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM */
//virtual uint32_t sizeLink(RsPhotoCommentItem *);
//virtual bool serialiseLink (RsPhotoCommentItem *item, void *data, uint32_t *size);
//virtual RsPhotoCommentItem *deserialiseLink(void *data, uint32_t *size);
};
/**************************************************************************/
#endif /* RS_PHOTO_ITEMS_H */

View File

@ -88,7 +88,7 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
uint32_t rstype = getRsItemId(data); uint32_t rstype = getRsItemId(data);
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype))) (RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)))
{ {
return NULL; /* wrong type */ return NULL; /* wrong type */
} }
@ -175,7 +175,7 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item,
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhen); ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhen);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere); ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mWhere);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type); ok &= SetTlvString(data, tlvsize, &offset, 1, item->album.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size); b.setBinData(item->album.mThumbnail.data, item->album.mThumbnail.size);
ok &= b.SetTlv(data, tlvsize, &offset); ok &= b.SetTlv(data, tlvsize, &offset);
@ -213,7 +213,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) || (RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_ITEM != getRsItemSubType(rstype))) (RS_PKT_SUBTYPE_PHOTO_ITEM != getRsItemSubType(rstype)))
{ {
#ifdef GXS_PHOTO_SERIAL_DEBUG #ifdef GXS_PHOTO_SERIAL_DEBUG
@ -251,7 +251,7 @@ RsGxsPhotoAlbumItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoAlbumItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhere); ok &= GetTlvString(data, rssize, &offset, 1, item->album.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type); ok &= GetTlvString(data, rssize, &offset, 1, item->album.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset); ok &= b.GetTlv(data, rssize, &offset);
item->album.mThumbnail.data = (uint8_t*)b.bin_data; item->album.mThumbnail.data = (uint8_t*)b.bin_data;
item->album.mThumbnail.size = b.bin_len; item->album.mThumbnail.size = b.bin_len;
@ -341,7 +341,7 @@ bool RsGxsPhotoSerialiser::serialiseGxsPhotoPhotoItem(RsGxsPhotoPhotoItem* item,
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhen); ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhen);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere); ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mWhere);
ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type); ok &= SetTlvString(data, tlvsize, &offset, 1, item->photo.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size); b.setBinData(item->photo.mThumbnail.data, item->photo.mThumbnail.size);
ok &= b.SetTlv(data, tlvsize, &offset); ok &= b.SetTlv(data, tlvsize, &offset);
@ -379,7 +379,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) || if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_TYPE_PHOTO != getRsItemService(rstype)) || (RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM != getRsItemSubType(rstype))) (RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM != getRsItemSubType(rstype)))
{ {
#ifdef GXS_PHOTO_SERIAL_DEBUG #ifdef GXS_PHOTO_SERIAL_DEBUG
@ -415,7 +415,7 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhere); ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mWhere);
ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type); ok &= GetTlvString(data, rssize, &offset, 1, item->photo.mThumbnail.type);
RsTlvBinaryData b(RS_SERVICE_TYPE_PHOTO); // TODO, need something more persisitent RsTlvBinaryData b(RS_SERVICE_GXSV1_TYPE_PHOTO); // TODO, need something more persisitent
ok &= b.GetTlv(data, rssize, &offset); ok &= b.GetTlv(data, rssize, &offset);
item->photo.mThumbnail.data = (uint8_t*)(b.bin_data); item->photo.mThumbnail.data = (uint8_t*)(b.bin_data);
item->photo.mThumbnail.size = b.bin_len; item->photo.mThumbnail.size = b.bin_len;

View File

@ -33,16 +33,19 @@
#include "serialiser/rstlvtypes.h" #include "serialiser/rstlvtypes.h"
#include "rsgxsitems.h" #include "rsgxsitems.h"
#include "rsphotoitems.h" //#include "rsphotoitems.h"
#include "retroshare/rsphotoV2.h" #include "retroshare/rsphotoV2.h"
const uint8_t RS_PKT_SUBTYPE_PHOTO_ITEM = 0x02;
const uint8_t RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM = 0x03;
const uint8_t RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM = 0x04;
class RsGxsPhotoAlbumItem : public RsGxsGrpItem class RsGxsPhotoAlbumItem : public RsGxsGrpItem
{ {
public: public:
RsGxsPhotoAlbumItem(): RsGxsGrpItem(RS_SERVICE_TYPE_PHOTO, RsGxsPhotoAlbumItem(): RsGxsGrpItem(RS_SERVICE_GXSV1_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_ITEM) { return;} RS_PKT_SUBTYPE_PHOTO_ITEM) { return;}
virtual ~RsGxsPhotoAlbumItem() { return;} virtual ~RsGxsPhotoAlbumItem() { return;}
@ -57,7 +60,7 @@ class RsGxsPhotoPhotoItem : public RsGxsMsgItem
{ {
public: public:
RsGxsPhotoPhotoItem(): RsGxsMsgItem(RS_SERVICE_TYPE_PHOTO, RsGxsPhotoPhotoItem(): RsGxsMsgItem(RS_SERVICE_GXSV1_TYPE_PHOTO,
RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM) {return; } RS_PKT_SUBTYPE_PHOTO_SHOW_ITEM) {return; }
virtual ~RsGxsPhotoPhotoItem() { return;} virtual ~RsGxsPhotoPhotoItem() { return;}
void clear(); void clear();
@ -70,7 +73,7 @@ class RsGxsPhotoSerialiser : public RsSerialType
public: public:
RsGxsPhotoSerialiser() RsGxsPhotoSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_PHOTO) :RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_GXSV1_TYPE_PHOTO)
{ return; } { return; }
virtual ~RsGxsPhotoSerialiser() { return; } virtual ~RsGxsPhotoSerialiser() { return; }

View File

@ -108,13 +108,6 @@ const uint16_t RS_SERVICE_TYPE_DSDV = 0xf050;
const uint16_t RS_SERVICE_TYPE_BWCTRL = 0xf060; const uint16_t RS_SERVICE_TYPE_BWCTRL = 0xf060;
/* New Cache Services */
const uint16_t RS_SERVICE_TYPE_IDENTITY = 0xf100;
const uint16_t RS_SERVICE_TYPE_PHOTO = 0xf101;
const uint16_t RS_SERVICE_TYPE_WIKI = 0xf102;
const uint16_t RS_SERVICE_TYPE_WIRE = 0xf103;
const uint16_t RS_SERVICE_TYPE_FORUMSV2 = 0xf104;
const uint16_t RS_SERVICE_TYPE_POSTED = 0xf105;
//const uint16_t RS_SERVICE_TYPE_DISTRIB = 0xf110; //const uint16_t RS_SERVICE_TYPE_DISTRIB = 0xf110;
//const uint16_t RS_SERVICE_TYPE_FORUM = 0xf120; //const uint16_t RS_SERVICE_TYPE_FORUM = 0xf120;
@ -134,9 +127,33 @@ const uint16_t RS_SERVICE_TYPE_GAME_QGO = 0xf212;
const uint16_t RS_SERVICE_TYPE_GAME_BIGTWO = 0xf213; const uint16_t RS_SERVICE_TYPE_GAME_BIGTWO = 0xf213;
const uint16_t RS_SERVICE_TYPE_GAME_POKER = 0xf214; const uint16_t RS_SERVICE_TYPE_GAME_POKER = 0xf214;
/* New Cache Services */
/* Rs Network Exchange Service */ /* Rs Network Exchange Service */
const uint16_t RS_SERVICE_TYPE_NXS = 0xf300; const uint16_t RS_SERVICE_TYPE_NXS = 0xf300;
const uint16_t RS_SERVICE_GXSV1_TYPE_IDENTITY = 0xf301;
const uint16_t RS_SERVICE_GXSV1_TYPE_PHOTO = 0xf302;
const uint16_t RS_SERVICE_GXSV1_TYPE_WIKI = 0xf303;
const uint16_t RS_SERVICE_GXSV1_TYPE_WIRE = 0xf304;
const uint16_t RS_SERVICE_GXSV1_TYPE_FORUMS = 0xf305;
const uint16_t RS_SERVICE_GXSV1_TYPE_POSTED = 0xf306;
const uint16_t RS_SERVICE_GXSV1_TYPE_CHANNELS = 0xf307;
const uint16_t RS_SERVICE_GXSV2_TYPE_IDENTITY = 0xf311;
const uint16_t RS_SERVICE_GXSV2_TYPE_PHOTO = 0xf312;
const uint16_t RS_SERVICE_GXSV2_TYPE_WIKI = 0xf313;
const uint16_t RS_SERVICE_GXSV2_TYPE_WIRE = 0xf314;
const uint16_t RS_SERVICE_GXSV2_TYPE_FORUMS = 0xf315;
const uint16_t RS_SERVICE_GXSV2_TYPE_POSTED = 0xf316;
const uint16_t RS_SERVICE_GXSV2_TYPE_CHANNELS = 0xf317;
/* Example Versions (VEG) of New Cache Services */
const uint16_t RS_SERVICE_VEG_TYPE_IDENTITY = 0xf320;
const uint16_t RS_SERVICE_VEG_TYPE_PHOTO = 0xf321;
const uint16_t RS_SERVICE_VEG_TYPE_WIKI = 0xf322;
const uint16_t RS_SERVICE_VEG_TYPE_WIRE = 0xf323;
const uint16_t RS_SERVICE_VEG_TYPE_FORUMS = 0xf324;
const uint16_t RS_SERVICE_VEG_TYPE_POSTED = 0xf325;
/***************** IDS ALLOCATED FOR PLUGINS ******************/ /***************** IDS ALLOCATED FOR PLUGINS ******************/

View File

@ -23,7 +23,7 @@
* *
*/ */
#include "services/p3forumsv2.h" #include "services/p3forumsVEG.h"
#include "util/rsrandom.h" #include "util/rsrandom.h"
#include <stdio.h> #include <stdio.h>
@ -32,7 +32,7 @@
* #define FORUMV2_DEBUG 1 * #define FORUMV2_DEBUG 1
****/ ****/
RsForumsV2 *rsForumsV2 = NULL; RsForumsVEG *rsForumsVEG = NULL;
@ -40,8 +40,8 @@ RsForumsV2 *rsForumsV2 = NULL;
/******************* Startup / Tick ******************************************/ /******************* Startup / Tick ******************************************/
/********************************************************************************/ /********************************************************************************/
p3ForumsV2::p3ForumsV2(uint16_t type) p3ForumsVEG::p3ForumsVEG(uint16_t type)
:p3GxsDataService(type, new ForumDataProxy()), mForumMtx("p3ForumsV2"), mUpdated(true) :p3GxsDataServiceVEG(type, new ForumDataProxy()), mForumMtx("p3ForumsV2"), mUpdated(true)
{ {
{ {
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
@ -55,9 +55,9 @@ p3ForumsV2::p3ForumsV2(uint16_t type)
} }
int p3ForumsV2::tick() int p3ForumsVEG::tick()
{ {
//std::cerr << "p3ForumsV2::tick()"; //std::cerr << "p3ForumsVEG::tick()";
//std::cerr << std::endl; //std::cerr << std::endl;
fakeprocessrequests(); fakeprocessrequests();
@ -65,7 +65,7 @@ int p3ForumsV2::tick()
return 0; return 0;
} }
bool p3ForumsV2::updated() bool p3ForumsVEG::updated()
{ {
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
@ -80,35 +80,35 @@ bool p3ForumsV2::updated()
/* Data Requests */ /* Data Requests */
bool p3ForumsV2::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3ForumsVEG::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3ForumsV2::requestGroupInfo() gets Token: " << token << std::endl; std::cerr << "p3ForumsVEG::requestGroupInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
} }
bool p3ForumsV2::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3ForumsVEG::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3ForumsV2::requestMsgInfo() gets Token: " << token << std::endl; std::cerr << "p3ForumsVEG::requestMsgInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds);
return true; return true;
} }
bool p3ForumsV2::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) bool p3ForumsVEG::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3ForumsV2::requestMsgRelatedInfo() gets Token: " << token << std::endl; std::cerr << "p3ForumsVEG::requestMsgRelatedInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
} }
/* Generic Lists */ /* Generic Lists */
bool p3ForumsV2::getGroupList( const uint32_t &token, std::list<std::string> &groupIds) bool p3ForumsVEG::getGroupList( const uint32_t &token, std::list<std::string> &groupIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -118,19 +118,19 @@ bool p3ForumsV2::getGroupList( const uint32_t &token, std::list<std::str
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3ForumsV2::getGroupList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3ForumsV2::getGroupList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getGroupList() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getGroupList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -143,7 +143,7 @@ bool p3ForumsV2::getGroupList( const uint32_t &token, std::list<std::str
bool p3ForumsV2::getMsgList( const uint32_t &token, std::list<std::string> &msgIds) bool p3ForumsVEG::getMsgList( const uint32_t &token, std::list<std::string> &msgIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -153,19 +153,19 @@ bool p3ForumsV2::getMsgList( const uint32_t &token, std::list<std::str
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3ForumsV2::getMsgList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3ForumsV2::getMsgList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getMsgList() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getMsgList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -177,7 +177,7 @@ bool p3ForumsV2::getMsgList( const uint32_t &token, std::list<std::str
/* Generic Summary */ /* Generic Summary */
bool p3ForumsV2::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) bool p3ForumsVEG::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -187,19 +187,19 @@ bool p3ForumsV2::getGroupSummary( const uint32_t &token, std::list<RsGroupM
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3ForumsV2::getGroupSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3ForumsV2::getGroupSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getGroupSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getGroupSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -213,7 +213,7 @@ bool p3ForumsV2::getGroupSummary( const uint32_t &token, std::list<RsGroupM
return ans; return ans;
} }
bool p3ForumsV2::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) bool p3ForumsVEG::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -223,19 +223,19 @@ bool p3ForumsV2::getMsgSummary( const uint32_t &token, std::list<RsMsgMet
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3ForumsV2::getMsgSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3ForumsV2::getMsgSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getMsgSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getMsgSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -251,7 +251,7 @@ bool p3ForumsV2::getMsgSummary( const uint32_t &token, std::list<RsMsgMet
/* Specific Service Data */ /* Specific Service Data */
bool p3ForumsV2::getGroupData(const uint32_t &token, RsForumV2Group &group) bool p3ForumsVEG::getGroupData(const uint32_t &token, RsForumV2Group &group)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -262,19 +262,19 @@ bool p3ForumsV2::getGroupData(const uint32_t &token, RsForumV2Group &group)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3ForumsV2::getGroupData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3ForumsV2::getGroupData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getGroupData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getGroupData() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getGroupData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -292,7 +292,7 @@ bool p3ForumsV2::getGroupData(const uint32_t &token, RsForumV2Group &group)
} }
bool p3ForumsV2::getMsgData(const uint32_t &token, RsForumV2Msg &msg) bool p3ForumsVEG::getMsgData(const uint32_t &token, RsForumV2Msg &msg)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -303,19 +303,19 @@ bool p3ForumsV2::getMsgData(const uint32_t &token, RsForumV2Msg &msg)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3ForumsV2::getMsgData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3ForumsV2::getMsgData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3ForumsVEG::getMsgData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3ForumsV2::getMsgData() ERROR Status Incomplete" << std::endl; std::cerr << "p3ForumsVEG::getMsgData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -335,7 +335,7 @@ bool p3ForumsV2::getMsgData(const uint32_t &token, RsForumV2Msg &msg)
/* Poll */ /* Poll */
uint32_t p3ForumsV2::requestStatus(const uint32_t token) uint32_t p3ForumsVEG::requestStatus(const uint32_t token)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -348,46 +348,46 @@ uint32_t p3ForumsV2::requestStatus(const uint32_t token)
/* Cancel Request */ /* Cancel Request */
bool p3ForumsV2::cancelRequest(const uint32_t &token) bool p3ForumsVEG::cancelRequest(const uint32_t &token)
{ {
return clearRequest(token); return clearRequest(token);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
bool p3ForumsV2::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) bool p3ForumsVEG::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{ {
return mForumProxy->setMessageStatus(msgId, status, statusMask); return mForumProxy->setMessageStatus(msgId, status, statusMask);
} }
bool p3ForumsV2::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask) bool p3ForumsVEG::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{ {
return mForumProxy->setGroupStatus(groupId, status, statusMask); return mForumProxy->setGroupStatus(groupId, status, statusMask);
} }
bool p3ForumsV2::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) bool p3ForumsVEG::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{ {
return mForumProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask); return mForumProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
} }
bool p3ForumsV2::setMessageServiceString(const std::string &msgId, const std::string &str) bool p3ForumsVEG::setMessageServiceString(const std::string &msgId, const std::string &str)
{ {
return mForumProxy->setMessageServiceString(msgId, str); return mForumProxy->setMessageServiceString(msgId, str);
} }
bool p3ForumsV2::setGroupServiceString(const std::string &grpId, const std::string &str) bool p3ForumsVEG::setGroupServiceString(const std::string &grpId, const std::string &str)
{ {
return mForumProxy->setGroupServiceString(grpId, str); return mForumProxy->setGroupServiceString(grpId, str);
} }
bool p3ForumsV2::groupRestoreKeys(const std::string &groupId) bool p3ForumsVEG::groupRestoreKeys(const std::string &groupId)
{ {
return false; return false;
} }
bool p3ForumsV2::groupShareKeys(const std::string &groupId, std::list<std::string>& peers) bool p3ForumsVEG::groupShareKeys(const std::string &groupId, std::list<std::string>& peers)
{ {
return false; return false;
} }
@ -398,7 +398,7 @@ bool p3ForumsV2::groupShareKeys(const std::string &groupId, std::list<std::strin
/********************************************************************************************/ /********************************************************************************************/
std::string p3ForumsV2::genRandomId() std::string p3ForumsVEG::genRandomId()
{ {
std::string randomId; std::string randomId;
for(int i = 0; i < 20; i++) for(int i = 0; i < 20; i++)
@ -409,7 +409,7 @@ std::string p3ForumsV2::genRandomId()
return randomId; return randomId;
} }
bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew) bool p3ForumsVEG::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
{ {
if (group.mMeta.mGroupId.empty()) if (group.mMeta.mGroupId.empty())
{ {
@ -420,7 +420,7 @@ bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
} }
else else
{ {
std::cerr << "p3ForumsV2::createGroup() Group with existing Id... dropping"; std::cerr << "p3ForumsVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -435,11 +435,11 @@ bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
// Fake a request to return the GroupMetaData. // Fake a request to return the GroupMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds; std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one. groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3ForumsV2::createGroup() Generating Request Token: " << token << std::endl; std::cerr << "p3ForumsVEG::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
@ -448,12 +448,12 @@ bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew) bool p3ForumsVEG::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
{ {
if (msg.mMeta.mGroupId.empty()) if (msg.mMeta.mGroupId.empty())
{ {
/* new photo */ /* new photo */
std::cerr << "p3ForumsV2::createForumMsg() Missing MsgID"; std::cerr << "p3ForumsVEG::createForumMsg() Missing MsgID";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -461,7 +461,7 @@ bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
/* check if its a mod or new msg */ /* check if its a mod or new msg */
if (msg.mMeta.mOrigMsgId.empty()) if (msg.mMeta.mOrigMsgId.empty())
{ {
std::cerr << "p3ForumsV2::createForumMsg() New Msg"; std::cerr << "p3ForumsVEG::createForumMsg() New Msg";
std::cerr << std::endl; std::cerr << std::endl;
/* new msg, generate a new OrigMsgId */ /* new msg, generate a new OrigMsgId */
@ -470,18 +470,18 @@ bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
} }
else else
{ {
std::cerr << "p3ForumsV2::createForumMsg() Modified Msg"; std::cerr << "p3ForumsVEG::createForumMsg() Modified Msg";
std::cerr << std::endl; std::cerr << std::endl;
/* mod msg, keep orig msg id, generate a new MsgId */ /* mod msg, keep orig msg id, generate a new MsgId */
msg.mMeta.mMsgId = genRandomId(); msg.mMeta.mMsgId = genRandomId();
} }
std::cerr << "p3ForumsV2::createForumMsg() GroupId: " << msg.mMeta.mGroupId; std::cerr << "p3ForumsVEG::createForumMsg() GroupId: " << msg.mMeta.mGroupId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3ForumsV2::createForumMsg() MsgId: " << msg.mMeta.mMsgId; std::cerr << "p3ForumsVEG::createForumMsg() MsgId: " << msg.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3ForumsV2::createForumMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId; std::cerr << "p3ForumsVEG::createForumMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId;
std::cerr << std::endl; std::cerr << std::endl;
{ {
@ -494,11 +494,11 @@ bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
// Fake a request to return the MsgMetaData. // Fake a request to return the MsgMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds; std::list<std::string> msgIds;
msgIds.push_back(msg.mMeta.mMsgId); // It will just return this one. msgIds.push_back(msg.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3ForumsV2::createMsg() Generating Request Token: " << token << std::endl; std::cerr << "p3ForumsVEG::createMsg() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
@ -609,7 +609,7 @@ bool ForumDataProxy::convertMsgToMetaData(void *msgData, RsMsgMetaData &meta)
bool p3ForumsV2::generateDummyData() bool p3ForumsVEG::generateDummyData()
{ {
/* so we want to generate 100's of forums */ /* so we want to generate 100's of forums */
#define MAX_FORUMS 10 //100 #define MAX_FORUMS 10 //100
@ -673,7 +673,7 @@ bool p3ForumsV2::generateDummyData()
mGroups.push_back(forum); mGroups.push_back(forum);
//std::cerr << "p3ForumsV2::generateDummyData() Generated Forum: " << forum.mMeta; //std::cerr << "p3ForumsVEG::generateDummyData() Generated Forum: " << forum.mMeta;
//std::cerr << std::endl; //std::cerr << std::endl;
} }
@ -725,7 +725,7 @@ bool p3ForumsV2::generateDummyData()
mMsgs.push_back(msg); mMsgs.push_back(msg);
//std::cerr << "p3ForumsV2::generateDummyData() Generated Thread: " << msg.mMeta; //std::cerr << "p3ForumsVEG::generateDummyData() Generated Thread: " << msg.mMeta;
//std::cerr << std::endl; //std::cerr << std::endl;
} }
@ -778,7 +778,7 @@ bool p3ForumsV2::generateDummyData()
mMsgs.push_back(msg); mMsgs.push_back(msg);
//std::cerr << "p3ForumsV2::generateDummyData() Generated Child Msg: " << msg.mMeta; //std::cerr << "p3ForumsVEG::generateDummyData() Generated Child Msg: " << msg.mMeta;
//std::cerr << std::endl; //std::cerr << std::endl;
} }

View File

@ -26,9 +26,9 @@
#ifndef P3_FORUMSV2_SERVICE_HEADER #ifndef P3_FORUMSV2_SERVICE_HEADER
#define P3_FORUMSV2_SERVICE_HEADER #define P3_FORUMSV2_SERVICE_HEADER
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
#include "retroshare/rsforumsv2.h" #include "retroshare/rsforumsVEG.h"
#include <map> #include <map>
#include <string> #include <string>
@ -37,7 +37,7 @@
* *
*/ */
class ForumDataProxy: public GxsDataProxy class ForumDataProxy: public GxsDataProxyVEG
{ {
public: public:
@ -57,11 +57,11 @@ virtual bool convertMsgToMetaData(void *msgData, RsMsgMetaData &meta);
class p3ForumsV2: public p3GxsDataService, public RsForumsV2 class p3ForumsVEG: public p3GxsDataServiceVEG, public RsForumsVEG
{ {
public: public:
p3ForumsV2(uint16_t type); p3ForumsVEG(uint16_t type);
virtual int tick(); virtual int tick();
@ -72,9 +72,9 @@ virtual bool updated();
/* Data Requests */ /* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds); virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */ /* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds); virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);

View File

@ -23,16 +23,16 @@
* *
*/ */
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
p3GxsService::p3GxsService(uint16_t type) p3GxsServiceVEG::p3GxsServiceVEG(uint16_t type)
:p3Service(type), mReqMtx("p3GxsService") :p3Service(type), mReqMtx("p3GxsService")
{ {
mNextToken = 0; mNextToken = 0;
return; return;
} }
bool p3GxsService::generateToken(uint32_t &token) bool p3GxsServiceVEG::generateToken(uint32_t &token)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -41,7 +41,7 @@ bool p3GxsService::generateToken(uint32_t &token)
return true; return true;
} }
bool p3GxsService::storeRequest(const uint32_t &token, const uint32_t &ansType, const RsTokReqOptions &opts, const uint32_t &type, const std::list<std::string> &ids) bool p3GxsServiceVEG::storeRequest(const uint32_t &token, const uint32_t &ansType, const RsTokReqOptionsVEG &opts, const uint32_t &type, const std::list<std::string> &ids)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -60,7 +60,7 @@ bool p3GxsService::storeRequest(const uint32_t &token, const uint32_t &ansTyp
} }
bool p3GxsService::clearRequest(const uint32_t &token) bool p3GxsServiceVEG::clearRequest(const uint32_t &token)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -77,7 +77,7 @@ bool p3GxsService::clearRequest(const uint32_t &token)
return true; return true;
} }
bool p3GxsService::updateRequestStatus(const uint32_t &token, const uint32_t &status) bool p3GxsServiceVEG::updateRequestStatus(const uint32_t &token, const uint32_t &status)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -94,7 +94,7 @@ bool p3GxsService::updateRequestStatus(const uint32_t &token, const uint32_t &st
return true; return true;
} }
bool p3GxsService::updateRequestInList(const uint32_t &token, std::list<std::string> ids) bool p3GxsServiceVEG::updateRequestInList(const uint32_t &token, std::list<std::string> ids)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -116,7 +116,7 @@ bool p3GxsService::updateRequestInList(const uint32_t &token, std::list<std::str
} }
bool p3GxsService::updateRequestOutList(const uint32_t &token, std::list<std::string> ids) bool p3GxsServiceVEG::updateRequestOutList(const uint32_t &token, std::list<std::string> ids)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -138,7 +138,7 @@ bool p3GxsService::updateRequestOutList(const uint32_t &token, std::list<std::st
} }
#if 0 #if 0
bool p3GxsService::updateRequestData(const uint32_t &token, std::map<std::string, void *> data) bool p3GxsServiceVEG::updateRequestData(const uint32_t &token, std::map<std::string, void *> data)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -160,7 +160,7 @@ bool p3GxsService::updateRequestData(const uint32_t &token, std::map<std::string
} }
#endif #endif
bool p3GxsService::checkRequestStatus(const uint32_t &token, uint32_t &status, uint32_t &reqtype, uint32_t &anstype, time_t &ts) bool p3GxsServiceVEG::checkRequestStatus(const uint32_t &token, uint32_t &status, uint32_t &reqtype, uint32_t &anstype, time_t &ts)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -182,7 +182,7 @@ bool p3GxsService::checkRequestStatus(const uint32_t &token, uint32_t &status
// special ones for testing (not in final design) // special ones for testing (not in final design)
bool p3GxsService::tokenList(std::list<uint32_t> &tokens) bool p3GxsServiceVEG::tokenList(std::list<uint32_t> &tokens)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -196,7 +196,7 @@ bool p3GxsService::tokenList(std::list<uint32_t> &tokens)
return true; return true;
} }
bool p3GxsService::popRequestInList(const uint32_t &token, std::string &id) bool p3GxsServiceVEG::popRequestInList(const uint32_t &token, std::string &id)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -220,7 +220,7 @@ bool p3GxsService::popRequestInList(const uint32_t &token, std::string &id)
} }
bool p3GxsService::popRequestOutList(const uint32_t &token, std::string &id) bool p3GxsServiceVEG::popRequestOutList(const uint32_t &token, std::string &id)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -244,7 +244,7 @@ bool p3GxsService::popRequestOutList(const uint32_t &token, std::string &id)
} }
bool p3GxsService::loadRequestOutList(const uint32_t &token, std::list<std::string> &ids) bool p3GxsServiceVEG::loadRequestOutList(const uint32_t &token, std::list<std::string> &ids)
{ {
RsStackMutex stack(mReqMtx); /****** LOCKED *****/ RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -270,7 +270,7 @@ bool p3GxsService::loadRequestOutList(const uint32_t &token, std::list<std::s
#define MAX_REQUEST_AGE 10 #define MAX_REQUEST_AGE 10
bool p3GxsService::fakeprocessrequests() bool p3GxsServiceVEG::fakeprocessrequests()
{ {
std::list<uint32_t>::iterator it; std::list<uint32_t>::iterator it;
std::list<uint32_t> tokens; std::list<uint32_t> tokens;
@ -287,7 +287,7 @@ bool p3GxsService::fakeprocessrequests()
time_t ts; time_t ts;
checkRequestStatus(token, status, reqtype, anstype, ts); checkRequestStatus(token, status, reqtype, anstype, ts);
std::cerr << "p3GxsService::fakeprocessrequests() Token: " << token << " Status: " << status << " ReqType: " << reqtype << "Age: " << now - ts << std::endl; std::cerr << "p3GxsServiceVEG::fakeprocessrequests() Token: " << token << " Status: " << status << " ReqType: " << reqtype << "Age: " << now - ts << std::endl;
if (status == GXS_REQUEST_STATUS_PENDING) if (status == GXS_REQUEST_STATUS_PENDING)
{ {
@ -299,13 +299,13 @@ bool p3GxsService::fakeprocessrequests()
} }
else if (status == GXS_REQUEST_STATUS_DONE) else if (status == GXS_REQUEST_STATUS_DONE)
{ {
std::cerr << "p3GxsService::fakeprocessrequests() Clearing Done Request Token: " << token; std::cerr << "p3GxsServiceVEG::fakeprocessrequests() Clearing Done Request Token: " << token;
std::cerr << std::endl; std::cerr << std::endl;
clearRequest(token); clearRequest(token);
} }
else if (now - ts > MAX_REQUEST_AGE) else if (now - ts > MAX_REQUEST_AGE)
{ {
std::cerr << "p3GxsService::fakeprocessrequests() Clearing Old Request Token: " << token; std::cerr << "p3GxsServiceVEG::fakeprocessrequests() Clearing Old Request Token: " << token;
std::cerr << std::endl; std::cerr << std::endl;
clearRequest(token); clearRequest(token);
} }
@ -334,14 +334,14 @@ bool p3GxsService::fakeprocessrequests()
* *
****/ ****/
GxsDataProxy::GxsDataProxy() GxsDataProxyVEG::GxsDataProxyVEG()
:mDataMtx("GxsDataProxyMtx") :mDataMtx("GxsDataProxyMtx")
{ {
return; return;
} }
static bool checkGroupFilter(const RsTokReqOptions &opts, const RsGroupMetaData &group) static bool checkGroupFilter(const RsTokReqOptionsVEG &opts, const RsGroupMetaData &group)
{ {
bool statusMatch = false; bool statusMatch = false;
if (opts.mStatusMask) if (opts.mStatusMask)
@ -428,7 +428,7 @@ static bool checkGroupFilter(const RsTokReqOptions &opts, const RsGroupMetaData
} }
static bool checkMsgFilter(const RsTokReqOptions &opts, const RsMsgMetaData &msg) static bool checkMsgFilter(const RsTokReqOptionsVEG &opts, const RsMsgMetaData &msg)
{ {
bool statusMatch = false; bool statusMatch = false;
if (opts.mStatusMask) if (opts.mStatusMask)
@ -488,7 +488,7 @@ static bool checkMsgFilter(const RsTokReqOptions &opts, const RsMsgMetaData &msg
} }
bool GxsDataProxy::filterGroupList(const RsTokReqOptions &opts, std::list<std::string> &groupIds) bool GxsDataProxyVEG::filterGroupList(const RsTokReqOptionsVEG &opts, std::list<std::string> &groupIds)
{ {
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
for(it = groupIds.begin(); it != groupIds.end(); ) for(it = groupIds.begin(); it != groupIds.end(); )
@ -517,7 +517,7 @@ bool GxsDataProxy::filterGroupList(const RsTokReqOptions &opts, std::list<std::s
} }
bool GxsDataProxy::filterMsgList(const RsTokReqOptions &opts, std::list<std::string> &msgIds) bool GxsDataProxyVEG::filterMsgList(const RsTokReqOptionsVEG &opts, std::list<std::string> &msgIds)
{ {
std::list<std::string>::iterator it; std::list<std::string>::iterator it;
for(it = msgIds.begin(); it != msgIds.end(); ) for(it = msgIds.begin(); it != msgIds.end(); )
@ -547,14 +547,14 @@ bool GxsDataProxy::filterMsgList(const RsTokReqOptions &opts, std::list<std::str
bool GxsDataProxy::getGroupList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds, std::list<std::string> &outGroupIds) bool GxsDataProxyVEG::getGroupList( uint32_t &token, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds, std::list<std::string> &outGroupIds)
{ {
/* CASEs that this handles ... /* CASEs that this handles ...
* 1) if groupIds is Empty... return all groupIds. * 1) if groupIds is Empty... return all groupIds.
* 2) else copy list. * 2) else copy list.
* *
*/ */
std::cerr << "GxsDataProxy::getGroupList()"; std::cerr << "GxsDataProxyVEG::getGroupList()";
std::cerr << std::endl; std::cerr << std::endl;
if (groupIds.size() == 0) if (groupIds.size() == 0)
@ -579,14 +579,14 @@ bool GxsDataProxy::getGroupList( uint32_t &token, const RsTokReqOptions &opt
} }
bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds, std::list<std::string> &outMsgIds) bool GxsDataProxyVEG::getMsgList( uint32_t &token, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds, std::list<std::string> &outMsgIds)
{ {
/* CASEs this handles. /* CASEs this handles.
* Input is groupList + Flags. * Input is groupList + Flags.
* 1) No Flags => All Messages in those Groups. * 1) No Flags => All Messages in those Groups.
* *
*/ */
std::cerr << "GxsDataProxy::getMsgList()"; std::cerr << "GxsDataProxyVEG::getMsgList()";
std::cerr << std::endl; std::cerr << std::endl;
@ -597,20 +597,20 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
// Can only choose one of these two. // Can only choose one of these two.
if (opts.mOptions & RS_TOKREQOPT_MSG_ORIGMSG) if (opts.mOptions & RS_TOKREQOPT_MSG_ORIGMSG)
{ {
std::cerr << "GxsDataProxy::getMsgList() MSG_ORIGMSG"; std::cerr << "GxsDataProxyVEG::getMsgList() MSG_ORIGMSG";
std::cerr << std::endl; std::cerr << std::endl;
onlyOrigMsgs = true; onlyOrigMsgs = true;
} }
else if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST) else if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST)
{ {
std::cerr << "GxsDataProxy::getMsgList() MSG_LATEST"; std::cerr << "GxsDataProxyVEG::getMsgList() MSG_LATEST";
std::cerr << std::endl; std::cerr << std::endl;
onlyLatestMsgs = true; onlyLatestMsgs = true;
} }
if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD) if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD)
{ {
std::cerr << "GxsDataProxy::getMsgList() MSG_THREAD"; std::cerr << "GxsDataProxyVEG::getMsgList() MSG_THREAD";
std::cerr << std::endl; std::cerr << std::endl;
onlyThreadHeadMsgs = true; onlyThreadHeadMsgs = true;
} }
@ -648,7 +648,7 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
bool addMsg = false; bool addMsg = false;
if (oit == origMsgTs.end()) if (oit == origMsgTs.end())
{ {
std::cerr << "GxsDataProxy::getMsgList() Found New OrigMsgId: "; std::cerr << "GxsDataProxyVEG::getMsgList() Found New OrigMsgId: ";
std::cerr << mit->second.mOrigMsgId; std::cerr << mit->second.mOrigMsgId;
std::cerr << " MsgId: " << mit->second.mMsgId; std::cerr << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs; std::cerr << " TS: " << mit->second.mPublishTs;
@ -659,7 +659,7 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
// check timestamps. // check timestamps.
else if (oit->second.second < mit->second.mPublishTs) else if (oit->second.second < mit->second.mPublishTs)
{ {
std::cerr << "GxsDataProxy::getMsgList() Found Later Msg. OrigMsgId: "; std::cerr << "GxsDataProxyVEG::getMsgList() Found Later Msg. OrigMsgId: ";
std::cerr << mit->second.mOrigMsgId; std::cerr << mit->second.mOrigMsgId;
std::cerr << " MsgId: " << mit->second.mMsgId; std::cerr << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs; std::cerr << " TS: " << mit->second.mPublishTs;
@ -728,7 +728,7 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
} }
bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &msgIds, std::list<std::string> &outMsgIds) bool GxsDataProxyVEG::getMsgRelatedList(uint32_t &token, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds, std::list<std::string> &outMsgIds)
{ {
/* CASEs this handles. /* CASEs this handles.
* Input is msgList + Flags. * Input is msgList + Flags.
@ -736,7 +736,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
* *
*/ */
std::cerr << "GxsDataProxy::getMsgRelatedList()"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList()";
std::cerr << std::endl; std::cerr << std::endl;
bool onlyLatestMsgs = false; bool onlyLatestMsgs = false;
@ -746,34 +746,34 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST) if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_LATEST"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_LATEST";
std::cerr << std::endl; std::cerr << std::endl;
onlyLatestMsgs = true; onlyLatestMsgs = true;
} }
else if (opts.mOptions & RS_TOKREQOPT_MSG_VERSIONS) else if (opts.mOptions & RS_TOKREQOPT_MSG_VERSIONS)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_VERSIONS"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_VERSIONS";
std::cerr << std::endl; std::cerr << std::endl;
onlyAllVersions = true; onlyAllVersions = true;
} }
if (opts.mOptions & RS_TOKREQOPT_MSG_PARENT) if (opts.mOptions & RS_TOKREQOPT_MSG_PARENT)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_PARENTS"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_PARENTS";
std::cerr << std::endl; std::cerr << std::endl;
onlyChildMsgs = true; onlyChildMsgs = true;
} }
if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD) if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_THREAD"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_THREAD";
std::cerr << std::endl; std::cerr << std::endl;
onlyThreadMsgs = true; onlyThreadMsgs = true;
} }
if (onlyAllVersions && onlyChildMsgs) if (onlyAllVersions && onlyChildMsgs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & PARENT)"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & PARENT)";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
@ -781,7 +781,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if (onlyAllVersions && onlyThreadMsgs) if (onlyAllVersions && onlyThreadMsgs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & THREAD)"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & THREAD)";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
@ -789,7 +789,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if ((!onlyLatestMsgs) && onlyChildMsgs) if ((!onlyLatestMsgs) && onlyChildMsgs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & PARENT)"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & PARENT)";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
@ -797,7 +797,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if ((!onlyLatestMsgs) && onlyThreadMsgs) if ((!onlyLatestMsgs) && onlyThreadMsgs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & THREAD)"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & THREAD)";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
@ -805,7 +805,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if (onlyChildMsgs && onlyThreadMsgs) if (onlyChildMsgs && onlyThreadMsgs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() ERROR Incompatible FLAGS (PARENT & THREAD)"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() ERROR Incompatible FLAGS (PARENT & THREAD)";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
@ -815,7 +815,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
/* FALL BACK OPTION */ /* FALL BACK OPTION */
if ((!onlyLatestMsgs) && (!onlyAllVersions) && (!onlyChildMsgs) && (!onlyThreadMsgs)) if ((!onlyLatestMsgs) && (!onlyAllVersions) && (!onlyChildMsgs) && (!onlyThreadMsgs))
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() FALLBACK -> NO FLAGS -> JUST COPY"; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() FALLBACK -> NO FLAGS -> JUST COPY";
std::cerr << std::endl; std::cerr << std::endl;
/* just copy */ /* just copy */
outMsgIds = msgIds; outMsgIds = msgIds;
@ -870,7 +870,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
bool addMsg = false; bool addMsg = false;
if (oit == origMsgTs.end()) if (oit == origMsgTs.end())
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() Found New OrigMsgId: "; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() Found New OrigMsgId: ";
std::cerr << mit->second.mOrigMsgId; std::cerr << mit->second.mOrigMsgId;
std::cerr << " MsgId: " << mit->second.mMsgId; std::cerr << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs; std::cerr << " TS: " << mit->second.mPublishTs;
@ -881,7 +881,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
// check timestamps. // check timestamps.
else if (oit->second.second < mit->second.mPublishTs) else if (oit->second.second < mit->second.mPublishTs)
{ {
std::cerr << "GxsDataProxy::getMsgRelatedList() Found Later Msg. OrigMsgId: "; std::cerr << "GxsDataProxyVEG::getMsgRelatedList() Found Later Msg. OrigMsgId: ";
std::cerr << mit->second.mOrigMsgId; std::cerr << mit->second.mOrigMsgId;
std::cerr << " MsgId: " << mit->second.mMsgId; std::cerr << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs; std::cerr << " TS: " << mit->second.mPublishTs;
@ -941,14 +941,14 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
} }
bool GxsDataProxy::createGroup(void *groupData) bool GxsDataProxyVEG::createGroup(void *groupData)
{ {
RsGroupMetaData meta; RsGroupMetaData meta;
if (convertGroupToMetaData(groupData, meta)) if (convertGroupToMetaData(groupData, meta))
{ {
if (!isUniqueGroup(meta.mGroupId)) if (!isUniqueGroup(meta.mGroupId))
{ {
std::cerr << "GxsDataProxy::createGroup() ERROR GroupId Clashes, discarding"; std::cerr << "GxsDataProxyVEG::createGroup() ERROR GroupId Clashes, discarding";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -967,20 +967,20 @@ bool GxsDataProxy::createGroup(void *groupData)
return true; return true;
} }
std::cerr << "GxsDataProxy::createGroup() ERROR Failed to convert Data"; std::cerr << "GxsDataProxyVEG::createGroup() ERROR Failed to convert Data";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
bool GxsDataProxy::createMsg(void *msgData) bool GxsDataProxyVEG::createMsg(void *msgData)
{ {
RsMsgMetaData meta; RsMsgMetaData meta;
if (convertMsgToMetaData(msgData, meta)) if (convertMsgToMetaData(msgData, meta))
{ {
if (!isUniqueMsg(meta.mMsgId)) if (!isUniqueMsg(meta.mMsgId))
{ {
std::cerr << "GxsDataProxy::createMsg() ERROR MsgId Clashes, discarding"; std::cerr << "GxsDataProxyVEG::createMsg() ERROR MsgId Clashes, discarding";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -993,7 +993,7 @@ bool GxsDataProxy::createMsg(void *msgData)
git = mGroupMetaData.find(meta.mGroupId); git = mGroupMetaData.find(meta.mGroupId);
if (git == mGroupMetaData.end()) if (git == mGroupMetaData.end())
{ {
std::cerr << "GxsDataProxy::createMsg() ERROR GroupId Doesn't exist, discarding"; std::cerr << "GxsDataProxyVEG::createMsg() ERROR GroupId Doesn't exist, discarding";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -1013,14 +1013,14 @@ bool GxsDataProxy::createMsg(void *msgData)
return true; return true;
} }
std::cerr << "GxsDataProxy::createMsg() ERROR Failed to convert Data"; std::cerr << "GxsDataProxyVEG::createMsg() ERROR Failed to convert Data";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
// Get Message Status - is retrived via MessageSummary. // Get Message Status - is retrived via MessageSummary.
bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t status, const uint32_t statusMask) bool GxsDataProxyVEG::setMessageStatus(const std::string &msgId,const uint32_t status, const uint32_t statusMask)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1030,7 +1030,7 @@ bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t stat
if (mit == mMsgMetaData.end()) if (mit == mMsgMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << msgId; std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1044,7 +1044,7 @@ bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t stat
return true; return true;
} }
bool GxsDataProxy::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask) bool GxsDataProxyVEG::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1054,7 +1054,7 @@ bool GxsDataProxy::setGroupStatus(const std::string &groupId, const uint32_t sta
if (git == mGroupMetaData.end()) if (git == mGroupMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::setGroupStatus() Error Finding GroupId: " << groupId; std::cerr << "GxsDataProxyVEG::setGroupStatus() Error Finding GroupId: " << groupId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1069,7 +1069,7 @@ bool GxsDataProxy::setGroupStatus(const std::string &groupId, const uint32_t sta
} }
bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) bool GxsDataProxyVEG::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1079,7 +1079,7 @@ bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t s
if (git == mGroupMetaData.end()) if (git == mGroupMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::setGroupSubscribeFlags() Error Finding GroupId: " << groupId; std::cerr << "GxsDataProxyVEG::setGroupSubscribeFlags() Error Finding GroupId: " << groupId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1093,7 +1093,7 @@ bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t s
return true; return true;
} }
bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::string &str) bool GxsDataProxyVEG::setMessageServiceString(const std::string &msgId, const std::string &str)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1103,7 +1103,7 @@ bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::
if (mit == mMsgMetaData.end()) if (mit == mMsgMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::setMessageServiceString() Error Finding MsgId: " << msgId; std::cerr << "GxsDataProxyVEG::setMessageServiceString() Error Finding MsgId: " << msgId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1115,7 +1115,7 @@ bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::
return true; return true;
} }
bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::string &str) bool GxsDataProxyVEG::setGroupServiceString(const std::string &groupId, const std::string &str)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1125,7 +1125,7 @@ bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::
if (git == mGroupMetaData.end()) if (git == mGroupMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::setGroupServiceString() Error Finding GroupId: " << groupId; std::cerr << "GxsDataProxyVEG::setGroupServiceString() Error Finding GroupId: " << groupId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1139,22 +1139,22 @@ bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::
/* These Functions must be overloaded to complete the service */ /* These Functions must be overloaded to complete the service */
bool GxsDataProxy::convertGroupToMetaData(void *groupData, RsGroupMetaData &meta) bool GxsDataProxyVEG::convertGroupToMetaData(void *groupData, RsGroupMetaData &meta)
{ {
std::cerr << "GxsDataProxy::convert fn ... please implement!"; std::cerr << "GxsDataProxyVEG::convert fn ... please implement!";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
bool GxsDataProxy::convertMsgToMetaData(void *groupData, RsMsgMetaData &meta) bool GxsDataProxyVEG::convertMsgToMetaData(void *groupData, RsMsgMetaData &meta)
{ {
std::cerr << "GxsDataProxy::convert fn ... please implement!"; std::cerr << "GxsDataProxyVEG::convert fn ... please implement!";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
/* extract Data */ /* extract Data */
bool GxsDataProxy::getGroupSummary(const std::string &groupId, RsGroupMetaData &groupSummary) bool GxsDataProxyVEG::getGroupSummary(const std::string &groupId, RsGroupMetaData &groupSummary)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1164,7 +1164,7 @@ bool GxsDataProxy::getGroupSummary(const std::string &groupId, RsGroupMetaData &
if (mit == mGroupMetaData.end()) if (mit == mGroupMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getGroupMetaData() Error Finding GroupId: " << groupId; std::cerr << "GxsDataProxyVEG::getGroupMetaData() Error Finding GroupId: " << groupId;
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -1176,7 +1176,7 @@ bool GxsDataProxy::getGroupSummary(const std::string &groupId, RsGroupMetaData &
} }
bool GxsDataProxy::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSummary) bool GxsDataProxyVEG::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSummary)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1186,7 +1186,7 @@ bool GxsDataProxy::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSum
if (mit == mMsgMetaData.end()) if (mit == mMsgMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << msgId; std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1198,7 +1198,7 @@ bool GxsDataProxy::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSum
/* extract Data */ /* extract Data */
bool GxsDataProxy::getGroupSummary(const std::list<std::string> &groupIds, std::list<RsGroupMetaData> &groupSummary) bool GxsDataProxyVEG::getGroupSummary(const std::list<std::string> &groupIds, std::list<RsGroupMetaData> &groupSummary)
{ {
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
for(it = groupIds.begin(); it != groupIds.end(); it++) for(it = groupIds.begin(); it != groupIds.end(); it++)
@ -1211,7 +1211,7 @@ bool GxsDataProxy::getGroupSummary(const std::list<std::string> &groupIds, std::
if (mit == mGroupMetaData.end()) if (mit == mGroupMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getGroupMetaData() Error Finding GroupId: " << *it; std::cerr << "GxsDataProxyVEG::getGroupMetaData() Error Finding GroupId: " << *it;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1223,7 +1223,7 @@ bool GxsDataProxy::getGroupSummary(const std::list<std::string> &groupIds, std::
} }
bool GxsDataProxy::getMsgSummary(const std::list<std::string> &msgIds, std::list<RsMsgMetaData> &msgSummary) bool GxsDataProxyVEG::getMsgSummary(const std::list<std::string> &msgIds, std::list<RsMsgMetaData> &msgSummary)
{ {
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
for(it = msgIds.begin(); it != msgIds.end(); it++) for(it = msgIds.begin(); it != msgIds.end(); it++)
@ -1236,7 +1236,7 @@ bool GxsDataProxy::getMsgSummary(const std::list<std::string> &msgIds, std::list
if (mit == mMsgMetaData.end()) if (mit == mMsgMetaData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << *it; std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << *it;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1248,7 +1248,7 @@ bool GxsDataProxy::getMsgSummary(const std::list<std::string> &msgIds, std::list
} }
bool GxsDataProxy::getGroupData(const std::string &groupId, void * &groupData) bool GxsDataProxyVEG::getGroupData(const std::string &groupId, void * &groupData)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1258,7 +1258,7 @@ bool GxsDataProxy::getGroupData(const std::string &groupId, void * &groupData)
if (mit == mGroupData.end()) if (mit == mGroupData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getGroupData() Error Finding GroupId: " << groupId; std::cerr << "GxsDataProxyVEG::getGroupData() Error Finding GroupId: " << groupId;
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -1269,7 +1269,7 @@ bool GxsDataProxy::getGroupData(const std::string &groupId, void * &groupData)
return true; return true;
} }
bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData) bool GxsDataProxyVEG::getMsgData(const std::string &msgId, void * &msgData)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1279,7 +1279,7 @@ bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData)
if (mit == mMsgData.end()) if (mit == mMsgData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getMsgData() Error Finding MsgId: " << msgId; std::cerr << "GxsDataProxyVEG::getMsgData() Error Finding MsgId: " << msgId;
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -1291,7 +1291,7 @@ bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData)
} }
#if 0 #if 0
bool GxsDataProxy::getGroupData(const std::list<std::string> &groupIds, std::list<void *> &groupData) bool GxsDataProxyVEG::getGroupData(const std::list<std::string> &groupIds, std::list<void *> &groupData)
{ {
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
for(it = groupIds.begin(); it != groupIds.end(); it++) for(it = groupIds.begin(); it != groupIds.end(); it++)
@ -1304,7 +1304,7 @@ bool GxsDataProxy::getGroupData(const std::list<std::string> &groupIds, std::lis
if (mit == mGroupData.end()) if (mit == mGroupData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getGroupData() Error Finding GroupId: " << *it; std::cerr << "GxsDataProxyVEG::getGroupData() Error Finding GroupId: " << *it;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1315,7 +1315,7 @@ bool GxsDataProxy::getGroupData(const std::list<std::string> &groupIds, std::lis
return true; return true;
} }
bool GxsDataProxy::getMsgData(const std::list<std::string> &msgIds, std::list<void *> &msgData) bool GxsDataProxyVEG::getMsgData(const std::list<std::string> &msgIds, std::list<void *> &msgData)
{ {
std::list<std::string>::const_iterator it; std::list<std::string>::const_iterator it;
for(it = msgIds.begin(); it != msgIds.end(); it++) for(it = msgIds.begin(); it != msgIds.end(); it++)
@ -1328,7 +1328,7 @@ bool GxsDataProxy::getMsgData(const std::list<std::string> &msgIds, std::list<vo
if (mit == mMsgData.end()) if (mit == mMsgData.end())
{ {
// error. // error.
std::cerr << "GxsDataProxy::getMsgData() Error Finding MsgId: " << *it; std::cerr << "GxsDataProxyVEG::getMsgData() Error Finding MsgId: " << *it;
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
@ -1340,7 +1340,7 @@ bool GxsDataProxy::getMsgData(const std::list<std::string> &msgIds, std::list<vo
} }
#endif #endif
bool GxsDataProxy::isUniqueMsg(const std::string &msgId) bool GxsDataProxyVEG::isUniqueMsg(const std::string &msgId)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1351,7 +1351,7 @@ bool GxsDataProxy::isUniqueMsg(const std::string &msgId)
} }
bool GxsDataProxy::isUniqueGroup(const std::string &groupId) bool GxsDataProxyVEG::isUniqueGroup(const std::string &groupId)
{ {
RsStackMutex stack(mDataMtx); /***** LOCKED *****/ RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1370,8 +1370,8 @@ bool GxsDataProxy::isUniqueGroup(const std::string &groupId)
/*********************************************************************************************************/ /*********************************************************************************************************/
p3GxsDataService::p3GxsDataService(uint16_t type, GxsDataProxy *proxy) p3GxsDataServiceVEG::p3GxsDataServiceVEG(uint16_t type, GxsDataProxyVEG *proxy)
:p3GxsService(type), mProxy(proxy) :p3GxsServiceVEG(type), mProxy(proxy)
{ {
return; return;
} }
@ -1380,7 +1380,7 @@ p3GxsDataService::p3GxsDataService(uint16_t type, GxsDataProxy *proxy)
bool p3GxsDataService::fakeprocessrequests() bool p3GxsDataServiceVEG::fakeprocessrequests()
{ {
std::list<uint32_t> toClear; std::list<uint32_t> toClear;
std::list<uint32_t>::iterator cit; std::list<uint32_t>::iterator cit;
@ -1392,11 +1392,11 @@ bool p3GxsDataService::fakeprocessrequests()
for(it = mRequests.begin(); it != mRequests.end(); it++) for(it = mRequests.begin(); it != mRequests.end(); it++)
{ {
//std::cerr << "p3GxsDataService::fakeprocessrequests() Token: " << it->second.token << " Status: " << it->second.status << " ReqType: " << it->second.reqType << " Age: " << now - it->second.reqTime << std::endl; //std::cerr << "p3GxsDataServiceVEG::fakeprocessrequests() Token: " << it->second.token << " Status: " << it->second.status << " ReqType: " << it->second.reqType << " Age: " << now - it->second.reqTime << std::endl;
if (it->second.status == GXS_REQUEST_STATUS_PENDING) if (it->second.status == GXS_REQUEST_STATUS_PENDING)
{ {
std::cerr << "p3GxsDataService::fakeprocessrequests() Processing Token: " << it->second.token << " Status: " << it->second.status << " ReqType: " << it->second.reqType << " Age: " << now - it->second.reqTime << std::endl; std::cerr << "p3GxsDataServiceVEG::fakeprocessrequests() Processing Token: " << it->second.token << " Status: " << it->second.status << " ReqType: " << it->second.reqType << " Age: " << now - it->second.reqTime << std::endl;
it->second.status = GXS_REQUEST_STATUS_PARTIAL; it->second.status = GXS_REQUEST_STATUS_PARTIAL;
/* PROCESS REQUEST! */ /* PROCESS REQUEST! */
switch(it->second.reqType) switch(it->second.reqType)
@ -1421,13 +1421,13 @@ bool p3GxsDataService::fakeprocessrequests()
} }
else if (it->second.status == GXS_REQUEST_STATUS_DONE) else if (it->second.status == GXS_REQUEST_STATUS_DONE)
{ {
std::cerr << "p3GxsDataService::fakeprocessrequests() Clearing Done Request Token: " << it->second.token; std::cerr << "p3GxsDataServiceVEG::fakeprocessrequests() Clearing Done Request Token: " << it->second.token;
std::cerr << std::endl; std::cerr << std::endl;
toClear.push_back(it->second.token); toClear.push_back(it->second.token);
} }
else if (now - it->second.reqTime > MAX_REQUEST_AGE) else if (now - it->second.reqTime > MAX_REQUEST_AGE)
{ {
std::cerr << "p3GxsDataService::fakeprocessrequests() Clearing Old Request Token: " << it->second.token; std::cerr << "p3GxsDataServiceVEG::fakeprocessrequests() Clearing Old Request Token: " << it->second.token;
std::cerr << std::endl; std::cerr << std::endl;
toClear.push_back(it->second.token); toClear.push_back(it->second.token);
} }

View File

@ -27,7 +27,7 @@
#define P3_GXS_SERVICE_HEADER #define P3_GXS_SERVICE_HEADER
#include "services/p3service.h" #include "services/p3service.h"
#include "retroshare/rsidentity.h" #include "retroshare/rsidentityVEG.h"
/* /*
* This class provides useful generic support for GXS style services. * This class provides useful generic support for GXS style services.
@ -54,7 +54,7 @@ class gxsRequest
uint32_t ansType; uint32_t ansType;
uint32_t reqType; uint32_t reqType;
RsTokReqOptions Options; RsTokReqOptionsVEG Options;
uint32_t status; uint32_t status;
@ -64,18 +64,18 @@ class gxsRequest
}; };
class p3GxsService: public p3Service class p3GxsServiceVEG: public p3Service
{ {
protected: protected:
p3GxsService(uint16_t type); p3GxsServiceVEG(uint16_t type);
public: public:
//virtual ~p3Service() { p3Service::~p3Service(); return; } //virtual ~p3Service() { p3Service::~p3Service(); return; }
bool generateToken(uint32_t &token); bool generateToken(uint32_t &token);
bool storeRequest(const uint32_t &token, const uint32_t &ansType, const RsTokReqOptions &opts, const uint32_t &type, const std::list<std::string> &ids); bool storeRequest(const uint32_t &token, const uint32_t &ansType, const RsTokReqOptionsVEG &opts, const uint32_t &type, const std::list<std::string> &ids);
bool clearRequest(const uint32_t &token); bool clearRequest(const uint32_t &token);
bool updateRequestStatus(const uint32_t &token, const uint32_t &status); bool updateRequestStatus(const uint32_t &token, const uint32_t &status);
@ -103,15 +103,15 @@ virtual bool fakeprocessrequests();
}; };
class GxsDataProxy class GxsDataProxyVEG
{ {
public: public:
GxsDataProxy(); GxsDataProxyVEG();
virtual bool getGroupList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds, std::list<std::string> &outGroupIds); virtual bool getGroupList( uint32_t &token, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds, std::list<std::string> &outGroupIds);
virtual bool getMsgList( uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &groupIds, std::list<std::string> &outMsgIds); virtual bool getMsgList( uint32_t &token, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds, std::list<std::string> &outMsgIds);
virtual bool getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opts, const std::list<std::string> &msgIds, std::list<std::string> &outMsgIds); virtual bool getMsgRelatedList(uint32_t &token, const RsTokReqOptionsVEG &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 functions return a token - which can be used to retrieve the RsGroupMetaData, later
@ -157,8 +157,8 @@ virtual bool setGroupServiceString(const std::string &grpId, const std::string &
protected: protected:
bool filterGroupList(const RsTokReqOptions &opts, std::list<std::string> &groupIds); bool filterGroupList(const RsTokReqOptionsVEG &opts, std::list<std::string> &groupIds);
bool filterMsgList(const RsTokReqOptions &opts, std::list<std::string> &msgIds); bool filterMsgList(const RsTokReqOptionsVEG &opts, std::list<std::string> &msgIds);
RsMutex mDataMtx; RsMutex mDataMtx;
@ -172,17 +172,17 @@ virtual bool setGroupServiceString(const std::string &grpId, const std::string &
}; };
class p3GxsDataService: public p3GxsService class p3GxsDataServiceVEG: public p3GxsServiceVEG
{ {
public: public:
p3GxsDataService(uint16_t type, GxsDataProxy *proxy); p3GxsDataServiceVEG(uint16_t type, GxsDataProxyVEG *proxy);
virtual bool fakeprocessrequests(); virtual bool fakeprocessrequests();
protected: protected:
GxsDataProxy *mProxy; GxsDataProxyVEG *mProxy;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,186 @@
/*
* libretroshare/src/services: p3idservice.h
*
* Identity interface for RetroShare.
*
* 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 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".
*
*/
#ifndef P3_IDENTITY_SERVICE_HEADER
#define P3_IDENTITY_SERVICE_HEADER
#include "services/p3service.h"
#include "services/p3gxsserviceVEG.h"
#include "retroshare/rsidentityVEG.h"
#include <map>
#include <string>
/*
* Identity Service
*
*/
class IdDataProxy: public GxsDataProxyVEG
{
public:
bool getGroup(const std::string &id, RsIdGroup &group);
bool getMsg(const std::string &id, RsIdMsg &msg);
bool addGroup(const RsIdGroup &group);
bool addMsg(const RsIdMsg &msg);
/* These Functions must be overloaded to complete the service */
virtual bool convertGroupToMetaData(void *groupData, RsGroupMetaData &meta);
virtual bool convertMsgToMetaData(void *msgData, RsMsgMetaData &meta);
};
// INTERNAL DATA TYPES...
// Describes data stored in GroupServiceString.
class IdRepCumulScore
{
public:
uint32_t count;
uint32_t nullcount;
double sum;
double sumsq;
// derived parameters:
};
class IdGroupServiceStrData
{
public:
IdGroupServiceStrData() { pgpIdKnown = false; }
bool pgpIdKnown;
std::string pgpId;
uint32_t ownScore;
IdRepCumulScore opinion;
IdRepCumulScore reputation;
};
#define ID_LOCAL_STATUS_FULL_CALC_FLAG 0x00010000
#define ID_LOCAL_STATUS_INC_CALC_FLAG 0x00020000
class p3IdServiceVEG: public p3GxsDataServiceVEG, public RsIdentityVEG
{
public:
p3IdServiceVEG(uint16_t type);
virtual int tick();
public:
/* changed? */
virtual bool updated();
/* From RsTokenService */
/* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);
virtual bool getMsgList( const uint32_t &token, std::list<std::string> &msgIds);
/* Generic Summary */
virtual bool getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo);
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);
/* Cancel Request */
virtual bool cancelRequest(const uint32_t &token);
//////////////////////////////////////////////////////////////////////////////
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);
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);
private:
virtual void generateDummyData();
std::string genRandomId();
int background_tick();
bool background_checkTokenRequest();
bool background_requestGroups();
bool background_requestNewMessages();
bool background_processNewMessages();
bool background_FullCalcRequest();
bool background_processFullCalc();
bool background_cleanup();
bool encodeIdGroupCache(std::string &str, const IdGroupServiceStrData &data);
bool extractIdGroupCache(std::string &str, IdGroupServiceStrData &data);
IdDataProxy *mIdProxy;
RsMutex mIdMtx;
/***** below here is locked *****/
bool mLastBgCheck;
bool mBgProcessing;
uint32_t mBgToken;
uint32_t mBgPhase;
std::map<std::string, RsGroupMetaData> mBgGroupMap;
std::list<std::string> mBgFullCalcGroups;
bool mUpdated;
#if 0
std::map<std::string, RsIdData> mIds;
std::map<std::string, std::map<std::string, RsIdOpinion> > mOpinions;
std::map<std::string, RsIdReputation> mReputations; // this is created locally.
#endif
};
#endif

View File

@ -5,7 +5,7 @@
RsPhotoV2 *rsPhotoV2 = NULL; RsPhotoV2 *rsPhotoV2 = NULL;
p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes) p3PhotoServiceV2::p3PhotoServiceV2(RsGeneralDataService* gds, RsNetworkExchangeService* nes)
: RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_TYPE_PHOTO) : RsGenExchange(gds, nes, new RsGxsPhotoSerialiser(), RS_SERVICE_GXSV1_TYPE_PHOTO)
{ {

View File

@ -23,22 +23,22 @@
* *
*/ */
#include "services/p3photoservice.h" #include "services/p3photoserviceVEG.h"
#include "util/rsrandom.h" #include "util/rsrandom.h"
/**** /****
* #define PHOTO_DEBUG 1 * #define PHOTO_DEBUG 1
****/ ****/
RsPhoto *rsPhoto = NULL; RsPhotoVEG *rsPhotoVEG = NULL;
/********************************************************************************/ /********************************************************************************/
/******************* Startup / Tick ******************************************/ /******************* Startup / Tick ******************************************/
/********************************************************************************/ /********************************************************************************/
p3PhotoService::p3PhotoService(uint16_t type) p3PhotoServiceVEG::p3PhotoServiceVEG(uint16_t type)
:p3GxsDataService(type, new PhotoDataProxy()), mPhotoMtx("p3PhotoService"), mUpdated(true) :p3GxsDataServiceVEG(type, new PhotoDataProxy()), mPhotoMtx("p3PhotoService"), mUpdated(true)
{ {
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
@ -47,9 +47,9 @@ p3PhotoService::p3PhotoService(uint16_t type)
} }
int p3PhotoService::tick() int p3PhotoServiceVEG::tick()
{ {
//std::cerr << "p3PhotoService::tick()"; //std::cerr << "p3PhotoServiceVEG::tick()";
//std::cerr << std::endl; //std::cerr << std::endl;
fakeprocessrequests(); fakeprocessrequests();
@ -57,7 +57,7 @@ int p3PhotoService::tick()
return 0; return 0;
} }
bool p3PhotoService::updated() bool p3PhotoServiceVEG::updated()
{ {
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
@ -71,35 +71,35 @@ bool p3PhotoService::updated()
/* Data Requests */ /* Data Requests */
bool p3PhotoService::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3PhotoServiceVEG::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3PhotoService::requestGroupInfo() gets Token: " << token << std::endl; std::cerr << "p3PhotoServiceVEG::requestGroupInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
} }
bool p3PhotoService::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3PhotoServiceVEG::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3PhotoService::requestMsgInfo() gets Token: " << token << std::endl; std::cerr << "p3PhotoServiceVEG::requestMsgInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds);
return true; return true;
} }
bool p3PhotoService::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) bool p3PhotoServiceVEG::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3PhotoService::requestMsgRelatedInfo() gets Token: " << token << std::endl; std::cerr << "p3PhotoServiceVEG::requestMsgRelatedInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
} }
/* Generic Lists */ /* Generic Lists */
bool p3PhotoService::getGroupList( const uint32_t &token, std::list<std::string> &groupIds) bool p3PhotoServiceVEG::getGroupList( const uint32_t &token, std::list<std::string> &groupIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -109,19 +109,19 @@ bool p3PhotoService::getGroupList( const uint32_t &token, std::list<std:
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3PhotoService::getGroupList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3PhotoService::getGroupList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getGroupList() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -134,7 +134,7 @@ bool p3PhotoService::getGroupList( const uint32_t &token, std::list<std:
bool p3PhotoService::getMsgList( const uint32_t &token, std::list<std::string> &msgIds) bool p3PhotoServiceVEG::getMsgList( const uint32_t &token, std::list<std::string> &msgIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -144,19 +144,19 @@ bool p3PhotoService::getMsgList( const uint32_t &token, std::list<std:
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3PhotoService::getMsgList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3PhotoService::getMsgList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getMsgList() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -168,7 +168,7 @@ bool p3PhotoService::getMsgList( const uint32_t &token, std::list<std:
/* Generic Summary */ /* Generic Summary */
bool p3PhotoService::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) bool p3PhotoServiceVEG::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -178,19 +178,19 @@ bool p3PhotoService::getGroupSummary( const uint32_t &token, std::list<RsGr
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3PhotoService::getGroupSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3PhotoService::getGroupSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getGroupSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getGroupSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -204,7 +204,7 @@ bool p3PhotoService::getGroupSummary( const uint32_t &token, std::list<RsGr
return ans; return ans;
} }
bool p3PhotoService::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) bool p3PhotoServiceVEG::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -214,19 +214,19 @@ bool p3PhotoService::getMsgSummary( const uint32_t &token, std::list<RsMs
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3PhotoService::getMsgSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3PhotoService::getMsgSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getMsgSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getMsgSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -242,9 +242,9 @@ bool p3PhotoService::getMsgSummary( const uint32_t &token, std::list<RsMs
/* Specific Service Data */ /* Specific Service Data */
bool p3PhotoService::getAlbum(const uint32_t &token, RsPhotoAlbum &album) bool p3PhotoServiceVEG::getAlbum(const uint32_t &token, RsPhotoAlbum &album)
{ {
std::cerr << "p3PhotoService::getAlbum() Token: " << token; std::cerr << "p3PhotoServiceVEG::getAlbum() Token: " << token;
std::cerr << std::endl; std::cerr << std::endl;
uint32_t status; uint32_t status;
@ -256,19 +256,19 @@ bool p3PhotoService::getAlbum(const uint32_t &token, RsPhotoAlbum &album)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3PhotoService::getAlbum() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getAlbum() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3PhotoService::getAlbum() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getAlbum() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getAlbum() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getAlbum() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -286,9 +286,9 @@ bool p3PhotoService::getAlbum(const uint32_t &token, RsPhotoAlbum &album)
} }
bool p3PhotoService::getPhoto(const uint32_t &token, RsPhotoPhoto &photo) bool p3PhotoServiceVEG::getPhoto(const uint32_t &token, RsPhotoPhoto &photo)
{ {
std::cerr << "p3PhotoService::getPhoto() Token: " << token; std::cerr << "p3PhotoServiceVEG::getPhoto() Token: " << token;
std::cerr << std::endl; std::cerr << std::endl;
uint32_t status; uint32_t status;
@ -300,19 +300,19 @@ bool p3PhotoService::getPhoto(const uint32_t &token, RsPhotoPhoto &photo)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3PhotoService::getPhoto() ERROR AnsType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getPhoto() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3PhotoService::getPhoto() ERROR ReqType Wrong" << std::endl; std::cerr << "p3PhotoServiceVEG::getPhoto() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3PhotoService::getPhoto() ERROR Status Incomplete" << std::endl; std::cerr << "p3PhotoServiceVEG::getPhoto() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -332,7 +332,7 @@ bool p3PhotoService::getPhoto(const uint32_t &token, RsPhotoPhoto &photo)
/* Poll */ /* Poll */
uint32_t p3PhotoService::requestStatus(const uint32_t token) uint32_t p3PhotoServiceVEG::requestStatus(const uint32_t token)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -345,44 +345,44 @@ uint32_t p3PhotoService::requestStatus(const uint32_t token)
/* Cancel Request */ /* Cancel Request */
bool p3PhotoService::cancelRequest(const uint32_t &token) bool p3PhotoServiceVEG::cancelRequest(const uint32_t &token)
{ {
return clearRequest(token); return clearRequest(token);
} }
bool p3PhotoService::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) bool p3PhotoServiceVEG::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{ {
return mPhotoProxy->setMessageStatus(msgId, status, statusMask); return mPhotoProxy->setMessageStatus(msgId, status, statusMask);
} }
bool p3PhotoService::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask) bool p3PhotoServiceVEG::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{ {
return mPhotoProxy->setGroupStatus(groupId, status, statusMask); return mPhotoProxy->setGroupStatus(groupId, status, statusMask);
} }
bool p3PhotoService::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) bool p3PhotoServiceVEG::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{ {
return mPhotoProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask); return mPhotoProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
} }
bool p3PhotoService::setMessageServiceString(const std::string &msgId, const std::string &str) bool p3PhotoServiceVEG::setMessageServiceString(const std::string &msgId, const std::string &str)
{ {
return mPhotoProxy->setMessageServiceString(msgId, str); return mPhotoProxy->setMessageServiceString(msgId, str);
} }
bool p3PhotoService::setGroupServiceString(const std::string &grpId, const std::string &str) bool p3PhotoServiceVEG::setGroupServiceString(const std::string &grpId, const std::string &str)
{ {
return mPhotoProxy->setGroupServiceString(grpId, str); return mPhotoProxy->setGroupServiceString(grpId, str);
} }
bool p3PhotoService::groupRestoreKeys(const std::string &groupId) bool p3PhotoServiceVEG::groupRestoreKeys(const std::string &groupId)
{ {
return false; return false;
} }
bool p3PhotoService::groupShareKeys(const std::string &groupId, std::list<std::string>& peers) bool p3PhotoServiceVEG::groupShareKeys(const std::string &groupId, std::list<std::string>& peers)
{ {
return false; return false;
} }
@ -390,7 +390,7 @@ bool p3PhotoService::groupShareKeys(const std::string &groupId, std::list<std::s
/* details are updated in album - to choose Album ID, and storage path */ /* details are updated in album - to choose Album ID, and storage path */
bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew) bool p3PhotoServiceVEG::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bool isNew)
{ {
/* check if its a modification or a new album */ /* check if its a modification or a new album */
@ -406,7 +406,7 @@ bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bo
// TODO. // TODO.
//album.mMeta.mPublishTs = time(NULL); //album.mMeta.mPublishTs = time(NULL);
std::cerr << "p3PhotoService::submitAlbumDetails() Generated New GroupID: " << album.mMeta.mGroupId; std::cerr << "p3PhotoServiceVEG::submitAlbumDetails() Generated New GroupID: " << album.mMeta.mGroupId;
std::cerr << std::endl; std::cerr << std::endl;
} }
@ -424,22 +424,22 @@ bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bo
// Fake a request to return the GroupMetaData. // Fake a request to return the GroupMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds; std::list<std::string> groupIds;
groupIds.push_back(album.mMeta.mGroupId); // It will just return this one. groupIds.push_back(album.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3PhotoService::submitAlbumDetails() Generating Request Token: " << token << std::endl; std::cerr << "p3PhotoServiceVEG::submitAlbumDetails() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
} }
bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew) bool p3PhotoServiceVEG::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNew)
{ {
if (photo.mMeta.mGroupId.empty()) if (photo.mMeta.mGroupId.empty())
{ {
/* new photo */ /* new photo */
std::cerr << "p3PhotoService::submitPhoto() Missing GroupID: ERROR"; std::cerr << "p3PhotoServiceVEG::submitPhoto() Missing GroupID: ERROR";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -452,18 +452,18 @@ bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNe
{ {
/* new (Original Msg) photo */ /* new (Original Msg) photo */
photo.mMeta.mOrigMsgId = photo.mMeta.mMsgId; photo.mMeta.mOrigMsgId = photo.mMeta.mMsgId;
std::cerr << "p3PhotoService::submitPhoto() New Msg"; std::cerr << "p3PhotoServiceVEG::submitPhoto() New Msg";
std::cerr << std::endl; std::cerr << std::endl;
} }
else else
{ {
std::cerr << "p3PhotoService::submitPhoto() Updated Msg"; std::cerr << "p3PhotoServiceVEG::submitPhoto() Updated Msg";
std::cerr << std::endl; std::cerr << std::endl;
} }
photo.mModFlags = 0; // These are always cleared. photo.mModFlags = 0; // These are always cleared.
std::cerr << "p3PhotoService::submitPhoto() OrigMsgId: " << photo.mMeta.mOrigMsgId; std::cerr << "p3PhotoServiceVEG::submitPhoto() OrigMsgId: " << photo.mMeta.mOrigMsgId;
std::cerr << " MsgId: " << photo.mMeta.mMsgId; std::cerr << " MsgId: " << photo.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
@ -477,11 +477,11 @@ bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNe
// Fake a request to return the MsgMetaData. // Fake a request to return the MsgMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds; std::list<std::string> msgIds;
msgIds.push_back(photo.mMeta.mMsgId); // It will just return this one. msgIds.push_back(photo.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3PhotoService::submitPhoto() Generating Request Token: " << token << std::endl; std::cerr << "p3PhotoServiceVEG::submitPhoto() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
@ -600,7 +600,7 @@ bool PhotoDataProxy::convertMsgToMetaData(void *msgData, RsMsgMetaData &meta)
/********************************************************************************************/ /********************************************************************************************/
std::string p3PhotoService::genRandomId() std::string p3PhotoServiceVEG::genRandomId()
{ {
std::string randomId; std::string randomId;
for(int i = 0; i < 20; i++) for(int i = 0; i < 20; i++)

View File

@ -23,11 +23,11 @@
* *
*/ */
#ifndef P3_PHOTO_SERVICE_HEADER #ifndef P3_PHOTO_SERVICE_VEG_HEADER
#define P3_PHOTO_SERVICE_HEADER #define P3_PHOTO_SERVICE_VEG_HEADER
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
#include "retroshare/rsphoto.h" #include "retroshare/rsphotoVEG.h"
#include <map> #include <map>
#include <string> #include <string>
@ -48,7 +48,7 @@
*/ */
class PhotoDataProxy: public GxsDataProxy class PhotoDataProxy: public GxsDataProxyVEG
{ {
public: public:
@ -66,11 +66,11 @@ virtual bool convertMsgToMetaData(void *groupData, RsMsgMetaData &meta);
class p3PhotoService: public p3GxsDataService, public RsPhoto class p3PhotoServiceVEG: public p3GxsDataServiceVEG, public RsPhotoVEG
{ {
public: public:
p3PhotoService(uint16_t type); p3PhotoServiceVEG(uint16_t type);
virtual int tick(); virtual int tick();
@ -83,9 +83,9 @@ virtual int tick();
virtual bool updated(); virtual bool updated();
/* Data Requests */ /* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds); virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */ /* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds); virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);

View File

@ -23,11 +23,11 @@
* *
*/ */
#ifndef P3_POSTED_SERVICE_HEADER #ifndef P3_POSTED_SERVICE_VEG_HEADER
#define P3_POSTED_SERVICE_HEADER #define P3_POSTED_SERVICE_VEG_HEADER
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
#include "retroshare/rsposted.h" #include "retroshare/rspostedVEG.h"
#include <map> #include <map>
#include <string> #include <string>
@ -38,7 +38,7 @@
*/ */
class PostedDataProxy: public GxsDataProxy class PostedDataProxy: public GxsDataProxyVEG
{ {
public: public:
@ -60,11 +60,11 @@ virtual bool convertMsgToMetaData(void *groupData, RsMsgMetaData &meta);
class p3PostedService: public p3GxsDataService, public RsPosted class p3PostedServiceVEG: public p3GxsDataServiceVEG, public RsPostedVEG
{ {
public: public:
p3PostedService(uint16_t type); p3PostedServiceVEG(uint16_t type);
virtual int tick(); virtual int tick();
@ -76,9 +76,9 @@ virtual int tick();
virtual bool updated(); virtual bool updated();
/* Data Requests */ /* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds); virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */ /* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds); virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);

View File

@ -23,7 +23,7 @@
* *
*/ */
#include "services/p3wikiservice.h" #include "services/p3wikiserviceVEG.h"
#include "util/rsrandom.h" #include "util/rsrandom.h"
@ -31,15 +31,15 @@
* #define WIKI_DEBUG 1 * #define WIKI_DEBUG 1
****/ ****/
RsWiki *rsWiki = NULL; RsWikiVEG *rsWikiVEG = NULL;
/********************************************************************************/ /********************************************************************************/
/******************* Startup / Tick ******************************************/ /******************* Startup / Tick ******************************************/
/********************************************************************************/ /********************************************************************************/
p3WikiService::p3WikiService(uint16_t type) p3WikiServiceVEG::p3WikiServiceVEG(uint16_t type)
:p3GxsDataService(type, new WikiDataProxy()), mWikiMtx("p3WikiService"), mUpdated(true) :p3GxsDataServiceVEG(type, new WikiDataProxy()), mWikiMtx("p3WikiService"), mUpdated(true)
{ {
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
@ -48,9 +48,9 @@ p3WikiService::p3WikiService(uint16_t type)
} }
int p3WikiService::tick() int p3WikiServiceVEG::tick()
{ {
//std::cerr << "p3WikiService::tick()"; //std::cerr << "p3WikiServiceVEG::tick()";
//std::cerr << std::endl; //std::cerr << std::endl;
fakeprocessrequests(); fakeprocessrequests();
@ -58,7 +58,7 @@ int p3WikiService::tick()
return 0; return 0;
} }
bool p3WikiService::updated() bool p3WikiServiceVEG::updated()
{ {
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
@ -73,35 +73,35 @@ bool p3WikiService::updated()
/* Data Requests */ /* Data Requests */
bool p3WikiService::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3WikiServiceVEG::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3WikiService::requestGroupInfo() gets Token: " << token << std::endl; std::cerr << "p3WikiServiceVEG::requestGroupInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
} }
bool p3WikiService::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3WikiServiceVEG::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3WikiService::requestMsgInfo() gets Token: " << token << std::endl; std::cerr << "p3WikiServiceVEG::requestMsgInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds);
return true; return true;
} }
bool p3WikiService::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) bool p3WikiServiceVEG::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3WikiService::requestMsgRelatedInfo() gets Token: " << token << std::endl; std::cerr << "p3WikiServiceVEG::requestMsgRelatedInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
} }
/* Generic Lists */ /* Generic Lists */
bool p3WikiService::getGroupList( const uint32_t &token, std::list<std::string> &groupIds) bool p3WikiServiceVEG::getGroupList( const uint32_t &token, std::list<std::string> &groupIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -111,19 +111,19 @@ bool p3WikiService::getGroupList( const uint32_t &token, std::list<std::
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3WikiService::getGroupList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3WikiService::getGroupList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getGroupList() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -136,7 +136,7 @@ bool p3WikiService::getGroupList( const uint32_t &token, std::list<std::
bool p3WikiService::getMsgList( const uint32_t &token, std::list<std::string> &msgIds) bool p3WikiServiceVEG::getMsgList( const uint32_t &token, std::list<std::string> &msgIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -146,19 +146,19 @@ bool p3WikiService::getMsgList( const uint32_t &token, std::list<std::
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3WikiService::getMsgList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3WikiService::getMsgList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getMsgList() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -170,7 +170,7 @@ bool p3WikiService::getMsgList( const uint32_t &token, std::list<std::
/* Generic Summary */ /* Generic Summary */
bool p3WikiService::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) bool p3WikiServiceVEG::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -180,19 +180,19 @@ bool p3WikiService::getGroupSummary( const uint32_t &token, std::list<RsGro
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3WikiService::getGroupSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3WikiService::getGroupSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getGroupSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -206,7 +206,7 @@ bool p3WikiService::getGroupSummary( const uint32_t &token, std::list<RsGro
return ans; return ans;
} }
bool p3WikiService::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) bool p3WikiServiceVEG::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -216,19 +216,19 @@ bool p3WikiService::getMsgSummary( const uint32_t &token, std::list<RsMsg
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3WikiService::getMsgSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3WikiService::getMsgSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getMsgSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -244,7 +244,7 @@ bool p3WikiService::getMsgSummary( const uint32_t &token, std::list<RsMsg
/* Specific Service Data */ /* Specific Service Data */
bool p3WikiService::getGroupData(const uint32_t &token, RsWikiGroup &group) bool p3WikiServiceVEG::getGroupData(const uint32_t &token, RsWikiGroup &group)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -255,19 +255,19 @@ bool p3WikiService::getGroupData(const uint32_t &token, RsWikiGroup &group)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3WikiService::getGroupData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3WikiService::getGroupData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getGroupData() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getGroupData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -285,7 +285,7 @@ bool p3WikiService::getGroupData(const uint32_t &token, RsWikiGroup &group)
} }
bool p3WikiService::getMsgData(const uint32_t &token, RsWikiPage &page) bool p3WikiServiceVEG::getMsgData(const uint32_t &token, RsWikiPage &page)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -296,19 +296,19 @@ bool p3WikiService::getMsgData(const uint32_t &token, RsWikiPage &page)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3WikiService::getMsgData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3WikiService::getMsgData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3WikiService::getMsgData() ERROR Status Incomplete" << std::endl; std::cerr << "p3WikiServiceVEG::getMsgData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -328,7 +328,7 @@ bool p3WikiService::getMsgData(const uint32_t &token, RsWikiPage &page)
/* Poll */ /* Poll */
uint32_t p3WikiService::requestStatus(const uint32_t token) uint32_t p3WikiServiceVEG::requestStatus(const uint32_t token)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -341,45 +341,45 @@ uint32_t p3WikiService::requestStatus(const uint32_t token)
/* Cancel Request */ /* Cancel Request */
bool p3WikiService::cancelRequest(const uint32_t &token) bool p3WikiServiceVEG::cancelRequest(const uint32_t &token)
{ {
return clearRequest(token); return clearRequest(token);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
bool p3WikiService::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) bool p3WikiServiceVEG::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{ {
return mWikiProxy->setMessageStatus(msgId, status, statusMask); return mWikiProxy->setMessageStatus(msgId, status, statusMask);
} }
bool p3WikiService::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask) bool p3WikiServiceVEG::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{ {
return mWikiProxy->setGroupStatus(groupId, status, statusMask); return mWikiProxy->setGroupStatus(groupId, status, statusMask);
} }
bool p3WikiService::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) bool p3WikiServiceVEG::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{ {
return mWikiProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask); return mWikiProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
} }
bool p3WikiService::setMessageServiceString(const std::string &msgId, const std::string &str) bool p3WikiServiceVEG::setMessageServiceString(const std::string &msgId, const std::string &str)
{ {
return mWikiProxy->setMessageServiceString(msgId, str); return mWikiProxy->setMessageServiceString(msgId, str);
} }
bool p3WikiService::setGroupServiceString(const std::string &grpId, const std::string &str) bool p3WikiServiceVEG::setGroupServiceString(const std::string &grpId, const std::string &str)
{ {
return mWikiProxy->setGroupServiceString(grpId, str); return mWikiProxy->setGroupServiceString(grpId, str);
} }
bool p3WikiService::groupRestoreKeys(const std::string &groupId) bool p3WikiServiceVEG::groupRestoreKeys(const std::string &groupId)
{ {
return false; return false;
} }
bool p3WikiService::groupShareKeys(const std::string &groupId, std::list<std::string>& peers) bool p3WikiServiceVEG::groupShareKeys(const std::string &groupId, std::list<std::string>& peers)
{ {
return false; return false;
} }
@ -388,7 +388,7 @@ bool p3WikiService::groupShareKeys(const std::string &groupId, std::list<std::st
/********************************************************************************************/ /********************************************************************************************/
std::string p3WikiService::genRandomId() std::string p3WikiServiceVEG::genRandomId()
{ {
std::string randomId; std::string randomId;
for(int i = 0; i < 20; i++) for(int i = 0; i < 20; i++)
@ -399,7 +399,7 @@ std::string p3WikiService::genRandomId()
return randomId; return randomId;
} }
bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew) bool p3WikiServiceVEG::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
{ {
if (group.mMeta.mGroupId.empty()) if (group.mMeta.mGroupId.empty())
{ {
@ -410,7 +410,7 @@ bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
} }
else else
{ {
std::cerr << "p3WikiService::createGroup() Group with existing Id... dropping"; std::cerr << "p3WikiServiceVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -425,11 +425,11 @@ bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
// Fake a request to return the GroupMetaData. // Fake a request to return the GroupMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds; std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one. groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3WikiService::createGroup() Generating Request Token: " << token << std::endl; std::cerr << "p3WikiServiceVEG::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
@ -437,12 +437,12 @@ bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew) bool p3WikiServiceVEG::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
{ {
if (page.mMeta.mGroupId.empty()) if (page.mMeta.mGroupId.empty())
{ {
/* new photo */ /* new photo */
std::cerr << "p3WikiService::createPage() Missing PageID"; std::cerr << "p3WikiServiceVEG::createPage() Missing PageID";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -450,7 +450,7 @@ bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
/* check if its a mod or new page */ /* check if its a mod or new page */
if (page.mMeta.mOrigMsgId.empty()) if (page.mMeta.mOrigMsgId.empty())
{ {
std::cerr << "p3WikiService::createPage() New Page"; std::cerr << "p3WikiServiceVEG::createPage() New Page";
std::cerr << std::endl; std::cerr << std::endl;
/* new page, generate a new OrigPageId */ /* new page, generate a new OrigPageId */
@ -459,18 +459,18 @@ bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
} }
else else
{ {
std::cerr << "p3WikiService::createPage() Modified Page"; std::cerr << "p3WikiServiceVEG::createPage() Modified Page";
std::cerr << std::endl; std::cerr << std::endl;
/* mod page, keep orig page id, generate a new PageId */ /* mod page, keep orig page id, generate a new PageId */
page.mMeta.mMsgId = genRandomId(); page.mMeta.mMsgId = genRandomId();
} }
std::cerr << "p3WikiService::createPage() GroupId: " << page.mMeta.mGroupId; std::cerr << "p3WikiServiceVEG::createPage() GroupId: " << page.mMeta.mGroupId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3WikiService::createPage() PageId: " << page.mMeta.mMsgId; std::cerr << "p3WikiServiceVEG::createPage() PageId: " << page.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3WikiService::createPage() OrigPageId: " << page.mMeta.mOrigMsgId; std::cerr << "p3WikiServiceVEG::createPage() OrigPageId: " << page.mMeta.mOrigMsgId;
std::cerr << std::endl; std::cerr << std::endl;
{ {
@ -483,11 +483,11 @@ bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
// Fake a request to return the MsgMetaData. // Fake a request to return the MsgMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds; std::list<std::string> msgIds;
msgIds.push_back(page.mMeta.mMsgId); // It will just return this one. msgIds.push_back(page.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3WikiService::createPage() Generating Request Token: " << token << std::endl; std::cerr << "p3WikiServiceVEG::createPage() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;

View File

@ -26,8 +26,8 @@
#ifndef P3_WIKI_SERVICE_HEADER #ifndef P3_WIKI_SERVICE_HEADER
#define P3_WIKI_SERVICE_HEADER #define P3_WIKI_SERVICE_HEADER
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
#include "retroshare/rswiki.h" #include "retroshare/rswikiVEG.h"
#include <map> #include <map>
#include <string> #include <string>
@ -47,7 +47,7 @@
* *
*/ */
class WikiDataProxy: public GxsDataProxy class WikiDataProxy: public GxsDataProxyVEG
{ {
public: public:
@ -63,11 +63,11 @@ virtual bool convertMsgToMetaData(void *msgData, RsMsgMetaData &meta);
}; };
class p3WikiService: public p3GxsDataService, public RsWiki class p3WikiServiceVEG: public p3GxsDataServiceVEG, public RsWikiVEG
{ {
public: public:
p3WikiService(uint16_t type); p3WikiServiceVEG(uint16_t type);
virtual int tick(); virtual int tick();
@ -77,9 +77,9 @@ virtual int tick();
virtual bool updated(); virtual bool updated();
/* Data Requests */ /* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds); virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */ /* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds); virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);

View File

@ -23,7 +23,7 @@
* *
*/ */
#include "services/p3wire.h" #include "services/p3wireVEG.h"
#include "util/rsrandom.h" #include "util/rsrandom.h"
@ -31,15 +31,15 @@
* #define WIKI_DEBUG 1 * #define WIKI_DEBUG 1
****/ ****/
RsWire *rsWire = NULL; RsWireVEG *rsWireVEG = NULL;
/********************************************************************************/ /********************************************************************************/
/******************* Startup / Tick ******************************************/ /******************* Startup / Tick ******************************************/
/********************************************************************************/ /********************************************************************************/
p3Wire::p3Wire(uint16_t type) p3WireVEG::p3WireVEG(uint16_t type)
:p3GxsDataService(type, new WireDataProxy()), mWireMtx("p3Wire"), mUpdated(true) :p3GxsDataServiceVEG(type, new WireDataProxy()), mWireMtx("p3Wire"), mUpdated(true)
{ {
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
@ -48,9 +48,9 @@ p3Wire::p3Wire(uint16_t type)
} }
int p3Wire::tick() int p3WireVEG::tick()
{ {
//std::cerr << "p3Wire::tick()"; //std::cerr << "p3WireVEG::tick()";
//std::cerr << std::endl; //std::cerr << std::endl;
fakeprocessrequests(); fakeprocessrequests();
@ -58,7 +58,7 @@ int p3Wire::tick()
return 0; return 0;
} }
bool p3Wire::updated() bool p3WireVEG::updated()
{ {
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
@ -73,35 +73,35 @@ bool p3Wire::updated()
/* Data Requests */ /* Data Requests */
bool p3Wire::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3WireVEG::requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3Wire::requestGroupInfo() gets Token: " << token << std::endl; std::cerr << "p3WireVEG::requestGroupInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
return true; return true;
} }
bool p3Wire::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds) bool p3WireVEG::requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3Wire::requestMsgInfo() gets Token: " << token << std::endl; std::cerr << "p3WireVEG::requestMsgInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGS, groupIds);
return true; return true;
} }
bool p3Wire::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds) bool p3WireVEG::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds)
{ {
generateToken(token); generateToken(token);
std::cerr << "p3Wire::requestMsgRelatedInfo() gets Token: " << token << std::endl; std::cerr << "p3WireVEG::requestMsgRelatedInfo() gets Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
} }
/* Generic Lists */ /* Generic Lists */
bool p3Wire::getGroupList( const uint32_t &token, std::list<std::string> &groupIds) bool p3WireVEG::getGroupList( const uint32_t &token, std::list<std::string> &groupIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -111,19 +111,19 @@ bool p3Wire::getGroupList( const uint32_t &token, std::list<std::string>
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3Wire::getGroupList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3Wire::getGroupList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getGroupList() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getGroupList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -136,7 +136,7 @@ bool p3Wire::getGroupList( const uint32_t &token, std::list<std::string>
bool p3Wire::getMsgList( const uint32_t &token, std::list<std::string> &msgIds) bool p3WireVEG::getMsgList( const uint32_t &token, std::list<std::string> &msgIds)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -146,19 +146,19 @@ bool p3Wire::getMsgList( const uint32_t &token, std::list<std::string>
if (anstype != RS_TOKREQ_ANSTYPE_LIST) if (anstype != RS_TOKREQ_ANSTYPE_LIST)
{ {
std::cerr << "p3Wire::getMsgList() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgList() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3Wire::getMsgList() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgList() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getMsgList() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getMsgList() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -170,7 +170,7 @@ bool p3Wire::getMsgList( const uint32_t &token, std::list<std::string>
/* Generic Summary */ /* Generic Summary */
bool p3Wire::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo) bool p3WireVEG::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaData> &groupInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -180,19 +180,19 @@ bool p3Wire::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaD
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3Wire::getGroupSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3Wire::getGroupSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getGroupSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getGroupSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -206,7 +206,7 @@ bool p3Wire::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaD
return ans; return ans;
} }
bool p3Wire::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo) bool p3WireVEG::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaData> &msgInfo)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -216,19 +216,19 @@ bool p3Wire::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaDat
if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY) if (anstype != RS_TOKREQ_ANSTYPE_SUMMARY)
{ {
std::cerr << "p3Wire::getMsgSummary() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgSummary() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3Wire::getMsgSummary() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgSummary() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getMsgSummary() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getMsgSummary() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -244,7 +244,7 @@ bool p3Wire::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaDat
/* Specific Service Data */ /* Specific Service Data */
bool p3Wire::getGroupData(const uint32_t &token, RsWireGroup &group) bool p3WireVEG::getGroupData(const uint32_t &token, RsWireGroup &group)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -255,19 +255,19 @@ bool p3Wire::getGroupData(const uint32_t &token, RsWireGroup &group)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3Wire::getGroupData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if (reqtype != GXS_REQUEST_TYPE_GROUPS) if (reqtype != GXS_REQUEST_TYPE_GROUPS)
{ {
std::cerr << "p3Wire::getGroupData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getGroupData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getGroupData() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getGroupData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -285,7 +285,7 @@ bool p3Wire::getGroupData(const uint32_t &token, RsWireGroup &group)
} }
bool p3Wire::getMsgData(const uint32_t &token, RsWirePulse &pulse) bool p3WireVEG::getMsgData(const uint32_t &token, RsWirePulse &pulse)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -296,19 +296,19 @@ bool p3Wire::getMsgData(const uint32_t &token, RsWirePulse &pulse)
if (anstype != RS_TOKREQ_ANSTYPE_DATA) if (anstype != RS_TOKREQ_ANSTYPE_DATA)
{ {
std::cerr << "p3Wire::getMsgData() ERROR AnsType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgData() ERROR AnsType Wrong" << std::endl;
return false; return false;
} }
if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED)) if ((reqtype != GXS_REQUEST_TYPE_MSGS) && (reqtype != GXS_REQUEST_TYPE_MSGRELATED))
{ {
std::cerr << "p3Wire::getMsgData() ERROR ReqType Wrong" << std::endl; std::cerr << "p3WireVEG::getMsgData() ERROR ReqType Wrong" << std::endl;
return false; return false;
} }
if (status != GXS_REQUEST_STATUS_COMPLETE) if (status != GXS_REQUEST_STATUS_COMPLETE)
{ {
std::cerr << "p3Wire::getMsgData() ERROR Status Incomplete" << std::endl; std::cerr << "p3WireVEG::getMsgData() ERROR Status Incomplete" << std::endl;
return false; return false;
} }
@ -328,7 +328,7 @@ bool p3Wire::getMsgData(const uint32_t &token, RsWirePulse &pulse)
/* Poll */ /* Poll */
uint32_t p3Wire::requestStatus(const uint32_t token) uint32_t p3WireVEG::requestStatus(const uint32_t token)
{ {
uint32_t status; uint32_t status;
uint32_t reqtype; uint32_t reqtype;
@ -341,46 +341,46 @@ uint32_t p3Wire::requestStatus(const uint32_t token)
/* Cancel Request */ /* Cancel Request */
bool p3Wire::cancelRequest(const uint32_t &token) bool p3WireVEG::cancelRequest(const uint32_t &token)
{ {
return clearRequest(token); return clearRequest(token);
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
bool p3Wire::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask) bool p3WireVEG::setMessageStatus(const std::string &msgId, const uint32_t status, const uint32_t statusMask)
{ {
return mWireProxy->setMessageStatus(msgId, status, statusMask); return mWireProxy->setMessageStatus(msgId, status, statusMask);
} }
bool p3Wire::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask) bool p3WireVEG::setGroupStatus(const std::string &groupId, const uint32_t status, const uint32_t statusMask)
{ {
return mWireProxy->setGroupStatus(groupId, status, statusMask); return mWireProxy->setGroupStatus(groupId, status, statusMask);
} }
bool p3Wire::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask) bool p3WireVEG::setGroupSubscribeFlags(const std::string &groupId, uint32_t subscribeFlags, uint32_t subscribeMask)
{ {
return mWireProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask); return mWireProxy->setGroupSubscribeFlags(groupId, subscribeFlags, subscribeMask);
} }
bool p3Wire::setMessageServiceString(const std::string &msgId, const std::string &str) bool p3WireVEG::setMessageServiceString(const std::string &msgId, const std::string &str)
{ {
return mWireProxy->setMessageServiceString(msgId, str); return mWireProxy->setMessageServiceString(msgId, str);
} }
bool p3Wire::setGroupServiceString(const std::string &grpId, const std::string &str) bool p3WireVEG::setGroupServiceString(const std::string &grpId, const std::string &str)
{ {
return mWireProxy->setGroupServiceString(grpId, str); return mWireProxy->setGroupServiceString(grpId, str);
} }
bool p3Wire::groupRestoreKeys(const std::string &groupId) bool p3WireVEG::groupRestoreKeys(const std::string &groupId)
{ {
return false; return false;
} }
bool p3Wire::groupShareKeys(const std::string &groupId, std::list<std::string>& peers) bool p3WireVEG::groupShareKeys(const std::string &groupId, std::list<std::string>& peers)
{ {
return false; return false;
} }
@ -389,7 +389,7 @@ bool p3Wire::groupShareKeys(const std::string &groupId, std::list<std::string>&
/********************************************************************************************/ /********************************************************************************************/
std::string p3Wire::genRandomId() std::string p3WireVEG::genRandomId()
{ {
std::string randomId; std::string randomId;
for(int i = 0; i < 20; i++) for(int i = 0; i < 20; i++)
@ -401,7 +401,7 @@ std::string p3Wire::genRandomId()
} }
bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew) bool p3WireVEG::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
{ {
if (group.mMeta.mGroupId.empty()) if (group.mMeta.mGroupId.empty())
{ {
@ -412,7 +412,7 @@ bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
} }
else else
{ {
std::cerr << "p3Wire::createGroup() Group with existing Id... dropping"; std::cerr << "p3WireVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -427,7 +427,7 @@ bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
// Fake a request to return the GroupMetaData. // Fake a request to return the GroupMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds; std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one. groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
@ -440,12 +440,12 @@ bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew) bool p3WireVEG::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
{ {
if (pulse.mMeta.mGroupId.empty()) if (pulse.mMeta.mGroupId.empty())
{ {
/* new photo */ /* new photo */
std::cerr << "p3Wire::createPulse() Missing PulseID"; std::cerr << "p3WireVEG::createPulse() Missing PulseID";
std::cerr << std::endl; std::cerr << std::endl;
return false; return false;
} }
@ -453,7 +453,7 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
/* check if its a mod or new pulse */ /* check if its a mod or new pulse */
if (pulse.mMeta.mOrigMsgId.empty()) if (pulse.mMeta.mOrigMsgId.empty())
{ {
std::cerr << "p3Wire::createPulse() New Pulse"; std::cerr << "p3WireVEG::createPulse() New Pulse";
std::cerr << std::endl; std::cerr << std::endl;
/* new pulse, generate a new OrigPulseId */ /* new pulse, generate a new OrigPulseId */
@ -462,18 +462,18 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
} }
else else
{ {
std::cerr << "p3Wire::createPulse() Modified Pulse"; std::cerr << "p3WireVEG::createPulse() Modified Pulse";
std::cerr << std::endl; std::cerr << std::endl;
/* mod pulse, keep orig pulse id, generate a new PulseId */ /* mod pulse, keep orig pulse id, generate a new PulseId */
pulse.mMeta.mMsgId = genRandomId(); pulse.mMeta.mMsgId = genRandomId();
} }
std::cerr << "p3Wire::createPulse() GroupId: " << pulse.mMeta.mGroupId; std::cerr << "p3WireVEG::createPulse() GroupId: " << pulse.mMeta.mGroupId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3Wire::createPulse() PulseId: " << pulse.mMeta.mMsgId; std::cerr << "p3WireVEG::createPulse() PulseId: " << pulse.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "p3Wire::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId; std::cerr << "p3WireVEG::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId;
std::cerr << std::endl; std::cerr << std::endl;
{ {
@ -486,11 +486,11 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
// Fake a request to return the MsgMetaData. // Fake a request to return the MsgMetaData.
generateToken(token); generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY; uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good. RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds; std::list<std::string> msgIds;
msgIds.push_back(pulse.mMeta.mMsgId); // It will just return this one. msgIds.push_back(pulse.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3Wire::createPulse() Generating Request Token: " << token << std::endl; std::cerr << "p3WireVEG::createPulse() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds); storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true; return true;
@ -607,7 +607,7 @@ bool WireDataProxy::convertMsgToMetaData(void *msgData, RsMsgMetaData &meta)
#if 0 #if 0
bool p3Wire::generateDummyData() bool p3WireVEG::generateDummyData()
{ {
#define MAX_GROUPS 100 #define MAX_GROUPS 100
#define MAX_POSTS 1000 #define MAX_POSTS 1000

View File

@ -23,12 +23,12 @@
* *
*/ */
#ifndef P3_WIRE_SERVICE_HEADER #ifndef P3_WIRE_SERVICE_VEG_HEADER
#define P3_WIRE_SERVICE_HEADER #define P3_WIRE_SERVICE_VEG_HEADER
#include "services/p3gxsservice.h" #include "services/p3gxsserviceVEG.h"
#include "retroshare/rswire.h" #include "retroshare/rswireVEG.h"
#include <map> #include <map>
#include <string> #include <string>
@ -37,7 +37,7 @@
* Wire Service * Wire Service
* *
*/ */
class WireDataProxy: public GxsDataProxy class WireDataProxy: public GxsDataProxyVEG
{ {
public: public:
@ -53,11 +53,11 @@ virtual bool convertMsgToMetaData(void *msgData, RsMsgMetaData &meta);
}; };
class p3Wire: public p3GxsDataService, public RsWire class p3WireVEG: public p3GxsDataServiceVEG, public RsWireVEG
{ {
public: public:
p3Wire(uint16_t type); p3WireVEG(uint16_t type);
virtual int tick(); virtual int tick();
@ -67,9 +67,9 @@ virtual int tick();
virtual bool updated(); virtual bool updated();
/* Data Requests */ /* Data Requests */
virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestGroupInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &groupIds); virtual bool requestMsgInfo( uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds);
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<std::string> &msgIds); virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsVEG &opts, const std::list<std::string> &msgIds);
/* Generic Lists */ /* Generic Lists */
virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds); virtual bool getGroupList( const uint32_t &token, std::list<std::string> &groupIds);