mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-13 16:45:49 -04:00
* 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:
parent
a436af418a
commit
821855d16e
5 changed files with 48 additions and 25 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue