mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-10 23:52:51 -04:00
Bug fix for ES_GXS_MSG_COMMENTS option
Fix for run thread loop of RsGenExchange (was using logic rather than isRunning, which led to some crashes on rs close Added request and get MsgRelated function for ids, meta and data added template function to ease getting meta data from back end; Updated Nxs tests, tests passed (failed initially because of change option requirements) Added test for msgrelated Ids, still need to add test for all msgRelated functions (bug with mask, not filtering correctly) Made changes for forum and wiki gui to use new API but gui needs to call correct get functions now (Bob). git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5817 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
8d556955c5
commit
f74a328d61
27 changed files with 872 additions and 310 deletions
|
@ -62,6 +62,13 @@ RsPhotoComment::RsPhotoComment()
|
|||
|
||||
}
|
||||
|
||||
RsPhotoComment::RsPhotoComment(const RsGxsPhotoCommentItem &comment)
|
||||
: mComment(""), mCommentFlag(0) {
|
||||
|
||||
*this = comment.comment;
|
||||
(*this).mMeta = comment.meta;
|
||||
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &out, const RsPhotoPhoto &photo)
|
||||
{
|
||||
out << "RsPhotoPhoto [ ";
|
||||
|
@ -247,39 +254,52 @@ bool p3PhotoServiceV2::getPhoto(const uint32_t& token, PhotoResult& photos)
|
|||
|
||||
bool p3PhotoServiceV2::getPhotoComment(const uint32_t &token, PhotoCommentResult &comments)
|
||||
{
|
||||
GxsMsgDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||
GxsMsgDataMap msgData;
|
||||
bool ok = RsGenExchange::getMsgData(token, msgData);
|
||||
|
||||
if(ok)
|
||||
if(ok)
|
||||
{
|
||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||
|
||||
for(; mit != msgData.end(); mit++)
|
||||
{
|
||||
GxsMsgDataMap::iterator mit = msgData.begin();
|
||||
RsGxsGroupId grpId = mit->first;
|
||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||
|
||||
for(; mit != msgData.end(); mit++)
|
||||
for(; vit != msgItems.end(); vit++)
|
||||
{
|
||||
RsGxsPhotoCommentItem* item = dynamic_cast<RsGxsPhotoCommentItem*>(*vit);
|
||||
|
||||
if(item)
|
||||
{
|
||||
RsGxsGroupId grpId = mit->first;
|
||||
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
|
||||
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
|
||||
|
||||
for(; vit != msgItems.end(); vit++)
|
||||
{
|
||||
RsGxsPhotoCommentItem* item = dynamic_cast<RsGxsPhotoCommentItem*>(*vit);
|
||||
|
||||
if(item)
|
||||
{
|
||||
RsPhotoComment comment = item->comment;
|
||||
comment.mMeta = item->meta;
|
||||
comments[grpId].push_back(comment);
|
||||
delete item;
|
||||
}else
|
||||
{
|
||||
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
||||
delete *vit;
|
||||
}
|
||||
}
|
||||
RsPhotoComment comment = item->comment;
|
||||
comment.mMeta = item->meta;
|
||||
comments[grpId].push_back(comment);
|
||||
delete item;
|
||||
}else
|
||||
{
|
||||
std::cerr << "Not a comment Item, deleting!" << std::endl;
|
||||
delete *vit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
RsPhotoComment& RsPhotoComment::operator=(const RsGxsPhotoCommentItem& comment)
|
||||
{
|
||||
*this = comment.comment;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool p3PhotoServiceV2::getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments)
|
||||
{
|
||||
|
||||
return RsGenExchange::getMsgRelatedDataT<RsGxsPhotoCommentItem, RsPhotoComment>(token, comments);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool p3PhotoServiceV2::submitAlbumDetails(uint32_t& token, RsPhotoAlbum& album)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "gxs/rsgenexchange.h"
|
||||
#include "retroshare/rsphotoV2.h"
|
||||
|
||||
|
||||
class p3PhotoServiceV2 : public RsPhotoV2, public RsGenExchange
|
||||
{
|
||||
public:
|
||||
|
@ -80,6 +79,7 @@ public:
|
|||
bool getAlbum(const uint32_t &token, std::vector<RsPhotoAlbum> &albums);
|
||||
bool getPhoto(const uint32_t &token, PhotoResult &photos);
|
||||
bool getPhotoComment(const uint32_t &token, PhotoCommentResult &comments);
|
||||
bool getPhotoRelatedComment(const uint32_t &token, PhotoRelatedCommentResult &comments);
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue