removed channel delete feature

added optimisation suggestion with load/savelist

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3920 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2010-12-18 19:35:07 +00:00
parent d3a6f7316c
commit 2f559dae96
37 changed files with 133 additions and 388 deletions

View File

@ -729,9 +729,8 @@ RsSerialiser *CacheStrapper::setupSerialiser()
} }
std::list<RsItem *> CacheStrapper::saveList(bool &cleanup) bool CacheStrapper::saveList(bool &cleanup, std::list<RsItem *>& saveData)
{ {
std::list<RsItem *> saveData;
/* it can delete them! */ /* it can delete them! */
cleanup = true; cleanup = true;
@ -810,11 +809,11 @@ std::list<RsItem *> CacheStrapper::saveList(bool &cleanup)
} }
/* list completed! */ /* list completed! */
return saveData; return true;
} }
bool CacheStrapper::loadList(std::list<RsItem *> load) bool CacheStrapper::loadList(std::list<RsItem *>& load)
{ {
std::list<RsItem *>::iterator it; std::list<RsItem *>::iterator it;
RsCacheConfig *rscc; RsCacheConfig *rscc;

View File

@ -447,8 +447,8 @@ bool CacheExist(CacheData& data);
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
private: private:

View File

@ -1862,10 +1862,9 @@ RsSerialiser *ftController::setupSerialiser()
return rss; return rss;
} }
bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
std::list<RsItem *> ftController::saveList(bool &cleanup)
{ {
std::list<RsItem *> saveData;
/* it can delete them! */ /* it can delete them! */
cleanup = true; cleanup = true;
@ -1977,11 +1976,11 @@ std::list<RsItem *> ftController::saveList(bool &cleanup)
} }
/* list completed! */ /* list completed! */
return saveData; return true;
} }
bool ftController::loadList(std::list<RsItem *> load) bool ftController::loadList(std::list<RsItem *>& load)
{ {
std::list<RsItem *>::iterator it; std::list<RsItem *>::iterator it;
std::list<RsTlvKeyValue>::iterator kit; std::list<RsTlvKeyValue>::iterator kit;

View File

@ -206,8 +206,8 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
/* p3Config Interface */ /* p3Config Interface */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
bool loadConfigMap(std::map<std::string, std::string> &configMap); bool loadConfigMap(std::map<std::string, std::string> &configMap);
private: private:

View File

@ -205,9 +205,9 @@ RsSerialiser *ftFiMonitor::setupSerialiser()
const std::string hash_cache_duration_ss("HASH_CACHE_DURATION"); const std::string hash_cache_duration_ss("HASH_CACHE_DURATION");
const std::string hash_cache_ss("HASH_CACHE"); const std::string hash_cache_ss("HASH_CACHE");
std::list<RsItem *> ftFiMonitor::saveList(bool &cleanup) bool ftFiMonitor::saveList(bool &cleanup, std::list<RsItem *>& sList)
{ {
std::list<RsItem *> sList;
cleanup = true; cleanup = true;
@ -256,11 +256,11 @@ std::list<RsItem *> ftFiMonitor::saveList(bool &cleanup)
/* Add KeyValue to saveList */ /* Add KeyValue to saveList */
sList.push_back(rskv); sList.push_back(rskv);
return sList; return true;
} }
bool ftFiMonitor::loadList(std::list<RsItem *> load) bool ftFiMonitor::loadList(std::list<RsItem *>& load)
{ {
/* for each item, check it exists .... /* for each item, check it exists ....
* - remove any that are dead (or flag?) * - remove any that are dead (or flag?)

View File

@ -78,8 +78,8 @@ class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
protected: protected:
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
}; };

View File

@ -363,9 +363,9 @@ RsSerialiser *ftExtraList::setupSerialiser()
return rss; return rss;
} }
std::list<RsItem *> ftExtraList::saveList(bool &cleanup) bool ftExtraList::saveList(bool &cleanup, std::list<RsItem *>& sList)
{ {
std::list<RsItem *> sList;
cleanup = true; cleanup = true;
@ -397,11 +397,11 @@ std::list<RsItem *> ftExtraList::saveList(bool &cleanup)
sList.push_back(fi); sList.push_back(fi);
} }
return sList; return true;
} }
bool ftExtraList::loadList(std::list<RsItem *> load) bool ftExtraList::loadList(std::list<RsItem *>& load)
{ {
/* for each item, check it exists .... /* for each item, check it exists ....
* - remove any that are dead (or flag?) * - remove any that are dead (or flag?)

View File

@ -151,8 +151,8 @@ virtual void run();
**/ **/
protected: protected:
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem*>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
private: private:

View File

@ -705,13 +705,13 @@ RsSerialiser *ftServer::setupSerialiser()
return NULL; return NULL;
} }
std::list<RsItem *> ftServer::saveList(bool &cleanup) bool ftServer::saveList(bool &cleanup, std::list<RsItem *>& list)
{ {
std::list<RsItem *> list;
return list; return true;
} }
bool ftServer::loadList(std::list<RsItem *> load) bool ftServer::loadList(std::list<RsItem *>& load)
{ {
return true; return true;
} }

View File

@ -241,8 +241,8 @@ bool handleFileData();
protected: protected:
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
private: private:
bool loadConfigMap(std::map<std::string, std::string> &configMap); bool loadConfigMap(std::map<std::string, std::string> &configMap);

View File

@ -2310,7 +2310,7 @@ RsSerialiser *AuthGPGimpl::setupSerialiser()
return rss ; return rss ;
} }
std::list<RsItem*> AuthGPGimpl::saveList(bool& cleanup) bool AuthGPGimpl::saveList(bool& cleanup, std::list<RsItem*>& lst)
{ {
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "AuthGPGimpl::saveList() called" << std::endl ; std::cerr << "AuthGPGimpl::saveList() called" << std::endl ;
@ -2319,8 +2319,6 @@ std::list<RsItem*> AuthGPGimpl::saveList(bool& cleanup)
RsStackMutex stack(gpgMtxData); /******* LOCKED ******/ RsStackMutex stack(gpgMtxData); /******* LOCKED ******/
cleanup = true ; cleanup = true ;
std::list<RsItem*> lst ;
// Now save config for network digging strategies // Now save config for network digging strategies
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ; RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
@ -2339,10 +2337,10 @@ std::list<RsItem*> AuthGPGimpl::saveList(bool& cleanup)
} }
lst.push_back(vitem); lst.push_back(vitem);
return lst ; return true ;
} }
bool AuthGPGimpl::loadList(std::list<RsItem*> load) bool AuthGPGimpl::loadList(std::list<RsItem*>& load)
{ {
#ifdef GPG_DEBUG #ifdef GPG_DEBUG
std::cerr << "AuthGPGimpl::loadList() Item Count: " << load.size() << std::endl; std::cerr << "AuthGPGimpl::loadList() Item Count: " << load.size() << std::endl;

View File

@ -380,8 +380,8 @@ virtual bool addService(AuthGPGService *service);
/*********************** p3config ******************************/ /*********************** p3config ******************************/
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
/*****************************************************************/ /*****************************************************************/
private: private:

View File

@ -53,7 +53,7 @@
* #define AUTHSSL_DEBUG 1 * #define AUTHSSL_DEBUG 1
***/ ***/
// initialisation du pointeur de singleton à zéro // initialisation du pointeur de singleton <EFBFBD> z<>ro
static AuthSSL *instance_ssl = NULL; static AuthSSL *instance_ssl = NULL;
/* hidden function - for testing purposes() */ /* hidden function - for testing purposes() */
@ -1256,7 +1256,7 @@ RsSerialiser *AuthSSLimpl::setupSerialiser()
return rss ; return rss ;
} }
std::list<RsItem*> AuthSSLimpl::saveList(bool& cleanup) bool AuthSSLimpl::saveList(bool& cleanup, std::list<RsItem*>& lst)
{ {
#ifdef AUTHSSL_DEBUG #ifdef AUTHSSL_DEBUG
std::cerr << "AuthSSLimpl::saveList() called" << std::endl ; std::cerr << "AuthSSLimpl::saveList() called" << std::endl ;
@ -1265,8 +1265,6 @@ std::list<RsItem*> AuthSSLimpl::saveList(bool& cleanup)
RsStackMutex stack(sslMtx); /******* LOCKED ******/ RsStackMutex stack(sslMtx); /******* LOCKED ******/
cleanup = true ; cleanup = true ;
std::list<RsItem*> lst ;
// Now save config for network digging strategies // Now save config for network digging strategies
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ; RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
@ -1285,10 +1283,10 @@ std::list<RsItem*> AuthSSLimpl::saveList(bool& cleanup)
} }
lst.push_back(vitem); lst.push_back(vitem);
return lst ; return true ;
} }
bool AuthSSLimpl::loadList(std::list<RsItem*> load) bool AuthSSLimpl::loadList(std::list<RsItem*>& load)
{ {
#ifdef AUTHSSL_DEBUG #ifdef AUTHSSL_DEBUG
std::cerr << "AuthSSLimpl::loadList() Item Count: " << load.size() << std::endl; std::cerr << "AuthSSLimpl::loadList() Item Count: " << load.size() << std::endl;

View File

@ -217,8 +217,8 @@ virtual bool ValidateCertificate(X509 *x509, std::string &peerId); /* validate
/*********************** p3config ******************************/ /*********************** p3config ******************************/
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>& );
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
/*****************************************************************/ /*****************************************************************/
public: /* SSL specific functions used in pqissl/pqissllistener */ public: /* SSL specific functions used in pqissl/pqissllistener */

View File

@ -904,7 +904,8 @@ bool p3Config::saveConfig()
{ {
bool cleanup = true; bool cleanup = true;
std::list<RsItem *> toSave = saveList(cleanup); std::list<RsItem *> toSave;
saveList(cleanup, toSave);
// temporarily append new to files as these will replace current configuration // temporarily append new to files as these will replace current configuration
std::string newCfgFname = Filename() + "_new"; std::string newCfgFname = Filename() + "_new";
@ -986,7 +987,8 @@ bool p3Config::saveGlobalConfig()
{ {
bool cleanup = true; bool cleanup = true;
std::list<RsItem *> toSave = saveList(cleanup); std::list<RsItem *> toSave;
saveList(cleanup, toSave);
std::string cfg_fname = Filename(); // get configuration file name std::string cfg_fname = Filename(); // get configuration file name
@ -1212,7 +1214,7 @@ RsSerialiser *p3GeneralConfig::setupSerialiser()
return rss; return rss;
} }
std::list<RsItem *> p3GeneralConfig::saveList(bool &cleanup) bool p3GeneralConfig::saveList(bool &cleanup, std::list<RsItem *>& savelist)
{ {
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/ RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
@ -1222,7 +1224,7 @@ std::list<RsItem *> p3GeneralConfig::saveList(bool &cleanup)
#endif #endif
cleanup = true; cleanup = true;
std::list<RsItem *> savelist;
RsConfigKeyValueSet *item = new RsConfigKeyValueSet(); RsConfigKeyValueSet *item = new RsConfigKeyValueSet();
std::map<std::string, std::string>::iterator it; std::map<std::string, std::string>::iterator it;
@ -1246,11 +1248,11 @@ std::list<RsItem *> p3GeneralConfig::saveList(bool &cleanup)
savelist.push_back(item); savelist.push_back(item);
} }
return savelist; return true;
} }
bool p3GeneralConfig::loadList(std::list<RsItem *> load) bool p3GeneralConfig::loadList(std::list<RsItem *>& load)
{ {
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
std::cerr << "p3GeneralConfig::loadList() count: " << load.size(); std::cerr << "p3GeneralConfig::loadList() count: " << load.size();

View File

@ -330,13 +330,13 @@ virtual RsSerialiser *setupSerialiser() = 0;
* and vice versa * and vice versa
* @return list of config items derived object wants to saves * @return list of config items derived object wants to saves
*/ */
virtual std::list<RsItem *> saveList(bool &cleanup) = 0; virtual bool saveList(bool &cleanup, std::list<RsItem *>&) = 0;
/** /**
* loads up list of configs items for derived object * loads up list of configs items for derived object
* @param load list of config items to load up * @param load list of config items to load up
*/ */
virtual bool loadList(std::list<RsItem *> load) = 0; virtual bool loadList(std::list<RsItem *>& load) = 0;
/** /**
* callback for mutex unlocking * callback for mutex unlocking
@ -384,8 +384,8 @@ void setSetting(std::string opt, std::string val);
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem* >&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& );
private: private:

View File

@ -3369,10 +3369,9 @@ RsSerialiser *p3ConnectMgr::setupSerialiser()
} }
std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup) bool p3ConnectMgr::saveList(bool &cleanup, std::list<RsItem *>& saveData)
{ {
/* create a list of current peers */ /* create a list of current peers */
std::list<RsItem *> saveData;
cleanup = false; cleanup = false;
connMtx.lock(); /****** MUTEX LOCKED *******/ connMtx.lock(); /****** MUTEX LOCKED *******/
@ -3479,7 +3478,7 @@ std::list<RsItem *> p3ConnectMgr::saveList(bool &cleanup)
saveData.push_back(*groupIt); // no delete saveData.push_back(*groupIt); // no delete
} }
return saveData; return true;
} }
void p3ConnectMgr::saveDone() void p3ConnectMgr::saveDone()
@ -3497,7 +3496,7 @@ void p3ConnectMgr::saveDone()
connMtx.unlock(); /****** MUTEX UNLOCKED *******/ connMtx.unlock(); /****** MUTEX UNLOCKED *******/
} }
bool p3ConnectMgr::loadList(std::list<RsItem *> load) bool p3ConnectMgr::loadList(std::list<RsItem *>& load)
{ {
if (load.size() == 0) { if (load.size() == 0) {

View File

@ -390,9 +390,9 @@ bool addAddressIfUnique(std::list<peerConnectAddress> &addrList,
/*********************** p3config ******************************/ /*********************** p3config ******************************/
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual void saveDone(); virtual void saveDone();
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
/*****************************************************************/ /*****************************************************************/
//void setupOwnNetConfig(RsPeerConfigItem *item); //void setupOwnNetConfig(RsPeerConfigItem *item);

View File

@ -251,14 +251,6 @@ virtual bool channelEditInfo(std::string chId, ChannelInfo &ci) = 0;
*/ */
virtual void getPubKeysAvailableGrpIds(std::list<std::string>& chanIds) = 0; virtual void getPubKeysAvailableGrpIds(std::list<std::string>& chanIds) = 0;
/*!
*
* get list of channels for which file contents will be cleaned out soon
* @param warning contains msgs ids given a using channel id as the key for which warnings should issued to user
* @parma limit the length of time before clean warning should be issued for a given id
*
*/
virtual bool getCleanUpList(std::map<std::string, uint32_t>& warnings,const std::string& chId, uint32_t limit) = 0;
}; };

View File

@ -173,9 +173,7 @@ void RsServer::ConfigFinalSave()
void RsServer::rsGlobalShutDown() void RsServer::rsGlobalShutDown()
{ {
// TODO: cache should also clean up old files // TODO: cache should also clean up old files
#ifndef MINIMAL_LIBRS
mChannels->cleanUpOldFiles();
#endif // MINIMAL_LIBRS
ConfigFinalSave(); // save configuration before exit ConfigFinalSave(); // save configuration before exit
mConnMgr->shutdown(); /* Handles UPnP */ mConnMgr->shutdown(); /* Handles UPnP */

View File

@ -474,10 +474,9 @@ bool p3Channels::channelExtraFileHash(std::string path, std::string chId, FileIn
fname.append(fnameBuff.rbegin(), fnameBuff.rend()); fname.append(fnameBuff.rbegin(), fnameBuff.rend());
uint32_t flags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA; uint32_t flags = RS_FILE_HINTS_NETWORK_WIDE;
// then hash file, but hash file at original location if its too large // then hash file and get file info too
// and get file info too
if(!mRsFiles->ExtraFileHash(path, CHANNEL_STOREPERIOD, flags)) if(!mRsFiles->ExtraFileHash(path, CHANNEL_STOREPERIOD, flags))
return false; return false;
@ -540,19 +539,6 @@ bool p3Channels::locked_checkDistribMsg(RsDistribMsg *msg)
} }
RsDistribGrp *p3Channels::locked_createPublicDistribGrp(GroupInfo &info)
{
RsDistribGrp *grp = NULL; //new RsChannelGrp();
return grp;
}
RsDistribGrp *p3Channels::locked_createPrivateDistribGrp(GroupInfo &info)
{
RsDistribGrp *grp = NULL; //new RsChannelGrp();
return grp;
}
bool p3Channels::channelSubscribe(std::string cId, bool subscribe) bool p3Channels::channelSubscribe(std::string cId, bool subscribe)
@ -630,12 +616,6 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
std::string nullId; std::string nullId;
// std::cerr << "p3Channels::locked_eventDuplicateMsg() ";
// std::cerr << " grpId: " << grpId << " msgId: " << msgId;
// std::cerr << " peerId: " << id;
// std::cerr << std::endl;
RsChannelMsg *chanMsg = dynamic_cast<RsChannelMsg *>(msg); RsChannelMsg *chanMsg = dynamic_cast<RsChannelMsg *>(msg);
if (!chanMsg) if (!chanMsg)
{ {
@ -652,10 +632,10 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
if (id == mOwnId) if (id == mOwnId)
{ {
download = false; download = false;
//#ifdef CHANNEL_DEBUG #ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_eventDuplicateMsg() msg from self - not downloading"; std::cerr << "p3Channels::locked_eventDuplicateMsg() msg from self - not downloading";
std::cerr << std::endl; std::cerr << std::endl;
//#endif #endif
} }
/* check subscribed */ /* check subscribed */
@ -672,6 +652,18 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
return true; return true;
} }
// get channel info to determine if channel is private or not
ChannelInfo cInfo;
bool chanPrivate = false;
// tho if empty don't bother
if(!chanMsg->attachment.items.empty()){
getChannelInfo(grpId, cInfo);
if(cInfo.channelFlags & RS_DISTRIB_PRIVATE)
chanPrivate = true;
}
/* Iterate through files */ /* Iterate through files */
std::list<RsTlvFileItem>::iterator fit; std::list<RsTlvFileItem>::iterator fit;
for(fit = chanMsg->attachment.items.begin(); for(fit = chanMsg->attachment.items.begin();
@ -681,11 +673,22 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
std::string hash = fit->hash; std::string hash = fit->hash;
uint64_t size = fit->filesize; uint64_t size = fit->filesize;
std::string channelname = grpId; std::string channelname = grpId;
std::string localpath = mChannelsDir + "/" + channelname;
uint32_t flags = RS_FILE_HINTS_EXTRA |
RS_FILE_HINTS_BACKGROUND |
RS_FILE_HINTS_NETWORK_WIDE;
std::string localpath;
uint32_t flags;
// send to download directory if file is private
if(chanPrivate){
localpath = mChannelsDir + "/" + channelname;
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_EXTRA;
}else{
localpath = ""; // forces dl to default directory
flags = RS_FILE_HINTS_BACKGROUND |
RS_FILE_HINTS_NETWORK_WIDE;
}
std::list<std::string> srcIds; std::list<std::string> srcIds;
srcIds.push_back(id); srcIds.push_back(id);
@ -695,12 +698,10 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, std
* FileRequest will ignore request if file is already indexed. * FileRequest will ignore request if file is already indexed.
*/ */
//#ifdef CHANNEL_DEBUG #ifdef CHANNEL_DEBUG
std::cerr << "p3Channels::locked_eventDuplicateMsg() " << " Downloading: " << fname; std::cerr << "p3Channels::locked_eventDuplicateMsg() " << " Downloading: " << fname;
std::cerr << " to: " << localpath << " from: " << id << std::endl; std::cerr << " to: " << localpath << " from: " << id << std::endl;
//#endif #endif
if(size < MAX_AUTO_DL) if(size < MAX_AUTO_DL)
mRsFiles->FileRequest(fname, hash, size, mRsFiles->FileRequest(fname, hash, size,
@ -719,12 +720,6 @@ bool p3Channels::locked_eventNewMsg(GroupInfo *grp, RsDistribMsg *msg, std::stri
std::string msgId = msg->msgId; std::string msgId = msg->msgId;
std::string nullId; std::string nullId;
// std::cerr << "p3Channels::locked_eventNewMsg() ";
// std::cerr << " grpId: " << grpId;
// std::cerr << " msgId: " << msgId;
// std::cerr << " peerId: " << id;
// std::cerr << std::endl;
getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId); getPqiNotify()->AddFeedItem(RS_FEED_ITEM_CHAN_MSG, grpId, msgId, nullId);
/* request the files /* request the files
@ -742,10 +737,6 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
std::string msgId; std::string msgId;
std::string nullId; std::string nullId;
// std::cerr << "p3Channels::locked_notifyGroupChanged() ";
// std::cerr << grpId;
// std::cerr << " flags:" << flags;
// std::cerr << std::endl;
switch(flags) switch(flags)
{ {
@ -812,112 +803,6 @@ void p3Channels::locked_notifyGroupChanged(GroupInfo &grp, uint32_t flags)
return p3GroupDistrib::locked_notifyGroupChanged(grp, flags); return p3GroupDistrib::locked_notifyGroupChanged(grp, flags);
} }
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);
uint32_t timeLeft = 0;
std::list<ChannelMsgSummary> msgList;
std::list<ChannelMsgSummary>::iterator msg_it;
ChannelMsgInfo chMsgInfo;
if(!getChannelMsgList(chId, msgList))
return false;
for(msg_it = msgList.begin(); msg_it != msgList.end(); msg_it++){
if(!getChannelMessage(chId, msg_it->msgId, chMsgInfo))
continue;
// if msg not close to warning limit leave it alone
if((chMsgInfo.ts + CHANNEL_STOREPERIOD > (time_t)now + (time_t)limit) || (chMsgInfo.count < 1))
continue;
timeLeft = CHANNEL_STOREPERIOD - (now - chMsgInfo.ts);
warnings.insert(std::pair<std::string, uint32_t>(msg_it->msgId, timeLeft));
}
return true ;
}
void p3Channels::cleanUpOldFiles()
{
time_t now = time(NULL);
std::list<ChannelInfo> chList;
std::list<ChannelInfo>::iterator ch_it;
// first get channel list
if(!getChannelList(chList))
return;
std::list<ChannelMsgSummary> msgList;
std::list<ChannelMsgSummary>::iterator msg_it;
// then msg for each channel
for(ch_it = chList.begin(); ch_it != chList.end(); ch_it++){
// 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;
std::string localpath = mChannelsDir + "/" + channelname;
for(msg_it = msgList.begin(); msg_it != msgList.end(); msg_it++){
ChannelMsgInfo chMsgInfo;
if(!getChannelMessage(ch_it->channelId, msg_it->msgId, chMsgInfo))
continue;
// if msg not old, leave it alone
if( chMsgInfo.ts > (now - CHANNEL_STOREPERIOD))
continue;
std::list<FileInfo>::iterator file_it;
// get the files
for(file_it = chMsgInfo.files.begin(); file_it != chMsgInfo.files.end(); file_it++){
std::string msgFile = localpath + "/" + file_it->fname;
if(mRsFiles){
if(mRsFiles->ExtraFileRemove(file_it->hash, ~(RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_UPLOAD)))
std::cerr << "p3Channels::clearOldFIles() failed to remove files from extras" << std::endl;
if(remove(msgFile.c_str()) == 0){
std::cerr << "p3Channels::clearOldFiles() file removed: "
<< msgFile << std::endl;
}else{
std::cerr << "p3Channels::clearOldFiles() failed to remove file: "
<< msgFile << std::endl;
}
}else{
std::cerr << "p3Channels::cleanUpOldFiles() : Pointer passed to (this) Invalid" << std::endl;
}
}
}
}
// clean up local caches
//. clear_local_caches(now); //how about remote caches, remember its hardwired
return;
}
//TODO: if you want to config saving and loading for channel distrib service implement this method further //TODO: if you want to config saving and loading for channel distrib service implement this method further
bool p3Channels::childLoadList(std::list<RsItem* >& configSaves) bool p3Channels::childLoadList(std::list<RsItem* >& configSaves)
@ -949,114 +834,3 @@ std::list<RsItem *> p3Channels::childSaveList()
} }
/****************************************/ /****************************************/
#if 0
void p3Channels::loadDummyData()
{
ChannelInfo fi;
std::string channelId;
std::string msgId;
time_t now = time(NULL);
fi.channelId = "FID1234";
fi.channelName = L"Channel 1";
fi.channelDesc = L"Channel 1";
fi.channelFlags = RS_DISTRIB_ADMIN;
fi.pop = 2;
fi.lastPost = now - 123;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID2345";
fi.channelName = L"Channel 2";
fi.channelDesc = L"Channel 2";
fi.channelFlags = RS_DISTRIB_SUBSCRIBED;
fi.pop = 3;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
msgId = createChannelMsg(channelId, "", L"WELCOME TO Channel1", L"Hello!");
msgId = createChannelMsg(channelId, msgId, L"Love this channel", L"Hello2!");
return;
/* ignore this */
fi.channelId = "FID3456";
fi.channelName = L"Channel 3";
fi.channelDesc = L"Channel 3";
fi.channelFlags = 0;
fi.pop = 3;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID4567";
fi.channelName = L"Channel 4";
fi.channelDesc = L"Channel 4";
fi.channelFlags = 0;
fi.pop = 5;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID5678";
fi.channelName = L"Channel 5";
fi.channelDesc = L"Channel 5";
fi.channelFlags = 0;
fi.pop = 1;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID6789";
fi.channelName = L"Channel 6";
fi.channelDesc = L"Channel 6";
fi.channelFlags = 0;
fi.pop = 2;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID7890";
fi.channelName = L"Channel 7";
fi.channelDesc = L"Channel 7";
fi.channelFlags = 0;
fi.pop = 4;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID8901";
fi.channelName = L"Channel 8";
fi.channelDesc = L"Channel 8";
fi.channelFlags = 0;
fi.pop = 3;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID9012";
fi.channelName = L"Channel 9";
fi.channelDesc = L"Channel 9";
fi.channelFlags = 0;
fi.pop = 2;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
fi.channelId = "FID9123";
fi.channelName = L"Channel 10";
fi.channelDesc = L"Channel 10";
fi.channelFlags = 0;
fi.pop = 1;
fi.lastPost = now - 1234;
channelId = createChannel(fi.channelName, fi.channelDesc, fi.channelFlags);
mChannelsChanged = true;
}
#endif

View File

@ -79,7 +79,8 @@ virtual bool channelRestoreKeys(std::string chId);
virtual bool channelShareKeys(std::string chId, std::list<std::string>& peers); virtual bool channelShareKeys(std::string chId, std::list<std::string>& peers);
virtual bool channelEditInfo(std::string chId, ChannelInfo &ci); virtual bool channelEditInfo(std::string chId, ChannelInfo &ci);
virtual void getPubKeysAvailableGrpIds(std::list<std::string>& grpIds); virtual void getPubKeysAvailableGrpIds(std::list<std::string>& grpIds);
virtual bool getCleanUpList(std::map<std::string, uint32_t>& warnings,const std::string& chId, uint32_t limit);
/***************************************************************************************/ /***************************************************************************************/
/****************** Event Feedback (Overloaded form p3distrib) *************************/ /****************** Event Feedback (Overloaded form p3distrib) *************************/
/***************************************************************************************/ /***************************************************************************************/
@ -96,8 +97,7 @@ virtual bool locked_eventDuplicateMsg(GroupInfo *, RsDistribMsg *, std::string);
virtual RsSerialType *createSerialiser(); virtual RsSerialType *createSerialiser();
virtual bool locked_checkDistribMsg(RsDistribMsg *msg); virtual bool locked_checkDistribMsg(RsDistribMsg *msg);
virtual RsDistribGrp *locked_createPublicDistribGrp(GroupInfo &info);
virtual RsDistribGrp *locked_createPrivateDistribGrp(GroupInfo &info);
virtual bool childLoadList(std::list<RsItem* >& configSaves); virtual bool childLoadList(std::list<RsItem* >& configSaves);
virtual std::list<RsItem *> childSaveList(); virtual std::list<RsItem *> childSaveList();

View File

@ -893,7 +893,7 @@ std::cerr << "p3chatservice: sending requested status string for peer " << peer_
sendItem(cs); sendItem(cs);
} }
bool p3ChatService::loadList(std::list<RsItem*> load) bool p3ChatService::loadList(std::list<RsItem*>& load)
{ {
for(std::list<RsItem*>::const_iterator it(load.begin());it!=load.end();++it) for(std::list<RsItem*>::const_iterator it(load.begin());it!=load.end();++it)
{ {
@ -954,14 +954,12 @@ bool p3ChatService::loadList(std::list<RsItem*> load)
return true; return true;
} }
std::list<RsItem*> p3ChatService::saveList(bool& cleanup) bool p3ChatService::saveList(bool& cleanup, std::list<RsItem*>& list)
{ {
cleanup = true; cleanup = true;
/* now we create a pqistore, and stream all the msgs into it */ /* now we create a pqistore, and stream all the msgs into it */
std::list<RsItem*> list ;
if(_own_avatar != NULL) if(_own_avatar != NULL)
{ {
RsChatAvatarItem *ci = makeOwnAvatarItem() ; RsChatAvatarItem *ci = makeOwnAvatarItem() ;
@ -999,7 +997,7 @@ std::list<RsItem*> p3ChatService::saveList(bool& cleanup)
list.push_back(ci); list.push_back(ci);
} }
return list; return true;
} }
void p3ChatService::saveDone() void p3ChatService::saveDone()

View File

@ -157,9 +157,9 @@ class p3ChatService: public p3Service, public p3Config, public pqiMonitor
/*! /*!
* chat msg items and custom status are saved * chat msg items and custom status are saved
*/ */
virtual std::list<RsItem*> saveList(bool& cleanup) ; virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ;
virtual void saveDone(); virtual void saveDone();
virtual bool loadList(std::list<RsItem*> load) ; virtual bool loadList(std::list<RsItem*>& load) ;
private: private:
RsMutex mChatMtx; RsMutex mChatMtx;

View File

@ -1120,13 +1120,13 @@ RsSerialiser *p3disc::setupSerialiser()
return rss ; return rss ;
} }
std::list<RsItem*> p3disc::saveList(bool& cleanup) bool p3disc::saveList(bool& cleanup, std::list<RsItem*>& lst)
{ {
#ifdef P3DISC_DEBUG #ifdef P3DISC_DEBUG
std::cerr << "p3disc::saveList() called" << std::endl; std::cerr << "p3disc::saveList() called" << std::endl;
#endif #endif
cleanup = true ; cleanup = true ;
std::list<RsItem*> lst ;
// Now save config for network digging strategies // Now save config for network digging strategies
RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ; RsConfigKeyValueSet *vitem = new RsConfigKeyValueSet ;
@ -1144,10 +1144,10 @@ std::list<RsItem*> p3disc::saveList(bool& cleanup)
} }
lst.push_back(vitem); lst.push_back(vitem);
return lst ; return true ;
} }
bool p3disc::loadList(std::list<RsItem*> load) bool p3disc::loadList(std::list<RsItem*>& load)
{ {
#ifdef P3DISC_DEBUG #ifdef P3DISC_DEBUG
std::cerr << "p3disc::loadList() Item Count: " << load.size() << std::endl; std::cerr << "p3disc::loadList() Item Count: " << load.size() << std::endl;

View File

@ -102,8 +102,8 @@ virtual void setGPGOperation(AuthGPGOperation *operation);
/*********************** p3config ******************************/ /*********************** p3config ******************************/
/* Key Functions to be overloaded for Full Configuration */ /* Key Functions to be overloaded for Full Configuration */
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
/*****************************************************************/ /*****************************************************************/
private: private:

View File

@ -1299,9 +1299,8 @@ RsSerialiser *p3GroupDistrib::setupSerialiser()
return rss; return rss;
} }
std::list<RsItem *> p3GroupDistrib::saveList(bool &cleanup) bool p3GroupDistrib::saveList(bool &cleanup, std::list<RsItem *>& saveData)
{ {
std::list<RsItem *> saveData;
#ifdef DISTRIB_DEBUG #ifdef DISTRIB_DEBUG
std::cerr << "p3GroupDistrib::saveList()"; std::cerr << "p3GroupDistrib::saveList()";
@ -1471,7 +1470,7 @@ std::list<RsItem *> p3GroupDistrib::saveList(bool &cleanup)
delete childSer; delete childSer;
return saveData; return true;
} }
void p3GroupDistrib::saveDone() void p3GroupDistrib::saveDone()
@ -1489,7 +1488,7 @@ void p3GroupDistrib::saveDone()
distribMtx.unlock(); /****** MUTEX UNLOCKED *******/ distribMtx.unlock(); /****** MUTEX UNLOCKED *******/
} }
bool p3GroupDistrib::loadList(std::list<RsItem *> load) bool p3GroupDistrib::loadList(std::list<RsItem *>& load)
{ {
std::list<RsItem *>::iterator lit; std::list<RsItem *>::iterator lit;

View File

@ -428,9 +428,9 @@ class p3GroupDistrib: public CacheSource, public CacheStore, public p3Config, pu
protected: protected:
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>& saveList);
virtual void saveDone(); virtual void saveDone();
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
/*! /*!
* called by top class, child can use to save configs * called by top class, child can use to save configs

View File

@ -282,12 +282,9 @@ int p3MsgService::checkOutgoingMessages()
std::list<RsItem*> p3MsgService::saveList(bool& cleanup) bool p3MsgService::saveList(bool& cleanup, std::list<RsItem*>& itemList)
{ {
std::list<RsItem*> itemList;
std::map<uint32_t, RsMsgItem *>::iterator mit; std::map<uint32_t, RsMsgItem *>::iterator mit;
std::map<uint32_t, RsMsgTagType* >::iterator mit2; std::map<uint32_t, RsMsgTagType* >::iterator mit2;
std::map<uint32_t, RsMsgTags* >::iterator mit3; std::map<uint32_t, RsMsgTags* >::iterator mit3;
@ -319,7 +316,7 @@ std::list<RsItem*> p3MsgService::saveList(bool& cleanup)
for(mit4 = mParentId.begin(); mit4 != mParentId.end(); mit4++) for(mit4 = mParentId.begin(); mit4 != mParentId.end(); mit4++)
itemList.push_back(mit4->second); itemList.push_back(mit4->second);
return itemList; return true;
} }
void p3MsgService::saveDone() void p3MsgService::saveDone()
@ -376,7 +373,7 @@ void p3MsgService::initStandardTagTypes()
} }
} }
bool p3MsgService::loadList(std::list<RsItem*> load) bool p3MsgService::loadList(std::list<RsItem*>& load)
{ {
RsMsgItem *mitem; RsMsgItem *mitem;
RsMsgTagType* mtt; RsMsgTagType* mtt;

View File

@ -90,8 +90,8 @@ int status();
/*** Overloaded from p3Config ****/ /*** Overloaded from p3Config ****/
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem*> saveList(bool& cleanup); virtual bool saveList(bool& cleanup, std::list<RsItem*>&);
virtual bool loadList(std::list<RsItem*> load); virtual bool loadList(std::list<RsItem*>& load);
virtual void saveDone(); virtual void saveDone();
/*** Overloaded from p3Config ****/ /*** Overloaded from p3Config ****/

View File

@ -1260,9 +1260,8 @@ bool p3Ranking::addAnonToList(RsRankLinkMsg *msg)
return true; return true;
} }
std::list<RsItem *> p3Ranking::saveList(bool &cleanup) bool p3Ranking::saveList(bool &cleanup, std::list<RsItem *> & saveData)
{ {
std::list<RsItem *> saveData;
mRankMtx.lock(); /*********************** LOCK *******/ mRankMtx.lock(); /*********************** LOCK *******/
@ -1275,7 +1274,7 @@ std::list<RsItem *> p3Ranking::saveList(bool &cleanup)
} }
/* list completed! */ /* list completed! */
return saveData; return true;
} }
void p3Ranking::saveDone() void p3Ranking::saveDone()
@ -1284,7 +1283,7 @@ void p3Ranking::saveDone()
return; return;
} }
bool p3Ranking::loadList(std::list<RsItem *> load) bool p3Ranking::loadList(std::list<RsItem *>& load)
{ {
std::list<RsItem *>::iterator it; std::list<RsItem *>::iterator it;
RsRankLinkMsg *msg; RsRankLinkMsg *msg;

View File

@ -124,8 +124,8 @@ pqistore *createStore(std::string file, std::string src, bool reading);
bool addAnonToList(RsRankLinkMsg *msg); bool addAnonToList(RsRankLinkMsg *msg);
virtual RsSerialiser *setupSerialiser(); virtual RsSerialiser *setupSerialiser();
virtual std::list<RsItem *> saveList(bool &cleanup); virtual bool saveList(bool &cleanup, std::list<RsItem *>&);
virtual bool loadList(std::list<RsItem *> load); virtual bool loadList(std::list<RsItem *>& load);
virtual void saveDone(); virtual void saveDone();
private: private:

View File

@ -246,13 +246,13 @@ RsSerialiser* p3StatusService::setupSerialiser(){
return rss; return rss;
} }
std::list<RsItem*> p3StatusService::saveList(bool& cleanup){ bool p3StatusService::saveList(bool& cleanup, std::list<RsItem*>& ilist){
// save your status before quiting // save your status before quiting
cleanup = true; cleanup = true;
RsStatusItem* own_status = new RsStatusItem; RsStatusItem* own_status = new RsStatusItem;
StatusInfo own_info; StatusInfo own_info;
std::list<RsItem*> ilist;
std::map<std::string, StatusInfo>::iterator it; std::map<std::string, StatusInfo>::iterator it;
{ {
@ -263,7 +263,7 @@ std::list<RsItem*> p3StatusService::saveList(bool& cleanup){
std::cerr << "p3StatusService::saveList() :" << "Did not find your status" std::cerr << "p3StatusService::saveList() :" << "Did not find your status"
<< mConnMgr->getOwnId() << std::endl; << mConnMgr->getOwnId() << std::endl;
delete own_status; delete own_status;
return ilist; return false;
} }
own_info = it->second; own_info = it->second;
@ -275,10 +275,10 @@ std::list<RsItem*> p3StatusService::saveList(bool& cleanup){
ilist.push_back(own_status); ilist.push_back(own_status);
return ilist; return true;
} }
bool p3StatusService::loadList(std::list<RsItem*> load){ bool p3StatusService::loadList(std::list<RsItem*>& load){
// load your status from last rs session // load your status from last rs session
StatusInfo own_info; StatusInfo own_info;

View File

@ -79,12 +79,12 @@ virtual RsSerialiser *setupSerialiser();
/*! /*!
* This stores information on what your status was before you exited rs * This stores information on what your status was before you exited rs
*/ */
virtual std::list<RsItem*> saveList(bool& cleanup); virtual bool saveList(bool& cleanup, std::list<RsItem*>&);
/*! /*!
* @param load Should contain a single item which is clients status from last rs session * @param load Should contain a single item which is clients status from last rs session
*/ */
virtual bool loadList(std::list<RsItem*> load); virtual bool loadList(std::list<RsItem*>& load);
private: private:

View File

@ -472,13 +472,14 @@ RsSerialiser *p3turtle::setupSerialiser()
return rss ; return rss ;
} }
std::list<RsItem*> p3turtle::saveList(bool& cleanup)
bool p3turtle::saveList(bool& cleanup, std::list<RsItem*>& lst)
{ {
#ifdef P3TURTLE_DEBUG #ifdef P3TURTLE_DEBUG
std::cerr << "p3turtle: saving list..." << std::endl ; std::cerr << "p3turtle: saving list..." << std::endl ;
#endif #endif
cleanup = true ; cleanup = true ;
std::list<RsItem*> lst ; ;
#ifdef TO_REMOVE #ifdef TO_REMOVE
RsTurtleSearchResultItem *item = new RsTurtleSearchResultItem ; RsTurtleSearchResultItem *item = new RsTurtleSearchResultItem ;
item->PeerId("") ; item->PeerId("") ;
@ -497,7 +498,7 @@ std::list<RsItem*> p3turtle::saveList(bool& cleanup)
} }
lst.push_back(item) ; lst.push_back(item) ;
#endif #endif
return lst ; return true ;
} }
#ifdef TO_REMOVE #ifdef TO_REMOVE

View File

@ -260,8 +260,8 @@ class p3turtle: public p3Service, public pqiMonitor, public RsTurtle,/* public f
/************* from p3Config *******************/ /************* from p3Config *******************/
virtual RsSerialiser *setupSerialiser() ; virtual RsSerialiser *setupSerialiser() ;
virtual std::list<RsItem*> saveList(bool& cleanup) ; virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ;
virtual bool loadList(std::list<RsItem*> load) { return true; } virtual bool loadList(std::list<RsItem*>& load) { return true; }
/************* Communication with ftserver *******************/ /************* Communication with ftserver *******************/
/// Does the turtle router manages tunnels to this peer ? (this is not a /// Does the turtle router manages tunnels to this peer ? (this is not a

View File

@ -709,18 +709,10 @@ void ChannelFeed::updateChannelMsgs()
msgs.sort(sortChannelMsgSummary); msgs.sort(sortChannelMsgSummary);
/* set get warning list for channel */
std::map<std::string, uint32_t> warningList;
std::map<std::string, uint32_t>::iterator msgId_it;
rsChannels->getCleanUpList(warningList, mChannelId, WARNING_LIMIT);
for(it = msgs.begin(); it != msgs.end(); it++) { for(it = msgs.begin(); it != msgs.end(); it++) {
ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true); ChanMsgItem *cmi = new ChanMsgItem(this, 0, mChannelId, it->msgId, true);
msgId_it = warningList.find(it->msgId);
if(msgId_it != warningList.end())
cmi->setFileCleanUpWarning(msgId_it->second);
mChanMsgItems.push_back(cmi); mChanMsgItems.push_back(cmi);
verticalLayout_2->addWidget(cmi); verticalLayout_2->addWidget(cmi);