From 5ba29c934808467bd7207337f243129056d79024 Mon Sep 17 00:00:00 2001 From: chrisparker126 Date: Mon, 8 Nov 2010 23:12:20 +0000 Subject: [PATCH] channels cleanup warning does not include msgs with no files and client's msgs also put an exception when cleaning files not to touch admin files git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3765 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/services/p3channels.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/services/p3channels.cc b/libretroshare/src/services/p3channels.cc index 4651c5676..5b6af1ac9 100644 --- a/libretroshare/src/services/p3channels.cc +++ b/libretroshare/src/services/p3channels.cc @@ -805,13 +805,17 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags) bool p3Channels::getCleanUpList(std::map& warnings,const std::string& chId,uint32_t limit) { + ChannelInfo chInfo; + getChannelInfo(chId, chInfo); + + if(chInfo.channelFlags & RS_DISTRIB_ADMIN) + return false; + time_t now = time(NULL); uint32_t timeLeft = 0; - bool first = true; std::list msgList; std::list::iterator msg_it; ChannelMsgInfo chMsgInfo; - if(!getChannelMsgList(chId, msgList)) return false; @@ -822,7 +826,7 @@ bool p3Channels::getCleanUpList(std::map& warnings,const continue; // if msg not close to warning limit leave it alone - if( chMsgInfo.ts > (now - CHANNEL_STOREPERIOD + limit)) + if((chMsgInfo.ts > (now - CHANNEL_STOREPERIOD + limit)) || (chMsgInfo.count < 1)) continue; timeLeft = CHANNEL_STOREPERIOD - (now - chMsgInfo.ts); @@ -852,7 +856,8 @@ void p3Channels::cleanUpOldFiles() // then msg for each channel for(ch_it = chList.begin(); ch_it != chList.end(); ch_it++){ - if(!getChannelMsgList(ch_it->channelId, msgList)) + // don't deal with files owned by client (they are not extra files anyways so slightly redundant) + if(!getChannelMsgList(ch_it->channelId, msgList) || (ch_it->channelFlags & RS_DISTRIB_ADMIN)) continue; std::string channelname = ch_it->channelId;