Comment and Vote update now functional

Voting and comment count update in gui added via msg notification
clarified comments in RsTokenService

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5958 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-12-09 22:38:49 +00:00
parent 62176264d3
commit 30b48c59ef
12 changed files with 339 additions and 36 deletions

View File

@ -64,7 +64,7 @@ public:
bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts); bool requestGroupInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts);
/*! /*!
* Use this to get msg related information, store this value to pole for request completion * Use this to get msg information (id, meta, or data), store token value to poll for request completion
* @param token The token returned for the request * @param token The token returned for the request
* @param ansType The type of result wanted * @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values * @param opts Additional option that affect outcome of request. Please see specific services, for valid values
@ -74,11 +74,12 @@ public:
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds); bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const GxsMsgReq& msgIds);
/*! /*!
* Use this to get msg related information, store this value to pole for request completion * Use this to get message information (id, meta, or data), store token value to poll for request completion
* @param token The token returned for the request * @param token The token returned for the request
* @param ansType The type of result wanted * @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values * @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list * @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list, if group Id list is empty \n
* all messages for all groups are retrieved
* @return true if request successful false otherwise * @return true if request successful false otherwise
*/ */
bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds); bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds);

View File

@ -163,10 +163,10 @@ public:
* @param token The token returned for the request * @param token The token returned for the request
* @param ansType The type of result wanted * @param ansType The type of result wanted
* @param opts Additional option that affect outcome of request. Please see specific services, for valid values * @param opts Additional option that affect outcome of request. Please see specific services, for valid values
* @param groupIds The ids of the groups to get, this retrieve all the msgs info for each grpId in list * @param groupIds The ids of the groups to get, this retrieves all the msgs info for each grpId in list
* @return true if request successful false otherwise * @return true if request successful false otherwise
*/ */
virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& msgIds) = 0; virtual bool requestMsgInfo(uint32_t &token, uint32_t ansType, const RsTokReqOptions &opts, const std::list<RsGxsGroupId>& grpIds) = 0;
/*! /*!
* For requesting msgs related to a given msg id within a group * For requesting msgs related to a given msg id within a group

View File

@ -134,6 +134,7 @@ class RsPostedPost
RsPostedPost() RsPostedPost()
{ {
mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST; mMeta.mMsgFlags = RsPosted::FLAG_MSGTYPE_POST;
mMeta.mServiceString = " 0 0 0";
return; return;
} }

View File

@ -18,8 +18,9 @@
#define NUM_TOPICS_TO_GENERATE 1 #define NUM_TOPICS_TO_GENERATE 1
#define NUM_POSTS_TO_GENERATE 1 #define NUM_POSTS_TO_GENERATE 1
#define NUM_VOTES_TO_GENERATE 23 #define NUM_VOTES_TO_GENERATE 23
#define NUM_COMMENTS_TO_GENERATE 23
#define VOTE_UPDATE_PERIOD 20 // 20 seconds #define VOTE_UPDATE_PERIOD 30 // 20 seconds
const uint32_t RsPosted::FLAG_MSGTYPE_COMMENT = 0x0001; const uint32_t RsPosted::FLAG_MSGTYPE_COMMENT = 0x0001;
const uint32_t RsPosted::FLAG_MSGTYPE_POST = 0x0002; const uint32_t RsPosted::FLAG_MSGTYPE_POST = 0x0002;
@ -44,7 +45,8 @@ RsPostedVote::RsPostedVote(const RsGxsPostedVoteItem& item)
p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes) p3Posted::p3Posted(RsGeneralDataService *gds, RsNetworkExchangeService *nes)
: RsGenExchange(gds, nes, new RsGxsPostedSerialiser(), RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this), mPostedMutex("Posted"), : RsGenExchange(gds, nes, new RsGxsPostedSerialiser(), RS_SERVICE_GXSV1_TYPE_POSTED), RsPosted(this), mPostedMutex("Posted"),
mTokenService(NULL), mGeneratingTopics(true), mGeneratingPosts(false), mRequestPhase1(true), mRequestPhase2(false), mRequestPhase3(false) mTokenService(NULL), mGeneratingTopics(true), mGeneratingPosts(false), mRequestPhase1(true), mRequestPhase2(false),
mRequestPhase3(false), mGenerateVotesAndComments(false)
{ {
mPostUpdate = false; mPostUpdate = false;
mLastUpdate = time(NULL); mLastUpdate = time(NULL);
@ -63,6 +65,7 @@ void p3Posted::service_tick()
generateTopics(); generateTopics();
generatePosts(); generatePosts();
generateVotesAndComments();
time_t now = time(NULL); time_t now = time(NULL);
@ -76,6 +79,121 @@ void p3Posted::service_tick()
updateVotes(); updateVotes();
} }
void p3Posted::generateVotesAndComments()
{
if(mGenerateVotesAndComments)
{
if(mRequestPhase1)
{
// request topics then chose at random which one to use to generate a post about
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
opts.mMsgFlagFilter = RsPosted::FLAG_MSGTYPE_POST;
opts.mMsgFlagMask = RsPosted::FLAG_MSGTYPE_MASK;
mTokenService->requestMsgInfo(mToken, 0, opts, mGrpIds);
mRequestPhase1 = false;
mRequestPhase2 = true;
return;
}
if(mRequestPhase2)
{
if(mTokenService->requestStatus(mToken) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
{
GxsMsgIdResult msgIds;
RsGenExchange::getMsgList(mToken, msgIds);
// for each msg generate a random number of votes and comments
GxsMsgIdResult::iterator mit = msgIds.begin();
for(; mit != msgIds.end(); mit++)
{
const RsGxsGroupId& grpId = mit->first;
std::vector<RsGxsMessageId>& msgIdsV = mit->second;
std::vector<RsGxsMessageId>::iterator vit = msgIdsV.begin();
for(; vit != msgIdsV.end(); vit++)
{
const RsGxsMessageId& msgId = *vit;
int nVotes = rand()%NUM_VOTES_TO_GENERATE;
uint32_t token;
for(int i=1; i < nVotes; i++)
{
RsPostedVote v;
v.mDirection = (rand()%10 > 3) ? 0 : 1;
v.mMeta.mParentId = msgId;
v.mMeta.mGroupId = grpId;
std::ostringstream ostrm;
ostrm << i;
v.mMeta.mMsgName = "Vote " + ostrm.str();
submitVote(token, v);
mTokens.push_back(token);
}
int nComments = rand()%NUM_COMMENTS_TO_GENERATE;
// single level comments for now
for(int i=1; i < nComments; i++)
{
RsPostedComment c;
std::ostringstream ostrm;
ostrm << i;
c.mComment = "Comment " + ostrm.str();
c.mMeta.mParentId = msgId;
c.mMeta.mGroupId = grpId;
submitComment(token, c);
mTokens.push_back(token);
}
}
}
mRequestPhase2 = false;
mRequestPhase3 = true;
}
}
if(mRequestPhase3)
{
if(!mTokens.empty())
{
std::vector<uint32_t>::iterator vit = mTokens.begin();
for(; vit != mTokens.end(); )
{
if(mTokenService->requestStatus(*vit) == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
vit = mTokens.erase(vit);
else
vit++;
}
}else
{
// stop generating posts after acknowledging all the ones you created
mGeneratingPosts = false;
mRequestPhase3 = false;
}
}
}
}
void p3Posted::generatePosts() void p3Posted::generatePosts()
{ {
if(mGeneratingPosts) if(mGeneratingPosts)
@ -151,6 +269,8 @@ void p3Posted::generatePosts()
// stop generating posts after acknowledging all the ones you created // stop generating posts after acknowledging all the ones you created
mGeneratingPosts = false; mGeneratingPosts = false;
mRequestPhase3 = false; mRequestPhase3 = false;
mGenerateVotesAndComments = true;
mRequestPhase1 = true;
} }
} }
@ -544,7 +664,7 @@ void p3Posted::calcPostedPostRank(const std::vector<RsMsgMetaData > msgMeta, Pos
std::vector<PostedScore>::iterator vit = scores.begin(); std::vector<PostedScore>::iterator vit = scores.begin();
int i = 1; int i = 1;
for(; vit != scores.end(); vit) for(; vit != scores.end(); vit++)
{ {
const PostedScore& p = *vit; const PostedScore& p = *vit;
ranking.insert(std::make_pair(p.msgId, i++)); ranking.insert(std::make_pair(p.msgId, i++));
@ -697,6 +817,11 @@ void p3Posted::updateVotes()
mPostUpdate = updateCompleteVotes(); mPostUpdate = updateCompleteVotes();
break; break;
} }
case UPDATE_PHASE_COMMENT_COUNT:
{
mPostUpdate = updateCompleteComments();
break;
}
case UPDATE_PHASE_COMPLETE: case UPDATE_PHASE_COMPLETE:
{ {
updateComplete(); updateComplete();
@ -774,13 +899,13 @@ bool p3Posted::updateRequestVotesComments()
} }
RsTokReqOptions opts; RsTokReqOptions opts;
// // only need ids for comments // only need ids for comments
//
// opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS; opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_IDS;
// opts.mOptions = RS_TOKREQOPT_MSG_LATEST | RS_TOKREQOPT_MSG_PARENT; opts.mOptions = RS_TOKREQOPT_MSG_LATEST | RS_TOKREQOPT_MSG_PARENT;
// opts.mMsgFlagMask = RsPosted::FLAG_MSGTYPE_MASK; opts.mMsgFlagMask = RsPosted::FLAG_MSGTYPE_MASK;
// opts.mMsgFlagFilter = RsPosted::FLAG_MSGTYPE_COMMENT; opts.mMsgFlagFilter = RsPosted::FLAG_MSGTYPE_COMMENT;
// mTokenService->requestMsgRelatedInfo(mCommentToken, 0, opts, msgIds); mTokenService->requestMsgRelatedInfo(mUpdateRequestComments, 0, opts, msgIds);
// need actual data for votes // need actual data for votes
opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA; opts.mReqType = GXS_REQUEST_TYPE_MSG_RELATED_DATA;
@ -835,7 +960,7 @@ bool p3Posted::updateCompleteVotes()
} }
} }
} }
mUpdatePhase = UPDATE_PHASE_COMPLETE; mUpdatePhase = UPDATE_PHASE_COMMENT_COUNT;
} }
else if(status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED) else if(status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
{ {
@ -845,6 +970,39 @@ bool p3Posted::updateCompleteVotes()
return true; return true;
} }
bool p3Posted::updateCompleteComments()
{
uint32_t status = mTokenService->requestStatus(mUpdateRequestComments);
if(status == RsTokenService::GXS_REQUEST_V2_STATUS_COMPLETE)
{
MsgRelatedIdResult commentIds;
RsGenExchange::getMsgRelatedList(mUpdateRequestComments, commentIds);
// now for each msg count the number of votes and thats it
MsgRelatedIdResult::iterator mit = commentIds.begin();
for(; mit != commentIds.end(); mit++)
{
const std::vector<RsGxsMessageId>& v = mit->second;
std::vector<RsGxsMessageId>::const_iterator cit = v.begin();
for(; cit != v.end(); cit++)
{
mMsgCounts[mit->first].commentCount++;
}
}
mUpdatePhase = UPDATE_PHASE_COMPLETE;
}
else if(status == RsTokenService::GXS_REQUEST_V2_STATUS_FAILED)
{
mTokenService->cancelRequest(mUpdateRequestComments);
return false;
}
return true;
}
bool p3Posted::updateComplete() bool p3Posted::updateComplete()
{ {
// now compare with msg meta to see what currently store there // now compare with msg meta to see what currently store there
@ -867,12 +1025,13 @@ bool p3Posted::updateComplete()
msgId.second = msgMeta.mMsgId; msgId.second = msgMeta.mMsgId;
PostedScore& sc = mMsgCounts[msgId]; PostedScore& sc = mMsgCounts[msgId];
bool changed = (sc.upVotes != upVotes) || (sc.downVotes != downVotes); bool changed = (sc.upVotes != upVotes) || (sc.downVotes != downVotes)
|| (sc.commentCount != nComments);
if(changed) if(changed)
{ {
std::string servStr; std::string servStr;
storeScores(servStr, sc.upVotes, sc.downVotes, 0); storeScores(servStr, sc.upVotes, sc.downVotes, sc.commentCount);
uint32_t token; uint32_t token;
setMsgServiceString(token, msgId, servStr); setMsgServiceString(token, msgId, servStr);
mChangeTokens.push_back(token); mChangeTokens.push_back(token);
@ -886,4 +1045,24 @@ bool p3Posted::updateComplete()
mPostUpdate = false; mPostUpdate = false;
mUpdatePhase = UPDATE_PHASE_GRP_REQUEST; mUpdatePhase = UPDATE_PHASE_GRP_REQUEST;
if(!mMsgCounts.empty())
{
RsGxsMsgChange* msgChange = new RsGxsMsgChange();
std::map<RsGxsGrpMsgIdPair, PostedScore >::iterator mit_c = mMsgCounts.begin();
for(; mit_c != mMsgCounts.end(); mit_c++)
{
const RsGxsGrpMsgIdPair& msgId = mit_c->first;
msgChange->msgChangeMap[msgId.first].push_back(msgId.second);
}
std::vector<RsGxsNotify*> n;
n.push_back(msgChange);
notifyChanges(n);
mMsgCounts.clear();
}
} }

View File

@ -74,7 +74,7 @@ public:
* Generates random votes to existing posts * Generates random votes to existing posts
* in the system * in the system
*/ */
void generateVotes(); void generateVotesAndComments();
public: public:
@ -163,7 +163,8 @@ private:
// for data generation // for data generation
bool mGeneratingPosts, mGeneratingTopics, mRequestPhase1, mRequestPhase2, mRequestPhase3; bool mGeneratingPosts, mGeneratingTopics,
mRequestPhase1, mRequestPhase2, mRequestPhase3, mGenerateVotesAndComments;
std::vector<uint32_t> mTokens; std::vector<uint32_t> mTokens;
uint32_t mToken; uint32_t mToken;
std::list<RsGxsGroupId> mGrpIds; std::list<RsGxsGroupId> mGrpIds;

View File

@ -26,6 +26,7 @@
#include <retroshare/rsposted.h> #include <retroshare/rsposted.h>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>

View File

@ -43,6 +43,18 @@ PostedItem::PostedItem(PostedHolder *postHolder, const RsPostedPost &post)
setupUi(this); setupUi(this);
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
setContent(mPost);
connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) );
connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote()));
connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote()));
return;
}
void PostedItem::setContent(const RsPostedPost &post)
{
mPost = post;
QDateTime qtime; QDateTime qtime;
qtime.setTime_t(mPost.mMeta.mPublishTs); qtime.setTime_t(mPost.mMeta.mPublishTs);
QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm"); QString timestamp = qtime.toString("dd.MMMM yyyy hh:mm");
@ -57,16 +69,20 @@ PostedItem::PostedItem(PostedHolder *postHolder, const RsPostedPost &post)
uint32_t up, down, nComments; uint32_t up, down, nComments;
rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments); bool ok = rsPosted->retrieveScores(mPost.mMeta.mServiceString, up, down, nComments);
int32_t vote = up - down; if(ok)
scoreLabel->setText(QString::number(vote)); {
int32_t vote = up - down;
scoreLabel->setText(QString::number(vote));
connect( commentButton, SIGNAL( clicked() ), this, SLOT( loadComments() ) ); numCommentsLabel->setText("<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px;"
connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); "margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span"
connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); "style=\" font-size:10pt; font-weight:600;\">#</span><span "
"style=\" font-size:8pt; font-weight:600;\"> Comments: "
+ QString::number(nComments) + "</span></p>");
}
return;
} }
RsPostedPost PostedItem::getPost() const RsPostedPost PostedItem::getPost() const

View File

@ -38,15 +38,15 @@ class PostedHolder
virtual void showComments(const RsPostedPost& post) = 0; virtual void showComments(const RsPostedPost& post) = 0;
}; };
class PostedItem : public QWidget, private Ui::PostedItem class PostedItem : public QWidget, private Ui::PostedItem
{ {
Q_OBJECT Q_OBJECT
public: public:
PostedItem(PostedHolder *parent, const RsPostedPost &item); PostedItem(PostedHolder *parent, const RsPostedPost &post);
RsPostedPost getPost() const; RsPostedPost getPost() const;
void setContent(const RsPostedPost& post);
private slots: private slots:
void loadComments(); void loadComments();

View File

@ -250,7 +250,18 @@ border-radius: 10px}</string>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0"> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1,0">
<item>
<widget class="QLabel" name="numCommentsLabel">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:10pt; font-weight:600;&quot;&gt;#&lt;/span&gt;&lt;span style=&quot; font-size:8pt; font-weight:600;&quot;&gt; Comments: 0&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">

View File

@ -140,21 +140,68 @@ void PostedListDialog::showComments(const RsPostedPost& post)
void PostedListDialog::updateDisplay() void PostedListDialog::updateDisplay()
{ {
std::list<std::string> groupIds;
std::list<std::string>::iterator it;
if (!rsPosted) if (!rsPosted)
return; return;
std::list<std::string> groupIds;
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
if (rsPosted->updated()) if (rsPosted->updated())
{ {
/* update Forums List */ /* update Forums List */
insertGroups();
insertThreads(); rsPosted->groupsChanged(groupIds);
if(!groupIds.empty())
{
std::list<std::string>::iterator it = std::find(groupIds.begin(), groupIds.end(), mCurrTopicId);
if(it != groupIds.end()){
requestGroupSummary();
return;
}
}
rsPosted->msgsChanged(msgs);
if(!msgs.empty())
{
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator mit = msgs.find(mCurrTopicId);
if(mit != msgs.end())
{
updateDisplayedItems(mit->second);
}
}
} }
} }
void PostedListDialog::updateDisplayedItems(const std::vector<RsGxsMessageId> &msgIds)
{
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
GxsMsgReq msgs;
msgs[mCurrTopicId] = msgIds;
std::cerr << "PostedListDialog::updateDisplayedItems(" << mCurrTopicId << ")";
std::cerr << std::endl;
uint32_t token;
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgs, TOKEN_USER_TYPE_POST_MOD);
}
void PostedListDialog::changedTopic(const QString &id) void PostedListDialog::changedTopic(const QString &id)
{ {
mCurrTopicId = id.toStdString(); mCurrTopicId = id.toStdString();
@ -362,7 +409,8 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
for(; vit != posts.end(); vit++) for(; vit != posts.end(); vit++)
{ {
loadPost(*vit); RsPostedPost& p = *vit;
loadPost(p);
} }
} }
@ -371,6 +419,7 @@ void PostedListDialog::loadPost(const RsPostedPost &post)
PostedItem *item = new PostedItem(this, post); PostedItem *item = new PostedItem(this, post);
connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool))); connect(item, SIGNAL(vote(RsGxsGrpMsgIdPair,bool)), this, SLOT(submitVote(RsGxsGrpMsgIdPair,bool)));
QLayout *alayout = ui.scrollAreaWidgetContents->layout(); QLayout *alayout = ui.scrollAreaWidgetContents->layout();
mPosts.insert(post.mMeta.mMsgId, item);
alayout->addWidget(item); alayout->addWidget(item);
} }
@ -415,9 +464,37 @@ void PostedListDialog::clearPosts()
alayout->removeWidget(item); alayout->removeWidget(item);
delete item; delete item;
} }
mPosts.clear();
} }
void PostedListDialog::updateCurrentDisplayComplete(const uint32_t &token)
{
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads()";
std::cerr << std::endl;
PostedPostResult result;
rsPosted->getPost(token, result);
if(result.find(mCurrTopicId) == result.end())
return;
std::vector<RsPostedPost>& posts = result[mCurrTopicId];
std::vector<RsPostedPost>::iterator vit = posts.begin();
for(; vit != posts.end(); vit++)
{
RsPostedPost& p = *vit;
// modify post content
if(mPosts.find(p.mMeta.mMsgId) != mPosts.end())
mPosts[p.mMeta.mMsgId]->setContent(p);
}
}
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
/*********************** **** **** **** ***********************/ /*********************** **** **** **** ***********************/
@ -470,6 +547,17 @@ void PostedListDialog::loadRequest(const TokenQueue *queue, const TokenRequest &
break; break;
} }
break; break;
case TOKEN_USER_TYPE_POST_MOD:
switch(req.mAnsType)
{
case RS_TOKREQ_ANSTYPE_DATA:
updateCurrentDisplayComplete(req.mToken);
break;
default:
std::cerr << "Error, unexpected anstype:" << req.mAnsType << std::endl;
break;
}
break;
default: default:
std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE"; std::cerr << "PostedListDialog::loadRequest() ERROR: INVALID TYPE";
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -104,13 +104,16 @@ private:
void loadVoteData(const uint32_t &token); void loadVoteData(const uint32_t &token);
// update displayed item
void updateDisplayedItems(const std::vector<RsGxsMessageId>& msgIds);
void updateCurrentDisplayComplete(const uint32_t& token);
void insertGroupData(const std::list<RsGroupMetaData> &groupList); void insertGroupData(const std::list<RsGroupMetaData> &groupList);
void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo); void groupInfoToGroupItemInfo(const RsGroupMetaData &groupInfo, GroupItemInfo &groupItemInfo);
void loadRequest(const TokenQueue *queue, const TokenRequest &req); void loadRequest(const TokenQueue *queue, const TokenRequest &req);
private: private:
QTreeWidgetItem *yourTopics; QTreeWidgetItem *yourTopics;
@ -124,6 +127,7 @@ private:
RsGxsGroupId mCurrTopicId; RsGxsGroupId mCurrTopicId;
QMap<RsGxsGroupId, RsPostedGroup> mGroups; QMap<RsGxsGroupId, RsPostedGroup> mGroups;
QMap<RsGxsMessageId, PostedItem*> mPosts;
TokenQueue *mPostedQueue; TokenQueue *mPostedQueue;
CommentHolder* mCommentHolder; CommentHolder* mCommentHolder;

View File

@ -4,5 +4,6 @@
#define TOKEN_USER_TYPE_POST 4 #define TOKEN_USER_TYPE_POST 4
#define TOKEN_USER_TYPE_VOTE 5 #define TOKEN_USER_TYPE_VOTE 5
#define TOKEN_USER_TYPE_TOPIC 6 #define TOKEN_USER_TYPE_TOPIC 6
#define TOKEN_USER_TYPE_POST_MOD 7
#endif // POSTEDUSERTYPES_H #endif // POSTEDUSERTYPES_H