Merge branch 'master' into gxs_mail_experiments

This commit is contained in:
csoler 2017-05-13 21:08:16 +02:00 committed by GitHub
commit c0c5cc52db
94 changed files with 3054 additions and 783 deletions

View file

@ -1363,6 +1363,18 @@ bool RsGenExchange::getGroupData(const uint32_t &token, std::vector<RsGxsGrpItem
gItem->meta.mPop = 0;
gItem->meta.mVisibleMsgCount = 0;
}
// Also check the group privacy flags. A while ago, it as possible to publish a group without privacy flags. Now it is not possible anymore.
// As a consequence, it's important to supply a correct value in this flag before the data can be edited/updated.
if((gItem->meta.mGroupFlags & GXS_SERV::FLAG_PRIVACY_MASK) == 0)
{
#ifdef GEN_EXCH_DEBUG
std::cerr << "(WW) getGroupData(): mGroupFlags for group " << gItem->meta.mGroupId << " has incorrect value " << std::hex << gItem->meta.mGroupFlags << std::dec << ". Setting value to GXS_SERV::FLAG_PRIVACY_PUBLIC." << std::endl;
#endif
gItem->meta.mGroupFlags |= GXS_SERV::FLAG_PRIVACY_PUBLIC;
}
grpItem.push_back(gItem);
}
else

View file

@ -82,14 +82,23 @@ bool RsGxsMessageCleanUp::clean()
for(; mit != result.end(); ++mit)
{
std::vector<RsGxsMsgMetaData*>& metaV = mit->second;
std::vector<RsGxsMsgMetaData*>::iterator vit = metaV.begin();
for(; vit != metaV.end(); )
// First, make a map of which message have a child message. This allows to only delete messages that dont have child messages.
// A more accurate way to go would be to compute the time of the oldest message and possibly delete all the branch, but in the
// end the message tree will be deleted slice after slice, which should still be reasonnably fast.
//
std::set<RsGxsMessageId> messages_with_kids ;
for( uint32_t i=0;i<metaV.size();++i)
if(!metaV[i]->mParentId.isNull())
messages_with_kids.insert(metaV[i]->mParentId) ;
for( uint32_t i=0;i<metaV.size();++i)
{
RsGxsMsgMetaData* meta = *vit;
RsGxsMsgMetaData* meta = metaV[i];
// check if expired
bool remove = store_period > 0 && (meta->mPublishTs + store_period) < now;
bool remove = store_period > 0 && ((meta->mPublishTs + store_period) < now) && (messages_with_kids.find(meta->mMsgId)==messages_with_kids.end());
// check client does not want the message kept regardless of age
remove &= !(meta->mMsgStatus & GXS_SERV::GXS_MSG_STATUS_KEEP);
@ -106,7 +115,6 @@ bool RsGxsMessageCleanUp::clean()
}
delete meta;
vit = metaV.erase(vit);
}
}