* Added extra forum sorting method: Last Post.

This will hopefully be more useful than the existing ones.
	Extra childTS field was added & populated.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1628 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2009-09-09 21:15:12 +00:00
parent a436af418a
commit 821855d16e
5 changed files with 48 additions and 25 deletions

View file

@ -624,6 +624,9 @@ void p3GroupDistrib::loadMsg(RsDistribSignedMsg *newMsg, std::string src, bool l
/* accept message */
(git->second).msgs[msg->msgId] = msg;
/* now update parents TS */
locked_updateChildTS(git->second, msg);
#ifdef DISTRIB_DEBUG
std::cerr << "p3GroupDistrib::loadMsg() Msg Loaded Successfully" << std::endl;
std::cerr << std::endl;
@ -2567,6 +2570,42 @@ bool p3GroupDistrib::locked_checkDistribMsg(
}
/* now update parents TS */
bool p3GroupDistrib::locked_updateChildTS(GroupInfo &gi, RsDistribMsg *msg)
{
/* find all parents - update timestamp */
time_t updateTS = msg->timestamp;
msg->childTS = updateTS;
while("" != msg->parentId)
{
std::string parentId = msg->parentId;
std::map<std::string, RsDistribMsg *>::iterator mit;
if (gi.msgs.end() == (mit = gi.msgs.find(parentId)))
{
/* not found - abandon */
return true;
}
RsDistribMsg *parent = mit->second;
if ((!parent) || (parent->childTS > updateTS))
{
/* we're too old - give up! */
return true;
}
/* update timestamp */
parent->childTS = updateTS;
msg = parent;
}
}
/***** DEBUG *****/
void p3GroupDistrib::printGroups(std::ostream &out)