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
This commit is contained in:
chrisparker126 2010-11-08 23:12:20 +00:00
parent f2406d4e57
commit 5ba29c9348

View File

@ -805,13 +805,17 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
bool p3Channels::getCleanUpList(std::map<std::string, uint32_t>& warnings,const std::string& chId,uint32_t limit) bool p3Channels::getCleanUpList(std::map<std::string, uint32_t>& 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); time_t now = time(NULL);
uint32_t timeLeft = 0; uint32_t timeLeft = 0;
bool first = true;
std::list<ChannelMsgSummary> msgList; std::list<ChannelMsgSummary> msgList;
std::list<ChannelMsgSummary>::iterator msg_it; std::list<ChannelMsgSummary>::iterator msg_it;
ChannelMsgInfo chMsgInfo; ChannelMsgInfo chMsgInfo;
if(!getChannelMsgList(chId, msgList)) if(!getChannelMsgList(chId, msgList))
return false; return false;
@ -822,7 +826,7 @@ bool p3Channels::getCleanUpList(std::map<std::string, uint32_t>& warnings,const
continue; continue;
// if msg not close to warning limit leave it alone // 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; continue;
timeLeft = CHANNEL_STOREPERIOD - (now - chMsgInfo.ts); timeLeft = CHANNEL_STOREPERIOD - (now - chMsgInfo.ts);
@ -852,7 +856,8 @@ void p3Channels::cleanUpOldFiles()
// then msg for each channel // then msg for each channel
for(ch_it = chList.begin(); ch_it != chList.end(); ch_it++){ 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; continue;
std::string channelname = ch_it->channelId; std::string channelname = ch_it->channelId;