Fixed service_type => 16bits in gxscomments.

Removed OLD RelatedMessage() data checks - which we killing comment tree.
Added debug indicating comment / vote counts.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6191 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-03-04 22:47:32 +00:00
parent 0f78719d7f
commit d39460bec0
4 changed files with 24 additions and 66 deletions

View File

@ -198,27 +198,6 @@ bool p3GxsChannels::getRelatedPosts(const uint32_t &token, std::vector<RsGxsChan
if(item) if(item)
{ {
/* HACK UNTIL CHRIS FIXES RELATED MSGS in GXS */
if (item->meta.mMsgId == (mit->first).second)
{
std::cerr << "p3GxsChannels::getRelatedPosts()";
std::cerr << " ERROR Found Original - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
if (item->meta.mParentId != (mit->first).second)
{
std::cerr << "p3GxsChannels::getRelatedPosts()";
std::cerr << " ERROR Found !CHILD - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
RsGxsChannelPost msg = item->mMsg; RsGxsChannelPost msg = item->mMsg;
msg.mMeta = item->meta; msg.mMeta = item->meta;
msgs.push_back(msg); msgs.push_back(msg);

View File

@ -59,7 +59,7 @@ RsGxsVote::RsGxsVote()
/******************* Startup / Tick ******************************************/ /******************* Startup / Tick ******************************************/
/********************************************************************************/ /********************************************************************************/
p3GxsCommentService::p3GxsCommentService(RsGenExchange *exchange, uint32_t service_type) p3GxsCommentService::p3GxsCommentService(RsGenExchange *exchange, uint16_t service_type)
: mExchange(exchange), mServiceType(service_type) : mExchange(exchange), mServiceType(service_type)
{ {
return; return;
@ -67,6 +67,9 @@ p3GxsCommentService::p3GxsCommentService(RsGenExchange *exchange, uint32_t servi
bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments) bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &comments)
{ {
std::cerr << "p3GxsCommentService::getGxsCommentData()";
std::cerr << std::endl;
GxsMsgDataMap msgData; GxsMsgDataMap msgData;
bool ok = mExchange->getMsgData(token, msgData); bool ok = mExchange->getMsgData(token, msgData);
@ -127,11 +130,20 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<R
} }
} }
} }
std::cerr << "p3GxsCommentService::getGxsCommentData() Found " << comments.size() << " Comments";
std::cerr << std::endl;
std::cerr << "p3GxsCommentService::getGxsCommentData() Found " << voteMap.size() << " Votes";
std::cerr << std::endl;
/* delete the votes */ /* delete the votes */
for (it = voteMap.begin(); it != voteMap.end(); it++) for (it = voteMap.begin(); it != voteMap.end(); it++)
{ {
delete it->second; delete it->second;
} }
} }
return ok; return ok;
@ -140,6 +152,9 @@ bool p3GxsCommentService::getGxsCommentData(const uint32_t &token, std::vector<R
bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments) bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &comments)
{ {
std::cerr << "p3GxsCommentService::getGxsRelatedComments()";
std::cerr << std::endl;
GxsMsgRelatedDataMap msgData; GxsMsgRelatedDataMap msgData;
bool ok = mExchange->getMsgRelatedData(token, msgData); bool ok = mExchange->getMsgRelatedData(token, msgData);
@ -159,27 +174,6 @@ bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vect
if(item) if(item)
{ {
/* HACK UNTIL CHRIS FIXES RELATED MSGS in GXS */
if (item->meta.mMsgId == (mit->first).second)
{
std::cerr << "p3GxsChannels::getRelatedComments()";
std::cerr << " ERROR Found Original - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
if (item->meta.mParentId != (mit->first).second)
{
std::cerr << "p3GxsChannels::getRelatedComments()";
std::cerr << " ERROR Found !CHILD - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
RsGxsComment comment = item->mMsg; RsGxsComment comment = item->mMsg;
comment.mMeta = item->meta; comment.mMeta = item->meta;
comments.push_back(comment); comments.push_back(comment);
@ -218,6 +212,12 @@ bool p3GxsCommentService::getGxsRelatedComments(const uint32_t &token, std::vect
} }
} }
} }
std::cerr << "p3GxsCommentService::getGxsRelatedComments() Found " << comments.size() << " Comments";
std::cerr << std::endl;
std::cerr << "p3GxsCommentService::getGxsRelatedComments() Found " << voteMap.size() << " Votes";
std::cerr << std::endl;
/* delete the votes */ /* delete the votes */
for (it = voteMap.begin(); it != voteMap.end(); it++) for (it = voteMap.begin(); it != voteMap.end(); it++)
{ {

View File

@ -37,7 +37,7 @@ class p3GxsCommentService
{ {
public: public:
p3GxsCommentService(RsGenExchange *exchange, uint32_t service_type); p3GxsCommentService(RsGenExchange *exchange, uint16_t service_type);
bool getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs); bool getGxsCommentData(const uint32_t &token, std::vector<RsGxsComment> &msgs);
bool getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs); bool getGxsRelatedComments(const uint32_t &token, std::vector<RsGxsComment> &msgs);
@ -52,7 +52,7 @@ class p3GxsCommentService
private: private:
RsGenExchange *mExchange; RsGenExchange *mExchange;
uint32_t mServiceType; uint16_t mServiceType;
}; };

View File

@ -175,27 +175,6 @@ bool p3GxsForums::getRelatedMessages(const uint32_t &token, std::vector<RsGxsFor
if(item) if(item)
{ {
/* HACK UNTIL CHRIS FIXES RELATED MSGS in GXS */
if (item->meta.mMsgId == (mit->first).second)
{
std::cerr << "p3GxsForums::getRelatedMessages()";
std::cerr << " ERROR Found Original - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
if (item->meta.mParentId != (mit->first).second)
{
std::cerr << "p3GxsForums::getRelatedMessages()";
std::cerr << " ERROR Found !CHILD - discarding";
std::cerr << " Id: " << item->meta.mMsgId;
std::cerr << std::endl;
delete item;
continue;
}
RsGxsForumMsg msg = item->mMsg; RsGxsForumMsg msg = item->mMsg;
msg.mMeta = item->meta; msg.mMeta = item->meta;
msgs.push_back(msg); msgs.push_back(msg);