added photo comment serialisation and addition

reimplemented getmsgrelatedinfo and getmsginfo as previous was incorrectly done, rstokenservice for msgs buggy now
updated test, commiting to transfer work to windows

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5576 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-09-20 17:18:26 +00:00
parent 33d001898f
commit 2e3e5b4ee4
12 changed files with 689 additions and 129 deletions

View File

@ -807,9 +807,9 @@ void RsDataService::retrieveMessages(RetroCursor *c, std::vector<RsNxsMsg *> &ms
return;
}
int RsDataService::retrieveGxsMsgMetaData(GxsMsgReq& reqIds, GxsMsgMetaResult &msgMeta)
int RsDataService::retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaResult &msgMeta)
{
GxsMsgReq::iterator mit = reqIds.begin();
GxsMsgReq::const_iterator mit = reqIds.begin();
for(; mit != reqIds.end(); mit++)
{

View File

@ -70,7 +70,7 @@ public:
* @param cache whether to store retrieval in mem for faster later retrieval
* @return error code
*/
int retrieveGxsMsgMetaData(GxsMsgReq& reqIds, GxsMsgMetaResult& msgMeta);
int retrieveGxsMsgMetaData(const GxsMsgReq& reqIds, GxsMsgMetaResult& msgMeta);
/*!
* remove msgs in data store

View File

@ -151,7 +151,7 @@ public:
* @param cache whether to store retrieval in mem for faster later retrieval
* @return error code
*/
virtual int retrieveGxsMsgMetaData(GxsMsgReq& msgIds, GxsMsgMetaResult& msgMeta) = 0;
virtual int retrieveGxsMsgMetaData(const GxsMsgReq& msgIds, GxsMsgMetaResult& msgMeta) = 0;
/*!
* remove msgs in data store listed in msgIds param

View File

@ -270,11 +270,11 @@ bool RsGxsDataAccess::requestMsgInfo(uint32_t &token, uint32_t ansType,
}
bool RsGxsDataAccess::requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts,
const GxsMsgReq& msgIds)
const RsGxsGrpMsgIdPair &msgIds)
{
MsgRelatedInfoReq* req = new MsgRelatedInfoReq();
req->mMsgIds = msgIds;
req->mMsgId = msgIds;
generateToken(token);
@ -723,7 +723,13 @@ bool RsGxsDataAccess::getGroupList(GroupIdReq* req)
bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
{
GxsMsgResult result;
mDataStore->retrieveNxsMsgs(req->mMsgIds, result, true, true);
GxsMsgReq msgIdOut;
// filter based on options
getMsgList(req->mMsgIds, req->Options, msgIdOut);
mDataStore->retrieveNxsMsgs(msgIdOut, result, true, true);
req->mMsgData = result;
return true;
@ -733,22 +739,24 @@ bool RsGxsDataAccess::getMsgData(MsgDataReq* req)
bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
{
GxsMsgMetaResult result;
mDataStore->retrieveGxsMsgMetaData(req->mMsgIds, result);
GxsMsgReq msgIdOut;
// filter based on options
getMsgList(req->mMsgIds, req->Options, msgIdOut);
mDataStore->retrieveGxsMsgMetaData(msgIdOut, result);
req->mMsgMetaData = result;
return true;
}
bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq msgIdsOut)
{
GxsMsgMetaResult result;
const RsTokReqOptionsV2& opts = req->Options;
mDataStore->retrieveGxsMsgMetaData(req->mMsgIds, result);
mDataStore->retrieveGxsMsgMetaData(msgIds, result);
/* CASEs this handles.
* Input is groupList + Flags.
@ -798,7 +806,6 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
{
std::vector<RsGxsMsgMetaData*>::const_iterator vit = metaV.begin();
// RUN THROUGH ALL MSGS... in map origId -> TS.
std::map<RsGxsGroupId, std::pair<RsGxsMessageId, time_t> > origMsgTs;
std::map<RsGxsGroupId, std::pair<RsGxsMessageId, time_t> >::iterator oit;
@ -851,7 +858,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
// Add the discovered Latest Msgs.
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); oit++)
{
req->mMsgIdResult[grpId].push_back(oit->second.first);
msgIdsOut[grpId].push_back(oit->second.first);
}
}
@ -888,7 +895,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
if (add)
{
req->mMsgIdResult[grpId].push_back(msgMeta->mMsgId);
msgIdsOut[grpId].push_back(msgMeta->mMsgId);
metaFilter[grpId].insert(std::make_pair(msgMeta->mMsgId, msgMeta));
}
@ -896,7 +903,7 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
}
}
filterMsgList(req->mMsgIdResult, opts, metaFilter);
filterMsgList(msgIdsOut, opts, metaFilter);
metaFilter.clear();
@ -906,12 +913,263 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq* req)
return true;
}
bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
{
/* CASEs this handles.
* Input is msgList + Flags.
* 1) No Flags => return nothing
*/
std::cerr << "RsGxsDataAccess::getMsgRelatedList()";
std::cerr << std::endl;
const RsTokReqOptionsV2& opts = req->Options;
bool onlyLatestMsgs = false;
bool onlyAllVersions = false;
bool onlyChildMsgs = false;
bool onlyThreadMsgs = false;
if (opts.mOptions & RS_TOKREQOPT_MSG_LATEST)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_LATEST";
std::cerr << std::endl;
onlyLatestMsgs = true;
}
else if (opts.mOptions & RS_TOKREQOPT_MSG_VERSIONS)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_VERSIONS";
std::cerr << std::endl;
onlyAllVersions = true;
}
if (opts.mOptions & RS_TOKREQOPT_MSG_PARENT)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_PARENTS";
std::cerr << std::endl;
onlyChildMsgs = true;
}
if (opts.mOptions & RS_TOKREQOPT_MSG_THREAD)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() MSG_THREAD";
std::cerr << std::endl;
onlyThreadMsgs = true;
}
if (onlyAllVersions && onlyChildMsgs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & PARENT)";
std::cerr << std::endl;
return false;
}
if (onlyAllVersions && onlyThreadMsgs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (VERSIONS & THREAD)";
std::cerr << std::endl;
return false;
}
if ((!onlyLatestMsgs) && onlyChildMsgs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & PARENT)";
std::cerr << std::endl;
return false;
}
if ((!onlyLatestMsgs) && onlyThreadMsgs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (!LATEST & THREAD)";
std::cerr << std::endl;
return false;
}
if (onlyChildMsgs && onlyThreadMsgs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() ERROR Incompatible FLAGS (PARENT & THREAD)";
std::cerr << std::endl;
return false;
}
/* FALL BACK OPTION */
if ((!onlyLatestMsgs) && (!onlyAllVersions) && (!onlyChildMsgs) && (!onlyThreadMsgs))
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() FALLBACK -> NO FLAGS -> SIMPLY RETURN nothing";
std::cerr << std::endl;
return true;
}
MsgMetaFilter filterMap;
RsStackMutex stack(mDataMutex); /***** LOCKED *****/
// get meta data for all in group
GxsMsgMetaResult result;
GxsMsgReq msgIds;
msgIds.insert(std::make_pair(req->mMsgId.first, std::vector<RsGxsMessageId>()));
mDataStore->retrieveGxsMsgMetaData(msgIds, result);
std::vector<RsGxsMsgMetaData*>& metaV = result[req->mMsgId.first];
std::vector<RsGxsMsgMetaData*>::iterator vit_meta;
// msg id to relate to
const RsGxsMessageId& msgId = req->mMsgId.second;
const RsGxsGroupId& grpId = req->mMsgId.first;
std::vector<RsGxsMessageId> outMsgIds;
RsGxsMsgMetaData* origMeta = NULL;
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); vit_meta++)
{
RsGxsMsgMetaData* meta = *vit_meta;
if(msgId == meta->mMsgId)
{
origMeta = meta;
break;
}
}
if(!origMeta)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedInfo(): Cannot find meta of msgId (to relate to)!"
<< std::endl;
cleanseMsgMetaMap(result);
return false;
}
const RsGxsMessageId& origMsgId = origMeta->mOrigMsgId;
std::map<RsGxsMessageId, RsGxsMsgMetaData*>& metaMap = filterMap[grpId];
if (onlyLatestMsgs)
{
if (onlyChildMsgs || onlyThreadMsgs)
{
// RUN THROUGH ALL MSGS... in map origId -> TS.
std::map<std::string, std::pair<std::string, time_t> > origMsgTs;
std::map<std::string, std::pair<std::string, time_t> >::iterator oit;
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); vit_meta++)
{
RsGxsMsgMetaData* meta = *vit_meta;
// skip msgs that aren't children.
if (onlyChildMsgs)
{
if (meta->mParentId != origMsgId)
{
continue;
}
}
else /* onlyThreadMsgs */
{
if (meta->mThreadId != msgId)
{
continue;
}
}
oit = origMsgTs.find(meta->mOrigMsgId);
bool addMsg = false;
if (oit == origMsgTs.end())
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() Found New OrigMsgId: ";
std::cerr << meta->mOrigMsgId;
std::cerr << " MsgId: " << meta->mMsgId;
std::cerr << " TS: " << meta->mPublishTs;
std::cerr << std::endl;
addMsg = true;
}
// check timestamps.
else if (oit->second.second < meta->mPublishTs)
{
std::cerr << "RsGxsDataAccess::getMsgRelatedList() Found Later Msg. OrigMsgId: ";
std::cerr << meta->mOrigMsgId;
std::cerr << " MsgId: " << meta->mMsgId;
std::cerr << " TS: " << meta->mPublishTs;
addMsg = true;
}
if (addMsg)
{
// add as latest. (overwriting if necessary)
origMsgTs[meta->mOrigMsgId] = std::make_pair(meta->mMsgId, meta->mPublishTs);
metaMap.insert(std::make_pair(meta->mOrigMsgId, meta));
}
}
// Add the discovered Latest Msgs.
for(oit = origMsgTs.begin(); oit != origMsgTs.end(); oit++)
{
outMsgIds.push_back(oit->second.first);
}
}
else
{
/* first guess is potentially better than Orig (can't be worse!) */
time_t latestTs = 0;
RsGxsMessageId latestMsgId;
RsGxsMsgMetaData* latestMeta;
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); vit_meta++)
{
RsGxsMsgMetaData* meta = *vit_meta;
if (meta->mOrigMsgId == origMsgId)
{
if (meta->mPublishTs > latestTs)
{
latestTs = meta->mPublishTs;
latestMsgId = meta->mMsgId;
latestMeta = meta;
}
}
}
outMsgIds.push_back(latestMsgId);
metaMap.insert(std::make_pair(latestMsgId, latestMeta));
}
}
else if (onlyAllVersions)
{
for(vit_meta = metaV.begin(); vit_meta != metaV.end(); vit_meta++)
{
RsGxsMsgMetaData* meta = *vit_meta;
if (meta->mOrigMsgId == origMsgId)
{
outMsgIds.push_back(meta->mMsgId);
metaMap.insert(std::make_pair(meta->mOrigMsgId, meta));
}
}
}
req->mMsgIdResult[grpId] = outMsgIds;
filterMsgList(req->mMsgIdResult, opts, filterMap);
cleanseMsgMetaMap(result);
return true;
}
bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
{
GxsMsgMetaResult result;
mDataStore->retrieveGxsMsgMetaData(req->mMsgIds, result);
@ -931,6 +1189,13 @@ bool RsGxsDataAccess::getMsgList(MsgIdReq* req)
delete meta; // discard meta data mem
}
}
GxsMsgReq msgIdOut;
// filter based on options
getMsgList(req->mMsgIdResult, req->Options, msgIdOut);
req->mMsgIdResult = msgIdOut;
return true;
}
@ -1141,5 +1406,33 @@ bool RsGxsDataAccess::checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsM
// no status comparision,
statusMatch = true;
}
return statusMatch;
bool flagMatch = false;
if(opts.mMsgFlagMask)
{
// Exact Flags match required.
if ((opts.mMsgFlagMask & opts.mMsgFlagFilter) == (opts.mMsgFlagMask & meta->mMsgFlags))
{
std::cerr << "checkMsgFilter() Accepting Msg as FlagMatches: ";
std::cerr << " Mask: " << opts.mMsgFlagMask << " FlagFilter: " << opts.mMsgFlagFilter;
std::cerr << " MsgFlag: " << meta->mMsgFlags << " MsgId: " << meta->mMsgId;
std::cerr << std::endl;
flagMatch = true;
}
else
{
std::cerr << "checkMsgFilter() Dropping Msg due to !FlagMatch ";
std::cerr << " Mask: " << opts.mMsgFlagMask << " FlagFilter: " << opts.mMsgFlagFilter;
std::cerr << " MsgFlag: " << meta->mMsgFlags << " MsgId: " << meta->mMsgId;
std::cerr << std::endl;
flagMatch = false;
}
}else{
flagMatch = true;
}
return statusMatch && flagMatch;
}

View File

@ -90,7 +90,7 @@ public:
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
* @return true if request successful false otherwise
*/
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds);
bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair &msgIds);
/* Poll */
uint32_t requestStatus(const uint32_t token);
@ -343,6 +343,15 @@ private:
*/
bool checkMsgFilter(const RsTokReqOptionsV2& opts, const RsGxsMsgMetaData* meta) const;
/*!
* This is a filter method which applies the request options to the list of ids
* requested
* @param msgIds the msg ids for filter to be applied to
* @param opts the options used to parameterise the id filter
* @param msgIdsOut the left overs ids after filter is applied to msgIds
*/
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq msgIdsOut);
private:
RsGeneralDataService* mDataStore;

View File

@ -99,7 +99,7 @@ class MsgRelatedInfoReq : public GxsRequest
{
public:
GxsMsgReq mMsgIds;
RsGxsGrpMsgIdPair mMsgId;
GxsMsgIdResult mMsgIdResult;
};

View File

@ -168,7 +168,7 @@ public:
* @param groupIds The ids of the groups to get, second entry of map empty to query for all msgs
* @return true if request successful false otherwise
*/
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const GxsMsgReq& msgIds) = 0;
virtual bool requestMsgRelatedInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptionsV2 &opts, const RsGxsGrpMsgIdPair& msgIds) = 0;
/* Poll */

View File

@ -23,10 +23,11 @@
*
*/
#include <iostream>
#include "rsphotov2items.h"
#include "serialiser/rstlvbase.h"
#include <iostream>
#include "serialiser/rsbaseserial.h"
#define GXS_PHOTO_SERIAL_DEBUG
@ -35,6 +36,7 @@ uint32_t RsGxsPhotoSerialiser::size(RsItem* item)
{
RsGxsPhotoPhotoItem* ppItem = NULL;
RsGxsPhotoAlbumItem* paItem = NULL;
RsGxsPhotoCommentItem* cItem = NULL;
if((ppItem = dynamic_cast<RsGxsPhotoPhotoItem*>(item)) != NULL)
{
@ -44,6 +46,10 @@ uint32_t RsGxsPhotoSerialiser::size(RsItem* item)
{
return sizeGxsPhotoAlbumItem(paItem);
}
else if((cItem = dynamic_cast<RsGxsPhotoCommentItem*>(item)) != NULL)
{
return sizeGxsPhotoCommentItem(cItem);
}
else
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -59,6 +65,7 @@ bool RsGxsPhotoSerialiser::serialise(RsItem* item, void* data, uint32_t* size)
RsGxsPhotoPhotoItem* ppItem = NULL;
RsGxsPhotoAlbumItem* paItem = NULL;
RsGxsPhotoCommentItem* cItem = NULL;
if((ppItem = dynamic_cast<RsGxsPhotoPhotoItem*>(item)) != NULL)
{
@ -67,6 +74,9 @@ bool RsGxsPhotoSerialiser::serialise(RsItem* item, void* data, uint32_t* size)
else if((paItem = dynamic_cast<RsGxsPhotoAlbumItem*>(item)) != NULL)
{
return serialiseGxsPhotoAlbumItem(paItem, data, size);
}else if((cItem = dynamic_cast<RsGxsPhotoCommentItem*>(item)) != NULL)
{
return serialiseGxsPhotoCommentItem(cItem, data, size);
}
else
{
@ -100,6 +110,8 @@ RsItem* RsGxsPhotoSerialiser::deserialise(void* data, uint32_t* size)
return deserialiseGxsPhotoPhotoItem(data, size);
case RS_PKT_SUBTYPE_PHOTO_ITEM:
return deserialiseGxsPhotoAlbumItem(data, size);
case RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM:
return deserialiseGxsPhotoCommentItem(data, size);
default:
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
@ -136,6 +148,19 @@ uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item)
return s;
}
uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoCommentItem(RsGxsPhotoCommentItem *item)
{
const RsPhotoComment& comment = item->comment;
uint32_t s = 8; // header
s += GetTlvStringSize(comment.mComment);
s += 4; // mflags
return s;
}
bool RsGxsPhotoSerialiser::serialiseGxsPhotoAlbumItem(RsGxsPhotoAlbumItem* item, void* data,
uint32_t* size)
{
@ -443,19 +468,123 @@ RsGxsPhotoPhotoItem* RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem(void* da
return item;
}
uint32_t RsGxsPhotoSerialiser::sizeGxsPhotoCommentItem(RsGxsPhotoCommentItem *item)
{
}
bool RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem (RsGxsPhotoCommentItem *item, void *data, uint32_t *size)
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem()" << std::endl;
#endif
uint32_t tlvsize = sizeGxsPhotoCommentItem(item);
uint32_t offset = 0;
if(*size < tlvsize){
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem()" << std::endl;
#endif
return false;
}
*size = tlvsize;
bool ok = true;
ok &= setRsItemHeader(data, tlvsize, item->PacketId(), tlvsize);
/* skip the header */
offset += 8;
/* GxsPhotoAlbumItem */
ok &= SetTlvString(data, tlvsize, &offset, 0, item->comment.mComment);
ok &= setRawUInt32(data, tlvsize, &offset, item->comment.mCommentFlag);
if(offset != tlvsize)
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem() FAIL Size Error! " << std::endl;
#endif
ok = false;
}
#ifdef GXS_PHOTO_SERIAL_DEBUG
if (!ok)
{
std::cerr << "RsGxsPhotoSerialiser::serialiseGxsPhotoCommentItem() NOK" << std::endl;
}
#endif
return ok;
}
RsGxsPhotoCommentItem * RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem(void *data, uint32_t *size)
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::deserialiseGxsPhotoPhotoItem()" << std::endl;
#endif
/* get the type and size */
uint32_t rstype = getRsItemId(data);
uint32_t rssize = getRsItemSize(data);
uint32_t offset = 0;
if ((RS_PKT_VERSION_SERVICE != getRsItemVersion(rstype)) ||
(RS_SERVICE_GXSV1_TYPE_PHOTO != getRsItemService(rstype)) ||
(RS_PKT_SUBTYPE_PHOTO_COMMENT_ITEM != getRsItemSubType(rstype)))
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem() FAIL wrong type" << std::endl;
#endif
return NULL; /* wrong type */
}
if (*size < rssize) /* check size */
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem() FAIL wrong size" << std::endl;
#endif
return NULL; /* not enough data */
}
/* set the packet length */
*size = rssize;
bool ok = true;
RsGxsPhotoCommentItem* item = new RsGxsPhotoCommentItem();
/* skip the header */
offset += 8;
ok &= GetTlvString(data, rssize, &offset, 1, item->comment.mComment);
ok &= getRawUInt32(data, rssize, &offset, &(item->comment.mCommentFlag));
if (offset != rssize)
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem() FAIL size mismatch" << std::endl;
#endif
/* error */
delete item;
return NULL;
}
if (!ok)
{
#ifdef GXS_PHOTO_SERIAL_DEBUG
std::cerr << "RsGxsPhotoSerialiser::deserialiseGxsPhotoCommentItem() NOK" << std::endl;
#endif
delete item;
return NULL;
}
return item;
}
void RsGxsPhotoAlbumItem::clear()
@ -474,12 +603,17 @@ void RsGxsPhotoAlbumItem::clear()
void RsGxsPhotoCommentItem::clear()
{
comment.mComment.clear();
comment.mCommentFlag = 0;
}
std::ostream& RsGxsPhotoCommentItem::print(std::ostream& out, uint16_t indent)
{
printRsItemBase(out, "RsGxsPhotoCommentItem", indent);
uint16_t int_Indent = indent + 2;
printRsItemEnd(out ,"RsGxsPhotoCommentItem", indent);
return out;
}
@ -488,6 +622,7 @@ std::ostream& RsGxsPhotoAlbumItem::print(std::ostream& out, uint16_t indent)
printRsItemBase(out, "RsGxsPhotoAlbumItem", indent);
uint16_t int_Indent = indent + 2;
out << album << std::endl;
printRsItemEnd(out ,"RsGxsPhotoAlbumItem", indent);
return out;

View File

@ -827,7 +827,7 @@ bool GenExchangeTester::testSpecificMsgMetaRetrieval()
return ok;
}
bool GenExchangeTester::testRelatedMsgIdRetrieval_Parents()
bool GenExchangeTester::testMsgIdRetrieval_OptParents()
{
// start up
setUp();
@ -884,7 +884,7 @@ bool GenExchangeTester::testRelatedMsgIdRetrieval_Parents()
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD;
mTokenService->requestMsgRelatedInfo(token, 0, opts, req);
mTokenService->requestMsgInfo(token, 0, opts, req);
pollForToken(token, opts);
@ -925,7 +925,7 @@ bool GenExchangeTester::testRelatedMsgIdRetrieval_Parents()
}
bool GenExchangeTester::testRelatedMsgIdRetrieval_OrigMsgId()
bool GenExchangeTester::testMsgIdRetrieval_OptOrigMsgId()
{
// start up
setUp();
@ -981,7 +981,7 @@ bool GenExchangeTester::testRelatedMsgIdRetrieval_OrigMsgId()
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mOptions = RS_TOKREQOPT_MSG_ORIGMSG;
mTokenService->requestMsgRelatedInfo(token, 0, opts, req);
mTokenService->requestMsgInfo(token, 0, opts, req);
pollForToken(token, opts);
@ -1022,7 +1022,7 @@ bool GenExchangeTester::testRelatedMsgIdRetrieval_OrigMsgId()
}
bool GenExchangeTester::testRelatedMsgIdRetrieval_Latest()
bool GenExchangeTester::testMsgIdRetrieval_OptLatest()
{
// testing for latest, create msg which are origMsgIds then
@ -1189,7 +1189,7 @@ bool GenExchangeTester::testRelatedMsgIdRetrieval_Latest()
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
mTokenService->requestMsgRelatedInfo(token, 0, opts, req);
mTokenService->requestMsgInfo(token, 0, opts, req);
pollForToken(token, opts);

View File

@ -27,9 +27,9 @@ public:
bool testMsgSubmissionRetrieval();
bool testMsgIdRetrieval();
bool testRelatedMsgIdRetrieval_Parents();
bool testRelatedMsgIdRetrieval_OrigMsgId();
bool testRelatedMsgIdRetrieval_Latest();
bool testMsgIdRetrieval_OptParents();
bool testMsgIdRetrieval_OptOrigMsgId();
bool testMsgIdRetrieval_OptLatest();
bool testSpecificMsgMetaRetrieval();
bool testGrpSubmissionRetrieval();

View File

@ -0,0 +1,123 @@
#-------------------------------------------------
#
# Project created by QtCreator 2012-05-06T09:19:26
#
#-------------------------------------------------
#
QT += core network
QT -= gui
CONFIG += gen_exchange_target #dstore_target
dstore_target {
TARGET = rs_dstore_test
}
gen_exchange_target {
TARGET = gen_exchange_test
}
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
CONFIG += debug
debug {
# DEFINES *= DEBUG
# DEFINES *= OPENDHT_DEBUG DHT_DEBUG CONN_DEBUG DEBUG_UDP_SORTER P3DISC_DEBUG DEBUG_UDP_LAYER FT_DEBUG EXTADDRSEARCH_DEBUG
# DEFINES *= CONTROL_DEBUG FT_DEBUG DEBUG_FTCHUNK P3TURTLE_DEBUG
# DEFINES *= P3TURTLE_DEBUG
# DEFINES *= NET_DEBUG
# DEFINES *= DISTRIB_DEBUG
# DEFINES *= P3TURTLE_DEBUG FT_DEBUG DEBUG_FTCHUNK MPLEX_DEBUG
# DEFINES *= STATUS_DEBUG SERV_DEBUG RSSERIAL_DEBUG #CONN_DEBUG
QMAKE_CXXFLAGS -= -O2 -fomit-frame-pointer
QMAKE_CXXFLAGS *= -g -fno-omit-frame-pointer
}
################################# Linux ##########################################
# Put lib dir in QMAKE_LFLAGS so it appears before -L/usr/lib
linux-* {
#CONFIG += version_detail_bash_script
QMAKE_CXXFLAGS *= -D_FILE_OFFSET_BITS=64
system(which gpgme-config >/dev/null 2>&1) {
INCLUDEPATH += $$system(gpgme-config --cflags | sed -e "s/-I//g")
} else {
message(Could not find gpgme-config on your system, assuming gpgme.h is in /usr/include)
}
PRE_TARGETDEPS *= ../../lib/libretroshare.a
LIBS += ../../lib/libretroshare.a
LIBS += ../../../../libbitdht/src/lib/libbitdht.a
LIBS += ../../../../openpgpsdk/src/lib/libops.a
LIBS += -lssl -lgpgme -lupnp -lixml -lgnome-keyring -lsqlite3 -lbz2
LIBS *= -rdynamic -frtti
DEFINES *= HAVE_XSS # for idle time, libx screensaver extensions
DEFINES *= UBUNTU
}
linux-g++ {
OBJECTS_DIR = temp/linux-g++/obj
}
linux-g++-64 {
OBJECTS_DIR = temp/linux-g++-64/obj
}
version_detail_bash_script {
DEFINES += ADD_LIBRETROSHARE_VERSION_INFO
QMAKE_EXTRA_TARGETS += write_version_detail
PRE_TARGETDEPS = write_version_detail
write_version_detail.commands = ./version_detail.sh
}
install_rs {
INSTALLS += binary_rs
binary_rs.path = $$(PREFIX)/usr/bin
binary_rs.files = ./RetroShare
}
dstore_target {
SOURCES += \
support.cc \
rsdataservice_test.cc \
data_support.cc
HEADERS += support.h \
rsdataservice_test.h \
data_support.h
}
gen_exchange_target {
SOURCES += \
support.cc \
genexchangetester.cpp \
genexchangetestservice.cpp \
rsdummyservices.cc \
rsgenexchange_test.cc
HEADERS += support.h \
rsdataservice_test.h \
rsdummyservices.h \
data_support.h
}
INCLUDEPATH += ../../

View File

@ -15,17 +15,17 @@ int main()
GenExchangeTester tester;
CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
CHECK(tester.testSpecificMsgMetaRetrieval()); REPORT("testSpecificMsgMetaRetrieval()");
CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
CHECK(tester.testRelatedMsgIdRetrieval_Parents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
CHECK(tester.testRelatedMsgIdRetrieval_OrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
CHECK(tester.testRelatedMsgIdRetrieval_Latest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
// CHECK(tester.testSpecificMsgMetaRetrieval()); REPORT("testSpecificMsgMetaRetrieval()");
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
// CHECK(tester.testMsgIdRetrieval_OptParents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
// CHECK(tester.testMsgIdRetrieval_OptOrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
// CHECK(tester.testMsgIdRetrieval_OptLatest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
// CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
CHECK(tester.testGrpIdRetrieval()); REPORT("tester.testGrpIdRetrieval()");
CHECK(tester.testGrpMetaModRequest()); REPORT("tester.testGrpMetaModRequest()");
// CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
// CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
// CHECK(tester.testGrpIdRetrieval()); REPORT("tester.testGrpIdRetrieval()");
// CHECK(tester.testGrpMetaModRequest()); REPORT("tester.testGrpMetaModRequest()");
FINALREPORT("RsGenExchangeTest");