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

@ -23,7 +23,7 @@
*
*/
#include "services/p3forumsv2.h"
#include "services/p3forumsVEG.h"
#include "util/rsrandom.h"
#include <stdio.h>
@ -32,7 +32,7 @@
* #define FORUMV2_DEBUG 1
****/
RsForumsV2 *rsForumsV2 = NULL;
RsForumsVEG *rsForumsVEG = NULL;
@ -40,8 +40,8 @@ RsForumsV2 *rsForumsV2 = NULL;
/******************* Startup / Tick ******************************************/
/********************************************************************************/
p3ForumsV2::p3ForumsV2(uint16_t type)
:p3GxsDataService(type, new ForumDataProxy()), mForumMtx("p3ForumsV2"), mUpdated(true)
p3ForumsVEG::p3ForumsVEG(uint16_t type)
:p3GxsDataServiceVEG(type, new ForumDataProxy()), mForumMtx("p3ForumsV2"), mUpdated(true)
{
{
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;
fakeprocessrequests();
@ -65,7 +65,7 @@ int p3ForumsV2::tick()
return 0;
}
bool p3ForumsV2::updated()
bool p3ForumsVEG::updated()
{
RsStackMutex stack(mForumMtx); /********** STACK LOCKED MTX ******/
@ -80,35 +80,35 @@ bool p3ForumsV2::updated()
/* 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);
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);
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);
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);
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);
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);
return true;
}
/* 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 reqtype;
@ -118,19 +118,19 @@ bool p3ForumsV2::getGroupList( const uint32_t &token, std::list<std::str
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -153,19 +153,19 @@ bool p3ForumsV2::getMsgList( const uint32_t &token, std::list<std::str
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;
}
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;
}
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;
}
@ -177,7 +177,7 @@ bool p3ForumsV2::getMsgList( const uint32_t &token, std::list<std::str
/* 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 reqtype;
@ -187,19 +187,19 @@ bool p3ForumsV2::getGroupSummary( const uint32_t &token, std::list<RsGroupM
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;
}
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;
}
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;
}
@ -213,7 +213,7 @@ bool p3ForumsV2::getGroupSummary( const uint32_t &token, std::list<RsGroupM
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 reqtype;
@ -223,19 +223,19 @@ bool p3ForumsV2::getMsgSummary( const uint32_t &token, std::list<RsMsgMet
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;
}
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;
}
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;
}
@ -251,7 +251,7 @@ bool p3ForumsV2::getMsgSummary( const uint32_t &token, std::list<RsMsgMet
/* 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 reqtype;
@ -262,19 +262,19 @@ bool p3ForumsV2::getGroupData(const uint32_t &token, RsForumV2Group &group)
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -303,19 +303,19 @@ bool p3ForumsV2::getMsgData(const uint32_t &token, RsForumV2Msg &msg)
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;
}
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;
}
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;
}
@ -335,7 +335,7 @@ bool p3ForumsV2::getMsgData(const uint32_t &token, RsForumV2Msg &msg)
/* Poll */
uint32_t p3ForumsV2::requestStatus(const uint32_t token)
uint32_t p3ForumsVEG::requestStatus(const uint32_t token)
{
uint32_t status;
uint32_t reqtype;
@ -348,46 +348,46 @@ uint32_t p3ForumsV2::requestStatus(const uint32_t token)
/* Cancel Request */
bool p3ForumsV2::cancelRequest(const uint32_t &token)
bool p3ForumsVEG::cancelRequest(const uint32_t &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);
}
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);
}
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);
}
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);
}
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);
}
bool p3ForumsV2::groupRestoreKeys(const std::string &groupId)
bool p3ForumsVEG::groupRestoreKeys(const std::string &groupId)
{
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;
}
@ -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;
for(int i = 0; i < 20; i++)
@ -409,7 +409,7 @@ std::string p3ForumsV2::genRandomId()
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())
{
@ -420,7 +420,7 @@ bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
}
else
{
std::cerr << "p3ForumsV2::createGroup() Group with existing Id... dropping";
std::cerr << "p3ForumsVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl;
return false;
}
@ -435,11 +435,11 @@ bool p3ForumsV2::createGroup(uint32_t &token, RsForumV2Group &group, bool isNew)
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3ForumsV2::createGroup() Generating Request Token: " << token << std::endl;
std::cerr << "p3ForumsVEG::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
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())
{
/* new photo */
std::cerr << "p3ForumsV2::createForumMsg() Missing MsgID";
std::cerr << "p3ForumsVEG::createForumMsg() Missing MsgID";
std::cerr << std::endl;
return false;
}
@ -461,7 +461,7 @@ bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
/* check if its a mod or new msg */
if (msg.mMeta.mOrigMsgId.empty())
{
std::cerr << "p3ForumsV2::createForumMsg() New Msg";
std::cerr << "p3ForumsVEG::createForumMsg() New Msg";
std::cerr << std::endl;
/* new msg, generate a new OrigMsgId */
@ -470,18 +470,18 @@ bool p3ForumsV2::createMsg(uint32_t &token, RsForumV2Msg &msg, bool isNew)
}
else
{
std::cerr << "p3ForumsV2::createForumMsg() Modified Msg";
std::cerr << "p3ForumsVEG::createForumMsg() Modified Msg";
std::cerr << std::endl;
/* mod msg, keep orig msg id, generate a new MsgId */
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 << "p3ForumsV2::createForumMsg() MsgId: " << msg.mMeta.mMsgId;
std::cerr << "p3ForumsVEG::createForumMsg() MsgId: " << msg.mMeta.mMsgId;
std::cerr << std::endl;
std::cerr << "p3ForumsV2::createForumMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId;
std::cerr << "p3ForumsVEG::createForumMsg() OrigMsgId: " << msg.mMeta.mOrigMsgId;
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.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(msg.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3ForumsV2::createMsg() Generating Request Token: " << token << std::endl;
std::cerr << "p3ForumsVEG::createMsg() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
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 */
#define MAX_FORUMS 10 //100
@ -673,7 +673,7 @@ bool p3ForumsV2::generateDummyData()
mGroups.push_back(forum);
//std::cerr << "p3ForumsV2::generateDummyData() Generated Forum: " << forum.mMeta;
//std::cerr << "p3ForumsVEG::generateDummyData() Generated Forum: " << forum.mMeta;
//std::cerr << std::endl;
}
@ -725,7 +725,7 @@ bool p3ForumsV2::generateDummyData()
mMsgs.push_back(msg);
//std::cerr << "p3ForumsV2::generateDummyData() Generated Thread: " << msg.mMeta;
//std::cerr << "p3ForumsVEG::generateDummyData() Generated Thread: " << msg.mMeta;
//std::cerr << std::endl;
}
@ -778,7 +778,7 @@ bool p3ForumsV2::generateDummyData()
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;
}

View file

@ -26,9 +26,9 @@
#ifndef 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 <string>
@ -37,7 +37,7 @@
*
*/
class ForumDataProxy: public GxsDataProxy
class ForumDataProxy: public GxsDataProxyVEG
{
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:
p3ForumsV2(uint16_t type);
p3ForumsVEG(uint16_t type);
virtual int tick();
@ -72,9 +72,9 @@ virtual bool updated();
/* Data Requests */
virtual bool requestGroupInfo( 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 RsTokReqOptions &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 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);

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")
{
mNextToken = 0;
return;
}
bool p3GxsService::generateToken(uint32_t &token)
bool p3GxsServiceVEG::generateToken(uint32_t &token)
{
RsStackMutex stack(mReqMtx); /****** LOCKED *****/
@ -41,7 +41,7 @@ bool p3GxsService::generateToken(uint32_t &token)
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 *****/
@ -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 *****/
@ -77,7 +77,7 @@ bool p3GxsService::clearRequest(const uint32_t &token)
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 *****/
@ -94,7 +94,7 @@ bool p3GxsService::updateRequestStatus(const uint32_t &token, const uint32_t &st
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 *****/
@ -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 *****/
@ -138,7 +138,7 @@ bool p3GxsService::updateRequestOutList(const uint32_t &token, std::list<std::st
}
#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 *****/
@ -160,7 +160,7 @@ bool p3GxsService::updateRequestData(const uint32_t &token, std::map<std::string
}
#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 *****/
@ -182,7 +182,7 @@ bool p3GxsService::checkRequestStatus(const uint32_t &token, uint32_t &status
// 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 *****/
@ -196,7 +196,7 @@ bool p3GxsService::tokenList(std::list<uint32_t> &tokens)
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 *****/
@ -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 *****/
@ -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 *****/
@ -270,7 +270,7 @@ bool p3GxsService::loadRequestOutList(const uint32_t &token, std::list<std::s
#define MAX_REQUEST_AGE 10
bool p3GxsService::fakeprocessrequests()
bool p3GxsServiceVEG::fakeprocessrequests()
{
std::list<uint32_t>::iterator it;
std::list<uint32_t> tokens;
@ -287,7 +287,7 @@ bool p3GxsService::fakeprocessrequests()
time_t 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)
{
@ -299,13 +299,13 @@ bool p3GxsService::fakeprocessrequests()
}
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;
clearRequest(token);
}
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;
clearRequest(token);
}
@ -334,14 +334,14 @@ bool p3GxsService::fakeprocessrequests()
*
****/
GxsDataProxy::GxsDataProxy()
GxsDataProxyVEG::GxsDataProxyVEG()
:mDataMtx("GxsDataProxyMtx")
{
return;
}
static bool checkGroupFilter(const RsTokReqOptions &opts, const RsGroupMetaData &group)
static bool checkGroupFilter(const RsTokReqOptionsVEG &opts, const RsGroupMetaData &group)
{
bool statusMatch = false;
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;
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;
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;
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 ...
* 1) if groupIds is Empty... return all groupIds.
* 2) else copy list.
*
*/
std::cerr << "GxsDataProxy::getGroupList()";
std::cerr << "GxsDataProxyVEG::getGroupList()";
std::cerr << std::endl;
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.
* Input is groupList + Flags.
* 1) No Flags => All Messages in those Groups.
*
*/
std::cerr << "GxsDataProxy::getMsgList()";
std::cerr << "GxsDataProxyVEG::getMsgList()";
std::cerr << std::endl;
@ -597,20 +597,20 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
// Can only choose one of these two.
if (opts.mOptions & RS_TOKREQOPT_MSG_ORIGMSG)
{
std::cerr << "GxsDataProxy::getMsgList() MSG_ORIGMSG";
std::cerr << "GxsDataProxyVEG::getMsgList() MSG_ORIGMSG";
std::cerr << std::endl;
onlyOrigMsgs = true;
}
else if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST)
{
std::cerr << "GxsDataProxy::getMsgList() MSG_LATEST";
std::cerr << "GxsDataProxyVEG::getMsgList() MSG_LATEST";
std::cerr << std::endl;
onlyLatestMsgs = true;
}
if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD)
{
std::cerr << "GxsDataProxy::getMsgList() MSG_THREAD";
std::cerr << "GxsDataProxyVEG::getMsgList() MSG_THREAD";
std::cerr << std::endl;
onlyThreadHeadMsgs = true;
}
@ -648,7 +648,7 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
bool addMsg = false;
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 << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs;
@ -659,7 +659,7 @@ bool GxsDataProxy::getMsgList( uint32_t &token, const RsTokReqOptions &opt
// check timestamps.
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 << " MsgId: " << mit->second.mMsgId;
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.
* 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;
bool onlyLatestMsgs = false;
@ -746,34 +746,34 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST)
{
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_LATEST";
std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_LATEST";
std::cerr << std::endl;
onlyLatestMsgs = true;
}
else if (opts.mOptions & RS_TOKREQOPT_MSG_VERSIONS)
{
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_VERSIONS";
std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_VERSIONS";
std::cerr << std::endl;
onlyAllVersions = true;
}
if (opts.mOptions & RS_TOKREQOPT_MSG_PARENT)
{
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_PARENTS";
std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_PARENTS";
std::cerr << std::endl;
onlyChildMsgs = true;
}
if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD)
{
std::cerr << "GxsDataProxy::getMsgRelatedList() MSG_THREAD";
std::cerr << "GxsDataProxyVEG::getMsgRelatedList() MSG_THREAD";
std::cerr << std::endl;
onlyThreadMsgs = true;
}
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;
return false;
@ -781,7 +781,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
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;
return false;
@ -789,7 +789,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
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;
return false;
@ -797,7 +797,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
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;
return false;
@ -805,7 +805,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
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;
return false;
@ -815,7 +815,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
/* FALL BACK OPTION */
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;
/* just copy */
outMsgIds = msgIds;
@ -870,7 +870,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
bool addMsg = false;
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 << " MsgId: " << mit->second.mMsgId;
std::cerr << " TS: " << mit->second.mPublishTs;
@ -881,7 +881,7 @@ bool GxsDataProxy::getMsgRelatedList(uint32_t &token, const RsTokReqOptions &opt
// check timestamps.
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 << " MsgId: " << mit->second.mMsgId;
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;
if (convertGroupToMetaData(groupData, meta))
{
if (!isUniqueGroup(meta.mGroupId))
{
std::cerr << "GxsDataProxy::createGroup() ERROR GroupId Clashes, discarding";
std::cerr << "GxsDataProxyVEG::createGroup() ERROR GroupId Clashes, discarding";
std::cerr << std::endl;
return false;
}
@ -967,20 +967,20 @@ bool GxsDataProxy::createGroup(void *groupData)
return true;
}
std::cerr << "GxsDataProxy::createGroup() ERROR Failed to convert Data";
std::cerr << "GxsDataProxyVEG::createGroup() ERROR Failed to convert Data";
std::cerr << std::endl;
return false;
}
bool GxsDataProxy::createMsg(void *msgData)
bool GxsDataProxyVEG::createMsg(void *msgData)
{
RsMsgMetaData meta;
if (convertMsgToMetaData(msgData, meta))
{
if (!isUniqueMsg(meta.mMsgId))
{
std::cerr << "GxsDataProxy::createMsg() ERROR MsgId Clashes, discarding";
std::cerr << "GxsDataProxyVEG::createMsg() ERROR MsgId Clashes, discarding";
std::cerr << std::endl;
return false;
}
@ -993,7 +993,7 @@ bool GxsDataProxy::createMsg(void *msgData)
git = mGroupMetaData.find(meta.mGroupId);
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;
return false;
}
@ -1013,14 +1013,14 @@ bool GxsDataProxy::createMsg(void *msgData)
return true;
}
std::cerr << "GxsDataProxy::createMsg() ERROR Failed to convert Data";
std::cerr << "GxsDataProxyVEG::createMsg() ERROR Failed to convert Data";
std::cerr << std::endl;
return false;
}
// 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 *****/
@ -1030,7 +1030,7 @@ bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t stat
if (mit == mMsgMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
}
else
@ -1044,7 +1044,7 @@ bool GxsDataProxy::setMessageStatus(const std::string &msgId,const uint32_t stat
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 *****/
@ -1054,7 +1054,7 @@ bool GxsDataProxy::setGroupStatus(const std::string &groupId, const uint32_t sta
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupStatus() Error Finding GroupId: " << groupId;
std::cerr << "GxsDataProxyVEG::setGroupStatus() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
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 *****/
@ -1079,7 +1079,7 @@ bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t s
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupSubscribeFlags() Error Finding GroupId: " << groupId;
std::cerr << "GxsDataProxyVEG::setGroupSubscribeFlags() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
else
@ -1093,7 +1093,7 @@ bool GxsDataProxy::setGroupSubscribeFlags(const std::string &groupId, uint32_t s
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 *****/
@ -1103,7 +1103,7 @@ bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::
if (mit == mMsgMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setMessageServiceString() Error Finding MsgId: " << msgId;
std::cerr << "GxsDataProxyVEG::setMessageServiceString() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
}
else
@ -1115,7 +1115,7 @@ bool GxsDataProxy::setMessageServiceString(const std::string &msgId, const std::
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 *****/
@ -1125,7 +1125,7 @@ bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::
if (git == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::setGroupServiceString() Error Finding GroupId: " << groupId;
std::cerr << "GxsDataProxyVEG::setGroupServiceString() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
}
else
@ -1139,22 +1139,22 @@ bool GxsDataProxy::setGroupServiceString(const std::string &groupId, const std::
/* 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;
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;
return false;
}
/* extract Data */
bool GxsDataProxy::getGroupSummary(const std::string &groupId, RsGroupMetaData &groupSummary)
bool GxsDataProxyVEG::getGroupSummary(const std::string &groupId, RsGroupMetaData &groupSummary)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1164,7 +1164,7 @@ bool GxsDataProxy::getGroupSummary(const std::string &groupId, RsGroupMetaData &
if (mit == mGroupMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::getGroupMetaData() Error Finding GroupId: " << groupId;
std::cerr << "GxsDataProxyVEG::getGroupMetaData() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
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 *****/
@ -1186,7 +1186,7 @@ bool GxsDataProxy::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSum
if (mit == mMsgMetaData.end())
{
// error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
}
else
@ -1198,7 +1198,7 @@ bool GxsDataProxy::getMsgSummary(const std::string &msgId, RsMsgMetaData &msgSum
/* 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;
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())
{
// error.
std::cerr << "GxsDataProxy::getGroupMetaData() Error Finding GroupId: " << *it;
std::cerr << "GxsDataProxyVEG::getGroupMetaData() Error Finding GroupId: " << *it;
std::cerr << std::endl;
}
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;
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())
{
// error.
std::cerr << "GxsDataProxy::getMsgSummary() Error Finding MsgId: " << *it;
std::cerr << "GxsDataProxyVEG::getMsgSummary() Error Finding MsgId: " << *it;
std::cerr << std::endl;
}
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 *****/
@ -1258,7 +1258,7 @@ bool GxsDataProxy::getGroupData(const std::string &groupId, void * &groupData)
if (mit == mGroupData.end())
{
// error.
std::cerr << "GxsDataProxy::getGroupData() Error Finding GroupId: " << groupId;
std::cerr << "GxsDataProxyVEG::getGroupData() Error Finding GroupId: " << groupId;
std::cerr << std::endl;
return false;
}
@ -1269,7 +1269,7 @@ bool GxsDataProxy::getGroupData(const std::string &groupId, void * &groupData)
return true;
}
bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData)
bool GxsDataProxyVEG::getMsgData(const std::string &msgId, void * &msgData)
{
RsStackMutex stack(mDataMtx); /***** LOCKED *****/
@ -1279,7 +1279,7 @@ bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData)
if (mit == mMsgData.end())
{
// error.
std::cerr << "GxsDataProxy::getMsgData() Error Finding MsgId: " << msgId;
std::cerr << "GxsDataProxyVEG::getMsgData() Error Finding MsgId: " << msgId;
std::cerr << std::endl;
return false;
}
@ -1291,7 +1291,7 @@ bool GxsDataProxy::getMsgData(const std::string &msgId, void * &msgData)
}
#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;
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())
{
// error.
std::cerr << "GxsDataProxy::getGroupData() Error Finding GroupId: " << *it;
std::cerr << "GxsDataProxyVEG::getGroupData() Error Finding GroupId: " << *it;
std::cerr << std::endl;
}
else
@ -1315,7 +1315,7 @@ bool GxsDataProxy::getGroupData(const std::list<std::string> &groupIds, std::lis
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;
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())
{
// error.
std::cerr << "GxsDataProxy::getMsgData() Error Finding MsgId: " << *it;
std::cerr << "GxsDataProxyVEG::getMsgData() Error Finding MsgId: " << *it;
std::cerr << std::endl;
}
else
@ -1340,7 +1340,7 @@ bool GxsDataProxy::getMsgData(const std::list<std::string> &msgIds, std::list<vo
}
#endif
bool GxsDataProxy::isUniqueMsg(const std::string &msgId)
bool GxsDataProxyVEG::isUniqueMsg(const std::string &msgId)
{
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 *****/
@ -1370,8 +1370,8 @@ bool GxsDataProxy::isUniqueGroup(const std::string &groupId)
/*********************************************************************************************************/
p3GxsDataService::p3GxsDataService(uint16_t type, GxsDataProxy *proxy)
:p3GxsService(type), mProxy(proxy)
p3GxsDataServiceVEG::p3GxsDataServiceVEG(uint16_t type, GxsDataProxyVEG *proxy)
:p3GxsServiceVEG(type), mProxy(proxy)
{
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>::iterator cit;
@ -1392,11 +1392,11 @@ bool p3GxsDataService::fakeprocessrequests()
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)
{
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;
/* PROCESS REQUEST! */
switch(it->second.reqType)
@ -1421,13 +1421,13 @@ bool p3GxsDataService::fakeprocessrequests()
}
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;
toClear.push_back(it->second.token);
}
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;
toClear.push_back(it->second.token);
}

View file

@ -27,7 +27,7 @@
#define P3_GXS_SERVICE_HEADER
#include "services/p3service.h"
#include "retroshare/rsidentity.h"
#include "retroshare/rsidentityVEG.h"
/*
* This class provides useful generic support for GXS style services.
@ -54,7 +54,7 @@ class gxsRequest
uint32_t ansType;
uint32_t reqType;
RsTokReqOptions Options;
RsTokReqOptionsVEG Options;
uint32_t status;
@ -64,18 +64,18 @@ class gxsRequest
};
class p3GxsService: public p3Service
class p3GxsServiceVEG: public p3Service
{
protected:
p3GxsService(uint16_t type);
p3GxsServiceVEG(uint16_t type);
public:
//virtual ~p3Service() { p3Service::~p3Service(); return; }
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 updateRequestStatus(const uint32_t &token, const uint32_t &status);
@ -103,15 +103,15 @@ virtual bool fakeprocessrequests();
};
class GxsDataProxy
class GxsDataProxyVEG
{
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 getMsgList( uint32_t &token, const RsTokReqOptions &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 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 RsTokReqOptionsVEG &opts, const std::list<std::string> &groupIds, 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
@ -157,8 +157,8 @@ virtual bool setGroupServiceString(const std::string &grpId, const std::string &
protected:
bool filterGroupList(const RsTokReqOptions &opts, std::list<std::string> &groupIds);
bool filterMsgList(const RsTokReqOptions &opts, std::list<std::string> &msgIds);
bool filterGroupList(const RsTokReqOptionsVEG &opts, std::list<std::string> &groupIds);
bool filterMsgList(const RsTokReqOptionsVEG &opts, std::list<std::string> &msgIds);
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:
p3GxsDataService(uint16_t type, GxsDataProxy *proxy);
p3GxsDataServiceVEG(uint16_t type, GxsDataProxyVEG *proxy);
virtual bool fakeprocessrequests();
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;
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"
/****
* #define PHOTO_DEBUG 1
****/
RsPhoto *rsPhoto = NULL;
RsPhotoVEG *rsPhotoVEG = NULL;
/********************************************************************************/
/******************* Startup / Tick ******************************************/
/********************************************************************************/
p3PhotoService::p3PhotoService(uint16_t type)
:p3GxsDataService(type, new PhotoDataProxy()), mPhotoMtx("p3PhotoService"), mUpdated(true)
p3PhotoServiceVEG::p3PhotoServiceVEG(uint16_t type)
:p3GxsDataServiceVEG(type, new PhotoDataProxy()), mPhotoMtx("p3PhotoService"), mUpdated(true)
{
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;
fakeprocessrequests();
@ -57,7 +57,7 @@ int p3PhotoService::tick()
return 0;
}
bool p3PhotoService::updated()
bool p3PhotoServiceVEG::updated()
{
RsStackMutex stack(mPhotoMtx); /********** STACK LOCKED MTX ******/
@ -71,35 +71,35 @@ bool p3PhotoService::updated()
/* 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);
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);
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);
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);
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);
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);
return true;
}
/* 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 reqtype;
@ -109,19 +109,19 @@ bool p3PhotoService::getGroupList( const uint32_t &token, std::list<std:
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -144,19 +144,19 @@ bool p3PhotoService::getMsgList( const uint32_t &token, std::list<std:
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;
}
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;
}
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;
}
@ -168,7 +168,7 @@ bool p3PhotoService::getMsgList( const uint32_t &token, std::list<std:
/* 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 reqtype;
@ -178,19 +178,19 @@ bool p3PhotoService::getGroupSummary( const uint32_t &token, std::list<RsGr
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;
}
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;
}
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;
}
@ -204,7 +204,7 @@ bool p3PhotoService::getGroupSummary( const uint32_t &token, std::list<RsGr
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 reqtype;
@ -214,19 +214,19 @@ bool p3PhotoService::getMsgSummary( const uint32_t &token, std::list<RsMs
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;
}
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;
}
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;
}
@ -242,9 +242,9 @@ bool p3PhotoService::getMsgSummary( const uint32_t &token, std::list<RsMs
/* 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;
uint32_t status;
@ -256,19 +256,19 @@ bool p3PhotoService::getAlbum(const uint32_t &token, RsPhotoAlbum &album)
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;
}
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;
}
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;
}
@ -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;
uint32_t status;
@ -300,19 +300,19 @@ bool p3PhotoService::getPhoto(const uint32_t &token, RsPhotoPhoto &photo)
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;
}
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;
}
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;
}
@ -332,7 +332,7 @@ bool p3PhotoService::getPhoto(const uint32_t &token, RsPhotoPhoto &photo)
/* Poll */
uint32_t p3PhotoService::requestStatus(const uint32_t token)
uint32_t p3PhotoServiceVEG::requestStatus(const uint32_t token)
{
uint32_t status;
uint32_t reqtype;
@ -345,44 +345,44 @@ uint32_t p3PhotoService::requestStatus(const uint32_t token)
/* Cancel Request */
bool p3PhotoService::cancelRequest(const uint32_t &token)
bool p3PhotoServiceVEG::cancelRequest(const uint32_t &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);
}
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);
}
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);
}
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);
}
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);
}
bool p3PhotoService::groupRestoreKeys(const std::string &groupId)
bool p3PhotoServiceVEG::groupRestoreKeys(const std::string &groupId)
{
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;
}
@ -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 */
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 */
@ -406,7 +406,7 @@ bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bo
// TODO.
//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;
}
@ -424,22 +424,22 @@ bool p3PhotoService::submitAlbumDetails(uint32_t &token, RsPhotoAlbum &album, bo
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(album.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3PhotoService::submitAlbumDetails() Generating Request Token: " << token << std::endl;
std::cerr << "p3PhotoServiceVEG::submitAlbumDetails() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
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())
{
/* new photo */
std::cerr << "p3PhotoService::submitPhoto() Missing GroupID: ERROR";
std::cerr << "p3PhotoServiceVEG::submitPhoto() Missing GroupID: ERROR";
std::cerr << std::endl;
return false;
}
@ -452,18 +452,18 @@ bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNe
{
/* new (Original Msg) photo */
photo.mMeta.mOrigMsgId = photo.mMeta.mMsgId;
std::cerr << "p3PhotoService::submitPhoto() New Msg";
std::cerr << "p3PhotoServiceVEG::submitPhoto() New Msg";
std::cerr << std::endl;
}
else
{
std::cerr << "p3PhotoService::submitPhoto() Updated Msg";
std::cerr << "p3PhotoServiceVEG::submitPhoto() Updated Msg";
std::cerr << std::endl;
}
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 << std::endl;
@ -477,11 +477,11 @@ bool p3PhotoService::submitPhoto(uint32_t &token, RsPhotoPhoto &photo, bool isNe
// Fake a request to return the MsgMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(photo.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3PhotoService::submitPhoto() Generating Request Token: " << token << std::endl;
std::cerr << "p3PhotoServiceVEG::submitPhoto() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
@ -600,7 +600,7 @@ bool PhotoDataProxy::convertMsgToMetaData(void *msgData, RsMsgMetaData &meta)
/********************************************************************************************/
std::string p3PhotoService::genRandomId()
std::string p3PhotoServiceVEG::genRandomId()
{
std::string randomId;
for(int i = 0; i < 20; i++)

View file

@ -23,11 +23,11 @@
*
*/
#ifndef P3_PHOTO_SERVICE_HEADER
#define P3_PHOTO_SERVICE_HEADER
#ifndef P3_PHOTO_SERVICE_VEG_HEADER
#define P3_PHOTO_SERVICE_VEG_HEADER
#include "services/p3gxsservice.h"
#include "retroshare/rsphoto.h"
#include "services/p3gxsserviceVEG.h"
#include "retroshare/rsphotoVEG.h"
#include <map>
#include <string>
@ -48,7 +48,7 @@
*/
class PhotoDataProxy: public GxsDataProxy
class PhotoDataProxy: public GxsDataProxyVEG
{
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:
p3PhotoService(uint16_t type);
p3PhotoServiceVEG(uint16_t type);
virtual int tick();
@ -83,9 +83,9 @@ virtual int tick();
virtual bool updated();
/* Data Requests */
virtual bool requestGroupInfo( 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 RsTokReqOptions &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 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);

View file

@ -23,11 +23,11 @@
*
*/
#ifndef P3_POSTED_SERVICE_HEADER
#define P3_POSTED_SERVICE_HEADER
#ifndef P3_POSTED_SERVICE_VEG_HEADER
#define P3_POSTED_SERVICE_VEG_HEADER
#include "services/p3gxsservice.h"
#include "retroshare/rsposted.h"
#include "services/p3gxsserviceVEG.h"
#include "retroshare/rspostedVEG.h"
#include <map>
#include <string>
@ -38,7 +38,7 @@
*/
class PostedDataProxy: public GxsDataProxy
class PostedDataProxy: public GxsDataProxyVEG
{
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:
p3PostedService(uint16_t type);
p3PostedServiceVEG(uint16_t type);
virtual int tick();
@ -76,9 +76,9 @@ virtual int tick();
virtual bool updated();
/* Data Requests */
virtual bool requestGroupInfo( 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 RsTokReqOptions &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 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);

View file

@ -23,7 +23,7 @@
*
*/
#include "services/p3wikiservice.h"
#include "services/p3wikiserviceVEG.h"
#include "util/rsrandom.h"
@ -31,15 +31,15 @@
* #define WIKI_DEBUG 1
****/
RsWiki *rsWiki = NULL;
RsWikiVEG *rsWikiVEG = NULL;
/********************************************************************************/
/******************* Startup / Tick ******************************************/
/********************************************************************************/
p3WikiService::p3WikiService(uint16_t type)
:p3GxsDataService(type, new WikiDataProxy()), mWikiMtx("p3WikiService"), mUpdated(true)
p3WikiServiceVEG::p3WikiServiceVEG(uint16_t type)
:p3GxsDataServiceVEG(type, new WikiDataProxy()), mWikiMtx("p3WikiService"), mUpdated(true)
{
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;
fakeprocessrequests();
@ -58,7 +58,7 @@ int p3WikiService::tick()
return 0;
}
bool p3WikiService::updated()
bool p3WikiServiceVEG::updated()
{
RsStackMutex stack(mWikiMtx); /********** STACK LOCKED MTX ******/
@ -73,35 +73,35 @@ bool p3WikiService::updated()
/* 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);
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);
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);
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);
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);
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);
return true;
}
/* 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 reqtype;
@ -111,19 +111,19 @@ bool p3WikiService::getGroupList( const uint32_t &token, std::list<std::
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -146,19 +146,19 @@ bool p3WikiService::getMsgList( const uint32_t &token, std::list<std::
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;
}
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;
}
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;
}
@ -170,7 +170,7 @@ bool p3WikiService::getMsgList( const uint32_t &token, std::list<std::
/* 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 reqtype;
@ -180,19 +180,19 @@ bool p3WikiService::getGroupSummary( const uint32_t &token, std::list<RsGro
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;
}
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;
}
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;
}
@ -206,7 +206,7 @@ bool p3WikiService::getGroupSummary( const uint32_t &token, std::list<RsGro
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 reqtype;
@ -216,19 +216,19 @@ bool p3WikiService::getMsgSummary( const uint32_t &token, std::list<RsMsg
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;
}
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;
}
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;
}
@ -244,7 +244,7 @@ bool p3WikiService::getMsgSummary( const uint32_t &token, std::list<RsMsg
/* 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 reqtype;
@ -255,19 +255,19 @@ bool p3WikiService::getGroupData(const uint32_t &token, RsWikiGroup &group)
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -296,19 +296,19 @@ bool p3WikiService::getMsgData(const uint32_t &token, RsWikiPage &page)
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;
}
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;
}
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;
}
@ -328,7 +328,7 @@ bool p3WikiService::getMsgData(const uint32_t &token, RsWikiPage &page)
/* Poll */
uint32_t p3WikiService::requestStatus(const uint32_t token)
uint32_t p3WikiServiceVEG::requestStatus(const uint32_t token)
{
uint32_t status;
uint32_t reqtype;
@ -341,45 +341,45 @@ uint32_t p3WikiService::requestStatus(const uint32_t token)
/* Cancel Request */
bool p3WikiService::cancelRequest(const uint32_t &token)
bool p3WikiServiceVEG::cancelRequest(const uint32_t &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);
}
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);
}
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);
}
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);
}
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);
}
bool p3WikiService::groupRestoreKeys(const std::string &groupId)
bool p3WikiServiceVEG::groupRestoreKeys(const std::string &groupId)
{
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;
}
@ -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;
for(int i = 0; i < 20; i++)
@ -399,7 +399,7 @@ std::string p3WikiService::genRandomId()
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())
{
@ -410,7 +410,7 @@ bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
}
else
{
std::cerr << "p3WikiService::createGroup() Group with existing Id... dropping";
std::cerr << "p3WikiServiceVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl;
return false;
}
@ -425,11 +425,11 @@ bool p3WikiService::createGroup(uint32_t &token, RsWikiGroup &group, bool isNew)
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds;
groupIds.push_back(group.mMeta.mGroupId); // It will just return this one.
std::cerr << "p3WikiService::createGroup() Generating Request Token: " << token << std::endl;
std::cerr << "p3WikiServiceVEG::createGroup() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_GROUPS, groupIds);
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())
{
/* new photo */
std::cerr << "p3WikiService::createPage() Missing PageID";
std::cerr << "p3WikiServiceVEG::createPage() Missing PageID";
std::cerr << std::endl;
return false;
}
@ -450,7 +450,7 @@ bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
/* check if its a mod or new page */
if (page.mMeta.mOrigMsgId.empty())
{
std::cerr << "p3WikiService::createPage() New Page";
std::cerr << "p3WikiServiceVEG::createPage() New Page";
std::cerr << std::endl;
/* new page, generate a new OrigPageId */
@ -459,18 +459,18 @@ bool p3WikiService::createPage(uint32_t &token, RsWikiPage &page, bool isNew)
}
else
{
std::cerr << "p3WikiService::createPage() Modified Page";
std::cerr << "p3WikiServiceVEG::createPage() Modified Page";
std::cerr << std::endl;
/* mod page, keep orig page id, generate a new PageId */
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 << "p3WikiService::createPage() PageId: " << page.mMeta.mMsgId;
std::cerr << "p3WikiServiceVEG::createPage() PageId: " << page.mMeta.mMsgId;
std::cerr << std::endl;
std::cerr << "p3WikiService::createPage() OrigPageId: " << page.mMeta.mOrigMsgId;
std::cerr << "p3WikiServiceVEG::createPage() OrigPageId: " << page.mMeta.mOrigMsgId;
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.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(page.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3WikiService::createPage() Generating Request Token: " << token << std::endl;
std::cerr << "p3WikiServiceVEG::createPage() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;

View file

@ -26,8 +26,8 @@
#ifndef P3_WIKI_SERVICE_HEADER
#define P3_WIKI_SERVICE_HEADER
#include "services/p3gxsservice.h"
#include "retroshare/rswiki.h"
#include "services/p3gxsserviceVEG.h"
#include "retroshare/rswikiVEG.h"
#include <map>
#include <string>
@ -47,7 +47,7 @@
*
*/
class WikiDataProxy: public GxsDataProxy
class WikiDataProxy: public GxsDataProxyVEG
{
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:
p3WikiService(uint16_t type);
p3WikiServiceVEG(uint16_t type);
virtual int tick();
@ -77,9 +77,9 @@ virtual int tick();
virtual bool updated();
/* Data Requests */
virtual bool requestGroupInfo( 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 RsTokReqOptions &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 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);

View file

@ -23,7 +23,7 @@
*
*/
#include "services/p3wire.h"
#include "services/p3wireVEG.h"
#include "util/rsrandom.h"
@ -31,15 +31,15 @@
* #define WIKI_DEBUG 1
****/
RsWire *rsWire = NULL;
RsWireVEG *rsWireVEG = NULL;
/********************************************************************************/
/******************* Startup / Tick ******************************************/
/********************************************************************************/
p3Wire::p3Wire(uint16_t type)
:p3GxsDataService(type, new WireDataProxy()), mWireMtx("p3Wire"), mUpdated(true)
p3WireVEG::p3WireVEG(uint16_t type)
:p3GxsDataServiceVEG(type, new WireDataProxy()), mWireMtx("p3Wire"), mUpdated(true)
{
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;
fakeprocessrequests();
@ -58,7 +58,7 @@ int p3Wire::tick()
return 0;
}
bool p3Wire::updated()
bool p3WireVEG::updated()
{
RsStackMutex stack(mWireMtx); /********** STACK LOCKED MTX ******/
@ -73,35 +73,35 @@ bool p3Wire::updated()
/* 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);
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);
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);
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);
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);
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);
return true;
}
/* 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 reqtype;
@ -111,19 +111,19 @@ bool p3Wire::getGroupList( const uint32_t &token, std::list<std::string>
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -146,19 +146,19 @@ bool p3Wire::getMsgList( const uint32_t &token, std::list<std::string>
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;
}
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;
}
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;
}
@ -170,7 +170,7 @@ bool p3Wire::getMsgList( const uint32_t &token, std::list<std::string>
/* 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 reqtype;
@ -180,19 +180,19 @@ bool p3Wire::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaD
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;
}
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;
}
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;
}
@ -206,7 +206,7 @@ bool p3Wire::getGroupSummary( const uint32_t &token, std::list<RsGroupMetaD
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 reqtype;
@ -216,19 +216,19 @@ bool p3Wire::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaDat
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;
}
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;
}
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;
}
@ -244,7 +244,7 @@ bool p3Wire::getMsgSummary( const uint32_t &token, std::list<RsMsgMetaDat
/* 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 reqtype;
@ -255,19 +255,19 @@ bool p3Wire::getGroupData(const uint32_t &token, RsWireGroup &group)
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;
}
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;
}
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;
}
@ -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 reqtype;
@ -296,19 +296,19 @@ bool p3Wire::getMsgData(const uint32_t &token, RsWirePulse &pulse)
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;
}
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;
}
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;
}
@ -328,7 +328,7 @@ bool p3Wire::getMsgData(const uint32_t &token, RsWirePulse &pulse)
/* Poll */
uint32_t p3Wire::requestStatus(const uint32_t token)
uint32_t p3WireVEG::requestStatus(const uint32_t token)
{
uint32_t status;
uint32_t reqtype;
@ -341,46 +341,46 @@ uint32_t p3Wire::requestStatus(const uint32_t token)
/* Cancel Request */
bool p3Wire::cancelRequest(const uint32_t &token)
bool p3WireVEG::cancelRequest(const uint32_t &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);
}
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);
}
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);
}
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);
}
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);
}
bool p3Wire::groupRestoreKeys(const std::string &groupId)
bool p3WireVEG::groupRestoreKeys(const std::string &groupId)
{
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;
}
@ -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;
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())
{
@ -412,7 +412,7 @@ bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
}
else
{
std::cerr << "p3Wire::createGroup() Group with existing Id... dropping";
std::cerr << "p3WireVEG::createGroup() Group with existing Id... dropping";
std::cerr << std::endl;
return false;
}
@ -427,7 +427,7 @@ bool p3Wire::createGroup(uint32_t &token, RsWireGroup &group, bool isNew)
// Fake a request to return the GroupMetaData.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> groupIds;
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())
{
/* new photo */
std::cerr << "p3Wire::createPulse() Missing PulseID";
std::cerr << "p3WireVEG::createPulse() Missing PulseID";
std::cerr << std::endl;
return false;
}
@ -453,7 +453,7 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
/* check if its a mod or new pulse */
if (pulse.mMeta.mOrigMsgId.empty())
{
std::cerr << "p3Wire::createPulse() New Pulse";
std::cerr << "p3WireVEG::createPulse() New Pulse";
std::cerr << std::endl;
/* new pulse, generate a new OrigPulseId */
@ -462,18 +462,18 @@ bool p3Wire::createPulse(uint32_t &token, RsWirePulse &pulse, bool isNew)
}
else
{
std::cerr << "p3Wire::createPulse() Modified Pulse";
std::cerr << "p3WireVEG::createPulse() Modified Pulse";
std::cerr << std::endl;
/* mod pulse, keep orig pulse id, generate a new PulseId */
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 << "p3Wire::createPulse() PulseId: " << pulse.mMeta.mMsgId;
std::cerr << "p3WireVEG::createPulse() PulseId: " << pulse.mMeta.mMsgId;
std::cerr << std::endl;
std::cerr << "p3Wire::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId;
std::cerr << "p3WireVEG::createPulse() OrigPulseId: " << pulse.mMeta.mOrigMsgId;
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.
generateToken(token);
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptions opts; // NULL is good.
RsTokReqOptionsVEG opts; // NULL is good.
std::list<std::string> msgIds;
msgIds.push_back(pulse.mMeta.mMsgId); // It will just return this one.
std::cerr << "p3Wire::createPulse() Generating Request Token: " << token << std::endl;
std::cerr << "p3WireVEG::createPulse() Generating Request Token: " << token << std::endl;
storeRequest(token, ansType, opts, GXS_REQUEST_TYPE_MSGRELATED, msgIds);
return true;
@ -607,7 +607,7 @@ bool WireDataProxy::convertMsgToMetaData(void *msgData, RsMsgMetaData &meta)
#if 0
bool p3Wire::generateDummyData()
bool p3WireVEG::generateDummyData()
{
#define MAX_GROUPS 100
#define MAX_POSTS 1000

View file

@ -23,12 +23,12 @@
*
*/
#ifndef P3_WIRE_SERVICE_HEADER
#define P3_WIRE_SERVICE_HEADER
#ifndef P3_WIRE_SERVICE_VEG_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 <string>
@ -37,7 +37,7 @@
* Wire Service
*
*/
class WireDataProxy: public GxsDataProxy
class WireDataProxy: public GxsDataProxyVEG
{
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:
p3Wire(uint16_t type);
p3WireVEG(uint16_t type);
virtual int tick();
@ -67,9 +67,9 @@ virtual int tick();
virtual bool updated();
/* Data Requests */
virtual bool requestGroupInfo( 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 RsTokReqOptions &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 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);