Removed references to postedVEG from GxsGroupDialog and associated classes and PostedDialog (GUI does not work now but does not crash)

Removed V2 references: TokenQueueV2 and RsTokReqOptionsV2 are now TokenQueue and RsTokReqOptions and renamed file
Added initialisation of Posted back end service successfully
Added new msg status flags  GXS_SERV::MSG_STATUS_UNPROCESSED and ::MSG_STATUS_UNREAD



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5707 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-10-21 19:45:35 +00:00
parent dcb64f6631
commit c518bd2f19
44 changed files with 2379 additions and 3761 deletions

View file

@ -1445,23 +1445,23 @@ bool p3GxsDataServiceVEG::fakeprocessrequests()
#if 0 // DISABLED AND MOVED TO GXS CODE.
std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
{
out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
return out;
}
//std::ostream &operator<<(std::ostream &out, const RsGroupMetaData &meta)
//{
// out << "[ GroupId: " << meta.mGroupId << " Name: " << meta.mGroupName << " ]";
// return out;
//}
std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
{
out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
out << " Name: " << meta.mMsgName;
out << " OrigMsgId: " << meta.mOrigMsgId;
out << " ThreadId: " << meta.mThreadId;
out << " ParentId: " << meta.mParentId;
out << " AuthorId: " << meta.mAuthorId;
out << " Name: " << meta.mMsgName << " ]";
return out;
}
//std::ostream &operator<<(std::ostream &out, const RsMsgMetaData &meta)
//{
// out << "[ GroupId: " << meta.mGroupId << " MsgId: " << meta.mMsgId;
// out << " Name: " << meta.mMsgName;
// out << " OrigMsgId: " << meta.mOrigMsgId;
// out << " ThreadId: " << meta.mThreadId;
// out << " ParentId: " << meta.mParentId;
// out << " AuthorId: " << meta.mAuthorId;
// out << " Name: " << meta.mMsgName << " ]";
// return out;
//}
#endif

View file

@ -499,7 +499,7 @@ bool p3IdService::cache_start_load()
}
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
RsTokReqOptionsV2 opts;
RsTokReqOptions opts;
uint32_t token = 0;
RsGenExchange::getTokenService()->requestGroupInfo(token, ansType, opts, groupIds);
@ -971,7 +971,7 @@ bool p3IdService::background_requestGroups()
}
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptionsV2 opts;
RsTokReqOptions opts;
std::list<std::string> groupIds;
/**
@ -1034,7 +1034,7 @@ bool p3IdService::background_requestNewMessages()
}
uint32_t ansType = RS_TOKREQ_ANSTYPE_SUMMARY;
RsTokReqOptionsV2 opts;
RsTokReqOptions opts;
token = 0;
/* TODO
@ -1319,7 +1319,7 @@ bool p3IdService::background_FullCalcRequest()
/* request the summary info from the parents */
uint32_t ansType = RS_TOKREQ_ANSTYPE_DATA;
uint32_t token = 0;
RsTokReqOptionsV2 opts;
RsTokReqOptions opts;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
RsGenExchange::getTokenService()->requestMsgInfo(token, ansType, opts, groupIds);

View file

@ -1,4 +1,11 @@
#include "p3posted.h"
#include "serialiser/rsposteditems.h"
const uint32_t RsPosted::FLAG_MSGTYPE_COMMENT = 0x0001;
const uint32_t RsPosted::FLAG_MSGTYPE_POST = 0x0002;
const uint32_t RsPosted::FLAG_MSGTYPE_VOTE = 0x0004;
RsPosted *rsPosted = NULL;
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
: RsGenExchange(gds, nes, NULL, RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this)
@ -10,39 +17,147 @@ void p3Posted::notifyChanges(std::vector<RsGxsNotify *> &changes)
receiveChanges(changes);
}
bool p3Posted::getGroup(const uint32_t &token, RsPostedGroup &group)
void p3Posted::service_tick()
{
}
bool p3Posted::getPost(const uint32_t &token, RsPostedPost &post)
bool p3Posted::getGroup(const uint32_t &token, std::vector<RsPostedGroup> &groups)
{
std::vector<RsGxsGrpItem*> grpData;
bool ok = RsGenExchange::getGroupData(token, grpData);
if(ok)
{
std::vector<RsGxsGrpItem*>::iterator vit = grpData.begin();
for(; vit != grpData.end(); vit++)
{
RsGxsPostedGroupItem* item = dynamic_cast<RsGxsPostedGroupItem*>(*vit);
RsPostedGroup grp = item->mGroup;
item->mGroup.mMeta = item->meta;
grp.mMeta = item->mGroup.mMeta;
delete item;
groups.push_back(grp);
}
}
return ok;
}
bool p3Posted::getComment(const uint32_t &token, RsPostedComment &comment)
bool p3Posted::getPost(const uint32_t &token, PostedPostResult &posts)
{
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
if(ok)
{
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); mit++)
{
RsGxsGroupId grpId = mit->first;
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); vit++)
{
RsGxsPostedPostItem* item = dynamic_cast<RsGxsPostedPostItem*>(*vit);
if(item)
{
RsPostedPost post = item->mPost;
post.mMeta = item->meta;
posts[grpId].push_back(post);
delete item;
}else
{
std::cerr << "Not a post Item, deleting!" << std::endl;
delete *vit;
}
}
}
}
return ok;
}
bool p3Posted::getComment(const uint32_t &token, PostedCommentResult &comments)
{
GxsMsgDataMap msgData;
bool ok = RsGenExchange::getMsgData(token, msgData);
if(ok)
{
GxsMsgDataMap::iterator mit = msgData.begin();
for(; mit != msgData.end(); mit++)
{
RsGxsGroupId grpId = mit->first;
std::vector<RsGxsMsgItem*>& msgItems = mit->second;
std::vector<RsGxsMsgItem*>::iterator vit = msgItems.begin();
for(; vit != msgItems.end(); vit++)
{
RsGxsPostedCommentItem* item = dynamic_cast<RsGxsPostedCommentItem*>(*vit);
if(item)
{
RsPostedComment comment = item->mComment;
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;
}
bool p3Posted::submitGroup(uint32_t &token, RsPostedGroup &group)
{
RsGxsPostedGroupItem* grpItem = new RsGxsPostedGroupItem();
grpItem->mGroup = group;
grpItem->meta = group.mMeta;
RsGenExchange::publishGroup(token, grpItem);
return true;
}
bool p3Posted::submitPost(uint32_t &token, RsPostedPost &post)
{
RsGxsPostedPostItem* postItem = new RsGxsPostedPostItem();
postItem->mPost = post;
postItem->meta = post.mMeta;
postItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
RsGenExchange::publishMsg(token, postItem);
return true;
}
bool p3Posted::submitVote(uint32_t &token, RsPostedVote &vote)
{
RsGxsPostedVoteItem* voteItem = new RsGxsPostedVoteItem();
voteItem->mVote = vote;
voteItem->meta = vote.mMeta;
voteItem->meta.mMsgFlags |= FLAG_MSGTYPE_POST;
RsGenExchange::publishMsg(token, voteItem);
return true;
}
bool p3Posted::submitComment(uint32_t &token, RsPostedComment &comment)
{
RsGxsPostedCommentItem* commentItem = new RsGxsPostedCommentItem();
commentItem->mComment = comment;
commentItem->meta = comment.mMeta;
commentItem->meta.mMsgFlags |= FLAG_MSGTYPE_COMMENT;
RsGenExchange::publishMsg(token, commentItem);
return true;
}
// Special Ranking Request.
@ -50,36 +165,3 @@ bool p3Posted::requestRanking(uint32_t &token, RsGxsGroupId groupId)
{
}
bool p3Posted::getRankedPost(const uint32_t &token, RsPostedPost &post)
{
}
bool p3Posted::extractPostedCache()
{
}
// Control Ranking Calculations.
bool p3Posted::setViewMode(uint32_t mode)
{
}
bool p3Posted::setViewPeriod(uint32_t period)
{
}
bool p3Posted::setViewRange(uint32_t first, uint32_t count)
{
}
// exposed for testing...
float p3Posted::calcPostScore(uint32_t& token, const RsGxsMessageId)
{
}

View file

@ -22,11 +22,13 @@ protected:
*/
void notifyChanges(std::vector<RsGxsNotify*>& changes) ;
void service_tick();
public:
bool getGroup(const uint32_t &token, RsPostedGroup &group);
bool getPost(const uint32_t &token, RsPostedPost &post) ;
bool getComment(const uint32_t &token, RsPostedComment &comment) ;
bool getGroup(const uint32_t &token, std::vector<RsPostedGroup> &group);
bool getPost(const uint32_t &token, PostedPostResult& posts) ;
bool getComment(const uint32_t &token, PostedCommentResult& comments) ;
bool submitGroup(uint32_t &token, RsPostedGroup &group);
bool submitPost(uint32_t &token, RsPostedPost &post);
@ -35,18 +37,12 @@ public:
// Special Ranking Request.
bool requestRanking(uint32_t &token, RsGxsGroupId groupId) ;
bool getRankedPost(const uint32_t &token, RsPostedPost &post) ;
bool extractPostedCache() ;
// Control Ranking Calculations.
bool setViewMode(uint32_t mode);
bool setViewPeriod(uint32_t period);
bool setViewRange(uint32_t first, uint32_t count);
// bool setViewMode(uint32_t mode);
// bool setViewPeriod(uint32_t period);
// bool setViewRange(uint32_t first, uint32_t count);
// exposed for testing...
float calcPostScore(uint32_t& token, const RsGxsMessageId);
};
#endif // P3POSTED_H