fixed flags conflicts

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-FileSharingPermissions@5758 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-11-02 13:52:29 +00:00
parent dc82cee700
commit e753f22909
43 changed files with 383 additions and 386 deletions

View File

@ -46,7 +46,7 @@
#include <fstream> #include <fstream>
//*********** //***********
//#define FIM_DEBUG 1 #define FIM_DEBUG 1
// ***********/ // ***********/
FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir) FileIndexMonitor::FileIndexMonitor(CacheStrapper *cs, NotifyBase *cb_in,std::string cachedir, std::string pid,const std::string& config_dir)
@ -267,7 +267,7 @@ FileIndexMonitor::~FileIndexMonitor()
/* Data cleanup - TODO */ /* Data cleanup - TODO */
} }
int FileIndexMonitor::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) int FileIndexMonitor::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id)
{ {
results.clear(); results.clear();
std::list<FileEntry *> firesults; std::list<FileEntry *> firesults;
@ -280,7 +280,7 @@ int FileIndexMonitor::SearchKeywords(std::list<std::string> keywords, std::list<
return filterResults(firesults,results,flags,peer_id) ; return filterResults(firesults,results,flags,peer_id) ;
} }
int FileIndexMonitor::SearchBoolExp(Expression *exp, std::list<DirDetails>& results,uint32_t flags,const std::string& peer_id) const int FileIndexMonitor::SearchBoolExp(Expression *exp, std::list<DirDetails>& results,FileSearchFlags flags,const std::string& peer_id) const
{ {
results.clear(); results.clear();
std::list<FileEntry *> firesults; std::list<FileEntry *> firesults;
@ -293,7 +293,7 @@ int FileIndexMonitor::SearchBoolExp(Expression *exp, std::list<DirDetails>& resu
return filterResults(firesults,results,flags,peer_id) ; return filterResults(firesults,results,flags,peer_id) ;
} }
int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<DirDetails>& results,TransferInfoFlags flags,const std::string& peer_id) const int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const std::string& peer_id) const
{ {
#ifdef DEBUG #ifdef DEBUG
if((flags & ~RS_FILE_HINTS_PERMISSION_MASK) > 0) if((flags & ~RS_FILE_HINTS_PERMISSION_MASK) > 0)
@ -304,14 +304,14 @@ int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<D
for(std::list<FileEntry*>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit) for(std::list<FileEntry*>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit)
{ {
DirDetails cdetails ; DirDetails cdetails ;
RequestDirDetails (*rit,cdetails,0); RequestDirDetails (*rit,cdetails,FileSearchFlags(0u));
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "Filtering candidate " << (*rit)->name << ", flags=" << cdetails.flags ; std::cerr << "Filtering candidate " << (*rit)->name << ", flags=" << cdetails.flags ;
#endif #endif
TransferInfoFlags permission_flags = rsPeers->computePeerPermissionFlags(peer_id,cdetails.flags,cdetails.parent_groups) ; FileSearchFlags permission_flags = rsPeers->computePeerPermissionFlags(peer_id,cdetails.flags,cdetails.parent_groups) ;
if (cdetails.type == DIR_TYPE_FILE && (( permission_flags & flags & RS_FILE_HINTS_PERMISSION_MASK) > 0 )) if (cdetails.type == DIR_TYPE_FILE && ( permission_flags & flags ))
{ {
cdetails.id = "Local"; cdetails.id = "Local";
results.push_back(cdetails); results.push_back(cdetails);
@ -327,7 +327,7 @@ int FileIndexMonitor::filterResults(std::list<FileEntry*>& firesults,std::list<D
return !results.empty() ; return !results.empty() ;
} }
bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t hint_flags, const std::string& peer_id,std::string &fullpath, uint64_t &size) const bool FileIndexMonitor::findLocalFile(std::string hash,FileSearchFlags hint_flags, const std::string& peer_id,std::string &fullpath, uint64_t &size) const
{ {
std::list<FileEntry *> results; std::list<FileEntry *> results;
bool ok = false; bool ok = false;
@ -354,12 +354,12 @@ bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t hint_flags, const
// turn share flags into hint flags // turn share flags into hint flags
uint32_t shflh = rsPeers->computePeerPermissionFlags(peer_id,share_flags,parent_groups) ; FileSearchFlags shflh = rsPeers->computePeerPermissionFlags(peer_id,share_flags,parent_groups) ;
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "FileIndexMonitor::findLocalFile: Filtering candidate " << fe->name << ", flags=" << share_flags << ", hint_flags=" << hint_flags << std::endl ; std::cerr << "FileIndexMonitor::findLocalFile: Filtering candidate " << fe->name << ", flags=" << share_flags << ", hint_flags=" << hint_flags << std::endl ;
#endif #endif
if(shflh & (hint_flags & RS_FILE_HINTS_PERMISSION_MASK)) if(shflh & hint_flags)
{ {
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "FileIndexMonitor::findLocalFile() Found Name: " << fe->name << std::endl; std::cerr << "FileIndexMonitor::findLocalFile() Found Name: " << fe->name << std::endl;
@ -533,13 +533,13 @@ void FileIndexMonitor::run()
updateCycle(); updateCycle();
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
{ // {
RsStackMutex mtx(fiMutex) ; // RsStackMutex mtx(fiMutex) ;
std::cerr <<"*********** FileIndex **************" << std::endl ; // std::cerr <<"*********** FileIndex **************" << std::endl ;
fi.printFileIndex(std::cerr) ; // fi.printFileIndex(std::cerr) ;
std::cerr <<"************** END *****************" << std::endl ; // std::cerr <<"************** END *****************" << std::endl ;
std::cerr << std::endl ; // std::cerr << std::endl ;
} // }
#endif #endif
} }
} }
@ -820,7 +820,7 @@ void FileIndexMonitor::updateCycle()
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
/* print out the new directory structure */ /* print out the new directory structure */
fi.printFileIndex(std::cerr); // fi.printFileIndex(std::cerr);
#endif #endif
/* now if we have changed things -> restore file/hash it/and /* now if we have changed things -> restore file/hash it/and
* tell the CacheSource * tell the CacheSource
@ -1012,8 +1012,6 @@ void FileIndexMonitor::locked_saveFileIndexes()
// //
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "FileIndexMonitor::updateCycle() FileIndex modified ... updating" << std::endl; std::cerr << "FileIndexMonitor::updateCycle() FileIndex modified ... updating" << std::endl;
std::cerr << "FileIndexMonitor::updateCycle() saving total file list to to: " << fname_total << std::endl ;
std::cerr << "FileIndexMonitor::updateCycle() saving browsable file list to: " << fname_browsable << std::endl ;
#endif #endif
// Make for each peer the list of forbidden shared directories. Make a separate cache file for each different set. // Make for each peer the list of forbidden shared directories. Make a separate cache file for each different set.
// To figure out which sets are different, we index them by the set of forbidden indexes from the directory list. // To figure out which sets are different, we index them by the set of forbidden indexes from the directory list.
@ -1027,13 +1025,14 @@ void FileIndexMonitor::locked_saveFileIndexes()
for(std::list<std::string>::const_iterator it(online_ids.begin());it!=online_ids.end();++it) for(std::list<std::string>::const_iterator it(online_ids.begin());it!=online_ids.end();++it)
{ {
std::cerr << "About to save, with the following restrictions:" << std::endl ; std::cerr << "About to save, with the following restrictions:" << std::endl ;
std::cerr << "Peer : " << *it << std::endl;
std::set<std::string> forbidden_dirs ; std::set<std::string> forbidden_dirs ;
for(std::map<std::string,SharedDirInfo>::const_iterator dit(directoryMap.begin());dit!=directoryMap.end();++dit) for(std::map<std::string,SharedDirInfo>::const_iterator dit(directoryMap.begin());dit!=directoryMap.end();++dit)
{ {
std::cerr << " dir=" << dit->first << " : " ; std::cerr << " dir=" << dit->first << " : " ;
uint32_t permission_flags = rsPeers->computePeerPermissionFlags(*it,dit->second.shareflags,dit->second.parent_groups) ; FileSearchFlags permission_flags = rsPeers->computePeerPermissionFlags(*it,dit->second.shareflags,dit->second.parent_groups) ;
if(!(permission_flags & RS_FILE_HINTS_BROWSABLE)) if(!(permission_flags & RS_FILE_HINTS_BROWSABLE))
{ {
@ -1083,8 +1082,7 @@ void FileIndexMonitor::locked_saveFileIndexes()
if(size > 0) if(size > 0)
{ {
#ifdef FIM_DEBUG #ifdef FIM_DEBUG
std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << calchash; std::cerr << "FileIndexMonitor::updateCycle() saved with hash:" << hash << std::endl;
std::cerr << std::endl;
#endif #endif
/* should clean up the previous cache.... */ /* should clean up the previous cache.... */
@ -1350,7 +1348,7 @@ uint32_t FileIndexMonitor::getType(void *ref) const
return fi.getType(ref) ; return fi.getType(ref) ;
} }
int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) const int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags) const
{ {
/* remove unused parameter warnings */ /* remove unused parameter warnings */
(void) flags; (void) flags;
@ -1390,7 +1388,7 @@ int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, uint32_t
details.hash = ""; details.hash = "";
details.path = "root"; details.path = "root";
details.age = 0; details.age = 0;
details.flags = 0; details.flags.clear() ;
details.min_age = 0 ; details.min_age = 0 ;
return true ; return true ;
@ -1415,7 +1413,7 @@ int FileIndexMonitor::RequestDirDetails(void *ref, DirDetails &details, uint32_t
void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<std::string>& parent_groups) const void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,FileStorageFlags& flags,std::list<std::string>& parent_groups) const
{ {
flags = 0 ; flags.clear() ;
static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ; static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
DirEntry *dir = dynamic_cast<DirEntry*>(file) ; DirEntry *dir = dynamic_cast<DirEntry*>(file) ;
@ -1437,7 +1435,8 @@ void FileIndexMonitor::locked_findShareFlagsAndParentGroups(FileEntry *file,File
std::cerr << "*********** ERROR *********** In " << __PRETTY_FUNCTION__ << std::endl ; std::cerr << "*********** ERROR *********** In " << __PRETTY_FUNCTION__ << std::endl ;
else else
{ {
flags = it->second.shareflags & PERMISSION_MASK ; flags = it->second.shareflags ;
flags &= PERMISSION_MASK ;
parent_groups = it->second.parent_groups ; parent_groups = it->second.parent_groups ;
} }
#ifdef FIM_DEBUG2 #ifdef FIM_DEBUG2

View File

@ -111,12 +111,12 @@ class FileIndexMonitor: public CacheSource, public RsThread
virtual ~FileIndexMonitor(); virtual ~FileIndexMonitor();
/* external interface for filetransfer */ /* external interface for filetransfer */
bool findLocalFile(std::string hash,uint32_t flags,const std::string& peer_id, std::string &fullpath, uint64_t &size) const; bool findLocalFile(std::string hash,FileSearchFlags flags,const std::string& peer_id, std::string &fullpath, uint64_t &size) const;
int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) ; int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id) ;
int SearchBoolExp(Expression *exp, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) const ; int SearchBoolExp(Expression *exp, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id) const ;
int filterResults(std::list<FileEntry*>& firesults,std::list<DirDetails>& results,TransferInfoFlags flags,const std::string& peer_id) const ; int filterResults(std::list<FileEntry*>& firesults,std::list<DirDetails>& results,FileSearchFlags flags,const std::string& peer_id) const ;
/* external interface for local access to files */ /* external interface for local access to files */
@ -136,7 +136,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
void updateCycle(); void updateCycle();
// Interface for browsing dir hirarchy // Interface for browsing dir hirarchy
int RequestDirDetails(void*, DirDetails&, uint32_t) const ; int RequestDirDetails(void*, DirDetails&, FileSearchFlags) const ;
uint32_t getType(void*) const ; uint32_t getType(void*) const ;
int RequestDirDetails(const std::string& path, DirDetails &details) const ; int RequestDirDetails(const std::string& path, DirDetails &details) const ;

View File

@ -1346,7 +1346,7 @@ bool FileIndex::extractData(void *ref,DirDetails& details)
details.ref = file; details.ref = file;
details.hash = file->hash; details.hash = file->hash;
details.age = now - file->modtime; details.age = now - file->modtime;
details.flags = 0;//file->pop; details.flags.clear() ;
/* find parent pointer, and row */ /* find parent pointer, and row */
details.parent = file->parent ; details.parent = file->parent ;

View File

@ -23,6 +23,7 @@
#include "dbase/fistore.h" #include "dbase/fistore.h"
#include "retroshare/rsexpr.h" #include "retroshare/rsexpr.h"
#include "retroshare/rsfiles.h"
#include "serialiser/rsserviceids.h" #include "serialiser/rsserviceids.h"
#include "pqi/p3peermgr.h" #include "pqi/p3peermgr.h"
@ -200,7 +201,7 @@ int FileIndexStore::RequestDirDetails(const std::string& uid, const std::string&
#endif #endif
} }
int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) const int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags) const
{ {
/* remove unused parameter warnings */ /* remove unused parameter warnings */
(void) flags; (void) flags;
@ -258,7 +259,7 @@ int FileIndexStore::RequestDirDetails(void *ref, DirDetails &details, uint32_t f
details.path = ""; details.path = "";
details.count = indices.size(); details.count = indices.size();
details.age = 0; details.age = 0;
details.flags = 0; details.flags.clear() ;
details.min_age = 0; details.min_age = 0;
unlockData(); unlockData();
@ -329,7 +330,7 @@ int FileIndexStore::SearchHash(std::string hash, std::list<FileDetail> &results)
} }
int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags) const int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags) const
{ {
lockData(); lockData();
std::map<RsPeerId, FileIndex *>::const_iterator pit; std::map<RsPeerId, FileIndex *>::const_iterator pit;
@ -341,7 +342,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
#ifdef FIS_DEBUG #ifdef FIS_DEBUG
std::cerr << "FileIndexStore::SearchKeywords()" << std::endl; std::cerr << "FileIndexStore::SearchKeywords()" << std::endl;
#endif #endif
if(flags & DIR_FLAGS_REMOTE) if(flags & RS_FILE_HINTS_REMOTE)
for(pit = indices.begin(); pit != indices.end(); pit++) for(pit = indices.begin(); pit != indices.end(); pit++)
{ {
firesults.clear(); firesults.clear();
@ -359,7 +360,7 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Di
} }
} }
if(flags & DIR_FLAGS_LOCAL) if(flags & RS_FILE_HINTS_LOCAL)
if (localindex) if (localindex)
{ {
firesults.clear(); firesults.clear();

View File

@ -75,7 +75,7 @@ virtual int loadCache(const CacheData &data); /* actual load, once data availa
int SearchHash(std::string hash, std::list<FileDetail> &results) const; int SearchHash(std::string hash, std::list<FileDetail> &results) const;
/* Search Interface - For Search Interface */ /* Search Interface - For Search Interface */
int SearchKeywords(std::list<std::string> terms, std::list<DirDetails> &results,uint32_t flags) const; int SearchKeywords(std::list<std::string> terms, std::list<DirDetails> &results,FileSearchFlags flags) const;
/* Search Interface - for Adv Search Interface */ /* Search Interface - for Adv Search Interface */
int searchBoolExp(Expression * exp, std::list<DirDetails> &results) const; int searchBoolExp(Expression * exp, std::list<DirDetails> &results) const;
@ -83,7 +83,7 @@ virtual int loadCache(const CacheData &data); /* actual load, once data availa
/* Search Interface - For Directory Access */ /* Search Interface - For Directory Access */
int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details) const; int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details) const;
int RequestDirDetails(void *ref, DirDetails &details, uint32_t flags) const; int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags) const;
uint32_t getType(void *ref) const ; uint32_t getType(void *ref) const ;
private: private:

View File

@ -83,7 +83,7 @@ ftFileControl::ftFileControl()
ftFileControl::ftFileControl(std::string fname, ftFileControl::ftFileControl(std::string fname,
std::string tmppath, std::string dest, std::string tmppath, std::string dest,
uint64_t size, std::string hash, uint32_t flags, uint64_t size, std::string hash, TransferRequestFlags flags,
ftFileCreator *fc, ftTransferModule *tm) ftFileCreator *fc, ftTransferModule *tm)
:mName(fname), mCurrentPath(tmppath), mDestination(dest), :mName(fname), mCurrentPath(tmppath), mDestination(dest),
mTransfer(tm), mCreator(fc), mState(DOWNLOADING), mHash(hash), mTransfer(tm), mCreator(fc), mState(DOWNLOADING), mHash(hash),
@ -127,7 +127,7 @@ bool ftController::getFileDownloadChunksDetails(const std::string& hash,FileChun
if(it != mDownloads.end()) if(it != mDownloads.end())
{ {
it->second->mCreator->getChunkMap(info) ; it->second->mCreator->getChunkMap(info) ;
info.flags = it->second->mFlags ; //info.flags = it->second->mFlags ;
return true ; return true ;
} }
@ -143,7 +143,7 @@ bool ftController::getFileDownloadChunksDetails(const std::string& hash,FileChun
info.file_size = it->second->mSize ; info.file_size = it->second->mSize ;
info.strategy = mDefaultChunkStrategy ; info.strategy = mDefaultChunkStrategy ;
info.chunk_size = ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ; info.chunk_size = ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ;
info.flags = it->second->mFlags ; //info.flags = it->second->mFlags ;
uint32_t nb_chunks = it->second->mSize/ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ; uint32_t nb_chunks = it->second->mSize/ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE ;
if(it->second->mSize % ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE != 0) if(it->second->mSize % ChunkMap::CHUNKMAP_FIXED_CHUNK_SIZE != 0)
++nb_chunks ; ++nb_chunks ;
@ -327,7 +327,7 @@ void ftController::cleanCacheDownloads()
RsStackMutex stack(ctrlMutex); /******* LOCKED ********/ RsStackMutex stack(ctrlMutex); /******* LOCKED ********/
for(std::map<std::string,ftFileControl*>::iterator it(mDownloads.begin());it!=mDownloads.end();++it) for(std::map<std::string,ftFileControl*>::iterator it(mDownloads.begin());it!=mDownloads.end();++it)
if (((it->second)->mFlags & RS_FILE_HINTS_CACHE) && it->second->mState != ftFileControl::DOWNLOADING) if (((it->second)->mFlags & RS_FILE_REQ_CACHE) && it->second->mState != ftFileControl::DOWNLOADING)
// check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER // check if a cache file is downloaded, if the case, timeout the transfer after TIMOUT_CACHE_FILE_TRANSFER
{ {
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
@ -429,7 +429,7 @@ void ftController::checkDownloadQueue()
for(uint32_t p=0;p<_queue.size();++p) for(uint32_t p=0;p<_queue.size();++p)
{ {
if(p < _min_prioritized_transfers) if(p < _min_prioritized_transfers)
if(_queue[p]->mFlags & RS_FILE_HINTS_CACHE) // cache file. add to potential move list if(_queue[p]->mFlags & RS_FILE_REQ_CACHE) // cache file. add to potential move list
to_move_before.push_back(p) ; to_move_before.push_back(p) ;
else else
++user_transfers ; // count one more user file in the prioritized range. ++user_transfers ; // count one more user file in the prioritized range.
@ -438,7 +438,7 @@ void ftController::checkDownloadQueue()
if(to_move_after.size() + user_transfers >= _min_prioritized_transfers) // we caught enough transfers to move back to the top of the queue. if(to_move_after.size() + user_transfers >= _min_prioritized_transfers) // we caught enough transfers to move back to the top of the queue.
break ; break ;
if(!(_queue[p]->mFlags & RS_FILE_HINTS_CACHE)) // non cache file. add to potential move list if(!(_queue[p]->mFlags & RS_FILE_REQ_CACHE)) // non cache file. add to potential move list
to_move_after.push_back(p) ; to_move_after.push_back(p) ;
} }
} }
@ -471,7 +471,7 @@ void ftController::locked_addToQueue(ftFileControl* ftfc,int add_strategy)
// This is costly, so only use this in case we really need it. // This is costly, so only use this in case we really need it.
// //
uint32_t pos =0; uint32_t pos =0;
while(pos < _queue.size() && (pos < _min_prioritized_transfers || (_queue[pos]->mFlags & RS_FILE_HINTS_CACHE)>0) ) while(pos < _queue.size() && (pos < _min_prioritized_transfers || (_queue[pos]->mFlags & RS_FILE_REQ_CACHE)>0) )
++pos ; ++pos ;
_queue.push_back(NULL) ; _queue.push_back(NULL) ;
@ -622,7 +622,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
_queue[pos]->mState = ftFileControl::DOWNLOADING ; _queue[pos]->mState = ftFileControl::DOWNLOADING ;
if(_queue[pos]->mFlags & RS_FILE_HINTS_ANONYMOUS_ROUTING) if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mTurtle->monitorFileTunnels(_queue[pos]->mName,_queue[pos]->mHash,_queue[pos]->mSize) ; mTurtle->monitorFileTunnels(_queue[pos]->mName,_queue[pos]->mHash,_queue[pos]->mSize) ;
} }
@ -631,7 +631,7 @@ void ftController::locked_checkQueueElement(uint32_t pos)
_queue[pos]->mState = ftFileControl::QUEUED ; _queue[pos]->mState = ftFileControl::QUEUED ;
_queue[pos]->mCreator->closeFile() ; _queue[pos]->mCreator->closeFile() ;
if(_queue[pos]->mFlags & RS_FILE_HINTS_ANONYMOUS_ROUTING) if(_queue[pos]->mFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mTurtle->stopMonitoringFileTunnels(_queue[pos]->mHash) ; mTurtle->stopMonitoringFileTunnels(_queue[pos]->mHash) ;
} }
} }
@ -766,8 +766,8 @@ bool ftController::completeFile(std::string hash)
uint64_t size = 0; uint64_t size = 0;
uint32_t state = 0; uint32_t state = 0;
uint32_t period = 0; uint32_t period = 0;
uint32_t flags = 0; TransferRequestFlags flags ;
uint32_t extraflags = 0; TransferRequestFlags extraflags ;
uint32_t completeCount = 0; uint32_t completeCount = 0;
{ {
@ -855,7 +855,7 @@ bool ftController::completeFile(std::string hash)
size = fc->mSize; size = fc->mSize;
state = fc->mState; state = fc->mState;
period = 30 * 24 * 3600; /* 30 days */ period = 30 * 24 * 3600; /* 30 days */
extraflags = 0; extraflags.clear() ;
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "CompleteFile(): size = " << size << std::endl ; std::cerr << "CompleteFile(): size = " << size << std::endl ;
@ -866,7 +866,7 @@ bool ftController::completeFile(std::string hash)
locked_queueRemove(it->second->mQueuePosition) ; locked_queueRemove(it->second->mQueuePosition) ;
/* switch map */ /* switch map */
if (!(fc->mFlags & RS_FILE_HINTS_CACHE)) /* clean up completed cache files automatically */ if (!(fc->mFlags & RS_FILE_REQ_CACHE)) /* clean up completed cache files automatically */
{ {
mCompleted[fc->mHash] = fc; mCompleted[fc->mHash] = fc;
completeCount = mCompleted.size(); completeCount = mCompleted.size();
@ -875,7 +875,7 @@ bool ftController::completeFile(std::string hash)
mDownloads.erase(it); mDownloads.erase(it);
if(flags & RS_FILE_HINTS_ANONYMOUS_ROUTING) if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mTurtle->stopMonitoringFileTunnels(hash_to_suppress) ; mTurtle->stopMonitoringFileTunnels(hash_to_suppress) ;
} /******* UNLOCKED ********/ } /******* UNLOCKED ********/
@ -887,13 +887,13 @@ bool ftController::completeFile(std::string hash)
/* If it has a callback - do it now */ /* If it has a callback - do it now */
if(flags & ( RS_FILE_HINTS_CACHE | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_MEDIA)) if(flags & ( RS_FILE_REQ_CACHE | RS_FILE_REQ_EXTRA))// | RS_FILE_HINTS_MEDIA))
{ {
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftController::completeFile() doing Callback, callbackflags:" << (flags & ( RS_FILE_HINTS_CACHE | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_MEDIA)) ; std::cerr << "ftController::completeFile() doing Callback, callbackflags:" << (flags & ( RS_FILE_HINTS_CACHE | RS_FILE_HINTS_EXTRA ));//| RS_FILE_HINTS_MEDIA)) ;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
if(flags & RS_FILE_HINTS_CACHE) if(flags & RS_FILE_REQ_CACHE)
{ {
/* callback */ /* callback */
if (state == ftFileControl::COMPLETED) if (state == ftFileControl::COMPLETED)
@ -915,7 +915,7 @@ bool ftController::completeFile(std::string hash)
} }
} }
if(flags & RS_FILE_HINTS_EXTRA) if(flags & RS_FILE_REQ_EXTRA)
{ {
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftController::completeFile() adding to ExtraList"; std::cerr << "ftController::completeFile() adding to ExtraList";
@ -925,13 +925,13 @@ bool ftController::completeFile(std::string hash)
mExtraList->addExtraFile(path, hash, size, period, extraflags); mExtraList->addExtraFile(path, hash, size, period, extraflags);
} }
if(flags & RS_FILE_HINTS_MEDIA) // if(flags & RS_FILE_HINTS_MEDIA)
{ // {
#ifdef CONTROL_DEBUG //#ifdef CONTROL_DEBUG
std::cerr << "ftController::completeFile() NULL MEDIA callback"; // std::cerr << "ftController::completeFile() NULL MEDIA callback";
std::cerr << std::endl; // std::cerr << std::endl;
#endif //#endif
} // }
} }
else else
{ {
@ -942,7 +942,7 @@ bool ftController::completeFile(std::string hash)
} }
/* Notify GUI */ /* Notify GUI */
if ((flags & RS_FILE_HINTS_CACHE) == 0) { if ((flags & RS_FILE_REQ_CACHE) == 0) {
pqiNotify *notify = getPqiNotify(); pqiNotify *notify = getPqiNotify();
if (notify) { if (notify) {
notify->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, ""); notify->AddPopupMessage(RS_POPUP_DOWNLOAD, hash, name, "");
@ -994,7 +994,7 @@ bool ftController::handleAPendingRequest()
std::cerr << "Requesting pending hash " << req.mHash << std::endl ; std::cerr << "Requesting pending hash " << req.mHash << std::endl ;
#endif #endif
FileRequest(req.mName, req.mHash, req.mSize, req.mDest, req.mFlags, req.mSrcIds); FileRequest(req.mName, req.mHash, req.mSize, req.mDest, TransferRequestFlags(req.mFlags), req.mSrcIds);
{ {
// See whether there is a pendign chunk map recorded for this hash. // See whether there is a pendign chunk map recorded for this hash.
@ -1043,14 +1043,14 @@ bool ftController::alreadyHaveFile(const std::string& hash, FileInfo &info)
return true ; return true ;
// check for file lists // check for file lists
if (mSearch->search(hash, DIR_FLAGS_PERMISSIONS_MASK | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info)) if (mSearch->search(hash, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info))
return true ; return true ;
return false ; return false ;
} }
bool ftController::FileRequest(const std::string& fname, const std::string& hash, bool ftController::FileRequest(const std::string& fname, const std::string& hash,
uint64_t size, const std::string& dest, TransferInfoFlags flags, uint64_t size, const std::string& dest, TransferRequestFlags flags,
const std::list<std::string> &_srcIds) const std::list<std::string> &_srcIds)
{ {
std::list<std::string> srcIds(_srcIds) ; std::list<std::string> srcIds(_srcIds) ;
@ -1129,7 +1129,7 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
#endif #endif
uint32_t rate = 0; uint32_t rate = 0;
if (flags & RS_FILE_HINTS_BACKGROUND) if (flags & RS_FILE_REQ_BACKGROUND)
rate = FT_CNTRL_SLOW_RATE; rate = FT_CNTRL_SLOW_RATE;
else else
rate = FT_CNTRL_STANDARD_RATE; rate = FT_CNTRL_STANDARD_RATE;
@ -1191,7 +1191,7 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
} }
} /******* UNLOCKED ********/ } /******* UNLOCKED ********/
if(!(flags & RS_FILE_HINTS_NO_SEARCH)) if(!(flags & RS_FILE_REQ_NO_SEARCH))
{ {
/* do a source search - for any extra sources */ /* do a source search - for any extra sources */
// add sources only in direct mode // add sources only in direct mode
@ -1242,10 +1242,10 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has
// We check that flags are consistent. // We check that flags are consistent.
if(flags & RS_FILE_HINTS_ANONYMOUS_ROUTING) if(flags & RS_FILE_REQ_ANONYMOUS_ROUTING)
mTurtle->monitorFileTunnels(fname,hash,size) ; mTurtle->monitorFileTunnels(fname,hash,size) ;
bool assume_availability = flags & RS_FILE_HINTS_CACHE ; // assume availability for cache files bool assume_availability = flags & RS_FILE_REQ_CACHE ; // assume availability for cache files
ftFileCreator *fc = new ftFileCreator(savepath, size, hash,assume_availability); ftFileCreator *fc = new ftFileCreator(savepath, size, hash,assume_availability);
ftTransferModule *tm = new ftTransferModule(fc, mDataplex,this); ftTransferModule *tm = new ftTransferModule(fc, mDataplex,this);
@ -1859,7 +1859,7 @@ bool ftController::RequestCacheFile(RsPeerId id, std::string path, std::string h
return false ; return false ;
} }
FileRequest(hash, hash, size, path, RS_FILE_HINTS_CACHE | RS_FILE_HINTS_NO_SEARCH, ids); FileRequest(hash, hash, size, path, RS_FILE_REQ_CACHE | RS_FILE_REQ_NO_SEARCH, ids);
return true; return true;
} }
@ -1959,7 +1959,7 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
/* ignore cache files. As this is small files, better download them again from scratch at restart.*/ /* ignore cache files. As this is small files, better download them again from scratch at restart.*/
if (fit->second->mFlags & RS_FILE_HINTS_CACHE) if (fit->second->mFlags & RS_FILE_REQ_CACHE)
{ {
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftcontroller::saveList(): Not saving (callback) file entry " << fit->second->mName << ", " << fit->second->mHash << ", " << fit->second->mSize << std::endl ; std::cerr << "ftcontroller::saveList(): Not saving (callback) file entry " << fit->second->mName << ", " << fit->second->mHash << ", " << fit->second->mSize << std::endl ;
@ -1983,7 +1983,7 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
rft->file.hash = fit->second->mHash; rft->file.hash = fit->second->mHash;
rft->file.filesize = fit->second->mSize; rft->file.filesize = fit->second->mSize;
RsDirUtil::removeTopDir(fit->second->mDestination, rft->file.path); /* remove fname */ RsDirUtil::removeTopDir(fit->second->mDestination, rft->file.path); /* remove fname */
rft->flags = fit->second->mFlags; rft->flags = fit->second->mFlags.toUInt32();
rft->state = fit->second->mState; rft->state = fit->second->mState;
fit->second->mTransfer->getFileSources(rft->allPeerIds.ids); fit->second->mTransfer->getFileSources(rft->allPeerIds.ids);
@ -2032,7 +2032,7 @@ bool ftController::saveList(bool &cleanup, std::list<RsItem *>& saveData)
rft->file.hash = pit->mHash; rft->file.hash = pit->mHash;
rft->file.filesize = pit->mSize; rft->file.filesize = pit->mSize;
RsDirUtil::removeTopDir(pit->mDest, rft->file.path); /* remove fname */ RsDirUtil::removeTopDir(pit->mDest, rft->file.path); /* remove fname */
rft->flags = pit->mFlags; rft->flags = pit->mFlags.toUInt32();
rft->allPeerIds.ids = pit->mSrcIds; rft->allPeerIds.ids = pit->mSrcIds;
} }
@ -2093,7 +2093,7 @@ bool ftController::loadList(std::list<RsItem *>& load)
#ifdef CONTROL_DEBUG #ifdef CONTROL_DEBUG
std::cerr << "ftController::loadList(): requesting " << rsft->file.name << ", " << rsft->file.hash << ", " << rsft->file.filesize << std::endl ; std::cerr << "ftController::loadList(): requesting " << rsft->file.name << ", " << rsft->file.hash << ", " << rsft->file.filesize << std::endl ;
#endif #endif
FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, rsft->flags, rsft->allPeerIds.ids); FileRequest(rsft->file.name, rsft->file.hash, rsft->file.filesize, rsft->file.path, TransferRequestFlags(rsft->flags), rsft->allPeerIds.ids);
{ {
RsStackMutex mtx(ctrlMutex) ; RsStackMutex mtx(ctrlMutex) ;

View File

@ -73,7 +73,7 @@ class ftFileControl
ftFileControl(); ftFileControl();
ftFileControl(std::string fname, std::string tmppath, std::string dest, ftFileControl(std::string fname, std::string tmppath, std::string dest,
uint64_t size, std::string hash, uint32_t flags, uint64_t size, std::string hash, TransferRequestFlags flags,
ftFileCreator *fc, ftTransferModule *tm); ftFileCreator *fc, ftTransferModule *tm);
std::string mName; std::string mName;
@ -84,7 +84,7 @@ class ftFileControl
uint32_t mState; uint32_t mState;
std::string mHash; std::string mHash;
uint64_t mSize; uint64_t mSize;
uint32_t mFlags; TransferRequestFlags mFlags;
time_t mCreateTime; time_t mCreateTime;
uint32_t mQueuePriority ; uint32_t mQueuePriority ;
uint32_t mQueuePosition ; uint32_t mQueuePosition ;
@ -94,7 +94,7 @@ class ftPendingRequest
{ {
public: public:
ftPendingRequest(const std::string& fname, const std::string& hash, ftPendingRequest(const std::string& fname, const std::string& hash,
uint64_t size, const std::string& dest, uint32_t flags, uint64_t size, const std::string& dest, TransferRequestFlags flags,
const std::list<std::string> &srcIds) const std::list<std::string> &srcIds)
: mName(fname), mHash(hash), mSize(size), : mName(fname), mHash(hash), mSize(size),
mDest(dest), mFlags(flags),mSrcIds(srcIds) { return; } mDest(dest), mFlags(flags),mSrcIds(srcIds) { return; }
@ -105,7 +105,7 @@ class ftPendingRequest
std::string mHash; std::string mHash;
uint64_t mSize; uint64_t mSize;
std::string mDest; std::string mDest;
uint32_t mFlags; TransferRequestFlags mFlags;
std::list<std::string> mSrcIds; std::list<std::string> mSrcIds;
}; };
@ -129,7 +129,7 @@ class ftController: public CacheTransfer, public RsThread, public pqiMonitor, pu
/***************************************************************/ /***************************************************************/
bool FileRequest(const std::string& fname, const std::string& hash, bool FileRequest(const std::string& fname, const std::string& hash,
uint64_t size, const std::string& dest, TransferInfoFlags flags, uint64_t size, const std::string& dest, TransferRequestFlags flags,
const std::list<std::string> &sourceIds); const std::list<std::string> &sourceIds);
/// Do we already have this file, either in download or in file lists ? /// Do we already have this file, either in download or in file lists ?

View File

@ -142,7 +142,7 @@ bool ftDataMultiplex::FileDownloads(std::list<std::string> &hashs)
} }
bool ftDataMultiplex::FileDetails(const std::string &hash, TransferInfoFlags hintsflag, FileInfo &info) bool ftDataMultiplex::FileDetails(const std::string &hash, FileSearchFlags hintsflag, FileInfo &info)
{ {
#ifdef MPLEX_DEBUG #ifdef MPLEX_DEBUG
std::cerr << "ftDataMultiplex::FileDetails("; std::cerr << "ftDataMultiplex::FileDetails(";
@ -1313,10 +1313,10 @@ bool ftDataMultiplex::handleSearchRequest(const std::string& peerId, const std::
*/ */
FileInfo info; FileInfo info;
uint32_t hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY ; FileSearchFlags hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY ;
if(rsTurtle->isTurtlePeer(peerId)) if(rsTurtle->isTurtlePeer(peerId))
hintflags |= RS_FILE_HINTS_ANONYMOUS_ROUTING ; hintflags |= RS_FILE_HINTS_NETWORK_WIDE ;
else else
hintflags |= RS_FILE_HINTS_CACHE ; hintflags |= RS_FILE_HINTS_CACHE ;

View File

@ -104,7 +104,7 @@ class ftDataMultiplex: public ftDataRecv, public RsQueueThread
/* get Details of File Transfers */ /* get Details of File Transfers */
bool FileUploads(std::list<std::string> &hashs); bool FileUploads(std::list<std::string> &hashs);
bool FileDownloads(std::list<std::string> &hashs); bool FileDownloads(std::list<std::string> &hashs);
bool FileDetails(const std::string &hash, TransferInfoFlags hintsflag, FileInfo &info); bool FileDetails(const std::string &hash, FileSearchFlags hintsflag, FileInfo &info);
void deleteUnusedServers() ; void deleteUnusedServers() ;
void handlePendingCrcRequests() ; void handlePendingCrcRequests() ;

View File

@ -37,7 +37,7 @@ ftFiStore::ftFiStore(CacheStrapper *cs, CacheTransfer *cft, NotifyBase *cb_in,p3
return; return;
} }
bool ftFiStore::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const bool ftFiStore::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{ {
/* could use hintflags to specify which bits of fileinfo to use additionally. /* could use hintflags to specify which bits of fileinfo to use additionally.
eg. hintflags & FT_SEARCH_PEER_ID, then only return matching peers + hash. eg. hintflags & FT_SEARCH_PEER_ID, then only return matching peers + hash.
@ -128,12 +128,12 @@ ftFiMonitor::ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cached
return; return;
} }
bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const bool ftFiMonitor::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{ {
std::cerr << "(EE) ********* ftFiMonitor expects a peer id in search()!" << std::endl; std::cerr << "(EE) ********* ftFiMonitor expects a peer id in search()!" << std::endl;
return false ; return false ;
} }
bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, const std::string& peer_id,FileInfo &info) const bool ftFiMonitor::search(const std::string &hash, FileSearchFlags hintflags, const std::string& peer_id,FileInfo &info) const
{ {
uint64_t fsize; uint64_t fsize;
std::string path; std::string path;
@ -147,7 +147,8 @@ bool ftFiMonitor::search(const std::string &hash, uint32_t hintflags, const std:
// Setup search flags according to hintflags. Originally flags was 0. I (cyril) don't know // Setup search flags according to hintflags. Originally flags was 0. I (cyril) don't know
// why we don't just pass hintflags there, so I tried to keep the idea. // why we don't just pass hintflags there, so I tried to keep the idea.
// //
uint32_t flags = hintflags & (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE); FileSearchFlags flags = hintflags ;
flags &= (RS_FILE_HINTS_BROWSABLE | RS_FILE_HINTS_NETWORK_WIDE);
if(findLocalFile(hash, flags,peer_id,path, fsize)) if(findLocalFile(hash, flags,peer_id,path, fsize))
{ {
@ -246,7 +247,7 @@ bool ftFiMonitor::saveList(bool &cleanup, std::list<RsItem *>& sList)
RsFileConfigItem *fi = new RsFileConfigItem(); RsFileConfigItem *fi = new RsFileConfigItem();
fi->file.path = (*it).filename ; fi->file.path = (*it).filename ;
fi->file.name = (*it).virtualname ; fi->file.name = (*it).virtualname ;
fi->flags = (*it).shareflags ; fi->flags = (*it).shareflags.toUInt32() ;
sList.push_back(fi); sList.push_back(fi);
} }
@ -293,7 +294,7 @@ 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?)
*/ */
static const uint32_t PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ; static const FileStorageFlags PERMISSION_MASK = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | DIR_FLAGS_NETWORK_WIDE_GROUPS ;
#ifdef DEBUG_ELIST #ifdef DEBUG_ELIST
std::cerr << "ftFiMonitor::loadList()"; std::cerr << "ftFiMonitor::loadList()";
@ -347,7 +348,8 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
SharedDirInfo info ; SharedDirInfo info ;
info.filename = RsDirUtil::convertPathToUnix(fi->file.path); info.filename = RsDirUtil::convertPathToUnix(fi->file.path);
info.virtualname = fi->file.name; info.virtualname = fi->file.name;
info.shareflags = fi->flags & PERMISSION_MASK ; info.shareflags = FileStorageFlags(fi->flags) ;
info.shareflags &= PERMISSION_MASK ;
dirList.push_back(info) ; dirList.push_back(info) ;
} }
@ -359,6 +361,11 @@ bool ftFiMonitor::loadList(std::list<RsItem *>& load)
void ftFiMonitor::updateShareFlags(const SharedDirInfo& info) void ftFiMonitor::updateShareFlags(const SharedDirInfo& info)
{ {
std::cerr << "Updating share flags:" << std::endl;
std::cerr << " Directory : " << info.filename << std::endl;
std::cerr << " Virtual : " << info.virtualname << std::endl;
std::cerr << " Flags : " << info.shareflags << std::endl;
FileIndexMonitor::updateShareFlags(info); FileIndexMonitor::updateShareFlags(info);
/* flag for config */ /* flag for config */
@ -382,7 +389,7 @@ ftCacheStrapper::ftCacheStrapper(p3LinkMgr *lm)
} }
/* overloaded search function */ /* overloaded search function */
bool ftCacheStrapper::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const bool ftCacheStrapper::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{ {
/* remove unused parameter warnings */ /* remove unused parameter warnings */
(void) hintflags; (void) hintflags;

View File

@ -52,7 +52,7 @@ class ftFiStore: public FileIndexStore, public ftSearch
RsPeerId ownid, std::string cachedir); RsPeerId ownid, std::string cachedir);
/* overloaded search function */ /* overloaded search function */
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
}; };
class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
@ -61,8 +61,8 @@ class ftFiMonitor: public FileIndexMonitor, public ftSearch, public p3Config
ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid,const std::string& config_dir); ftFiMonitor(CacheStrapper *cs,NotifyBase *cb_in, std::string cachedir, std::string pid,const std::string& config_dir);
/* overloaded search function */ /* overloaded search function */
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
virtual bool search(const std::string &hash, uint32_t hintflags, const std::string& peer_id, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, const std::string& peer_id, FileInfo &info) const;
/* overloaded set dirs enables config indication */ /* overloaded set dirs enables config indication */
virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirList); virtual void setSharedDirectories(const std::list<SharedDirInfo>& dirList);
@ -94,7 +94,7 @@ class ftCacheStrapper: public CacheStrapper, public ftSearch
ftCacheStrapper(p3LinkMgr *cm); ftCacheStrapper(p3LinkMgr *cm);
/* overloaded search function */ /* overloaded search function */
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
}; };

View File

@ -146,7 +146,7 @@ void ftExtraList::hashAFile()
**/ **/
bool ftExtraList::addExtraFile(std::string path, std::string hash, bool ftExtraList::addExtraFile(std::string path, std::string hash,
uint64_t size, uint32_t period, uint32_t flags) uint64_t size, uint32_t period, TransferRequestFlags flags)
{ {
#ifdef DEBUG_ELIST #ifdef DEBUG_ELIST
std::cerr << "ftExtraList::addExtraFile() path: " << path; std::cerr << "ftExtraList::addExtraFile() path: " << path;
@ -177,7 +177,7 @@ bool ftExtraList::addExtraFile(std::string path, std::string hash,
return true; return true;
} }
bool ftExtraList::removeExtraFile(std::string hash, uint32_t flags) bool ftExtraList::removeExtraFile(std::string hash, TransferRequestFlags flags)
{ {
/* remove unused parameter warnings */ /* remove unused parameter warnings */
(void) flags; (void) flags;
@ -273,12 +273,12 @@ bool ftExtraList::cleanupOldFiles()
} }
bool ftExtraList::cleanupEntry(std::string /*path*/, uint32_t flags) bool ftExtraList::cleanupEntry(std::string /*path*/, TransferRequestFlags flags)
{ {
if (flags & RS_FILE_CONFIG_CLEANUP_DELETE) // if (flags & RS_FILE_CONFIG_CLEANUP_DELETE)
{ // {
/* Delete the file? - not yet! */ // /* Delete the file? - not yet! */
} // }
return true; return true;
} }
@ -287,7 +287,7 @@ bool ftExtraList::cleanupEntry(std::string /*path*/, uint32_t flags)
* file is removed after period. * file is removed after period.
**/ **/
bool ftExtraList::hashExtraFile(std::string path, uint32_t period, uint32_t flags) bool ftExtraList::hashExtraFile(std::string path, uint32_t period, TransferRequestFlags flags)
{ {
#ifdef DEBUG_ELIST #ifdef DEBUG_ELIST
std::cerr << "ftExtraList::hashExtraFile() path: " << path; std::cerr << "ftExtraList::hashExtraFile() path: " << path;
@ -326,14 +326,14 @@ bool ftExtraList::hashExtraFileDone(std::string path, FileInfo &info)
} }
hash = it->second; hash = it->second;
} }
return search(hash, 0, info); return search(hash, FileSearchFlags(0), info);
} }
/*** /***
* Search Function - used by File Transfer * Search Function - used by File Transfer
* *
**/ **/
bool ftExtraList::search(const std::string &hash, uint32_t /*hintflags*/, FileInfo &info) const bool ftExtraList::search(const std::string &hash, FileSearchFlags /*hintflags*/, FileInfo &info) const
{ {
#ifdef DEBUG_ELIST #ifdef DEBUG_ELIST
@ -396,7 +396,7 @@ bool ftExtraList::saveList(bool &cleanup, std::list<RsItem *>& sList)
fi->file.hash = (it->second).info.hash; fi->file.hash = (it->second).info.hash;
fi->file.filesize = (it->second).info.size; fi->file.filesize = (it->second).info.size;
fi->file.age = (it->second).info.age; fi->file.age = (it->second).info.age;
fi->flags = (it->second).flags; fi->flags = (it->second).flags.toUInt32();
sList.push_back(fi); sList.push_back(fi);
} }
@ -444,7 +444,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
if (ts > (time_t)fi->file.age) if (ts > (time_t)fi->file.age)
{ {
/* to old */ /* to old */
cleanupEntry(fi->file.path, fi->flags); cleanupEntry(fi->file.path, TransferRequestFlags(fi->flags));
delete (*it); delete (*it);
continue ; continue ;
} }
@ -461,7 +461,7 @@ bool ftExtraList::loadList(std::list<RsItem *>& load)
details.info.hash = fi->file.hash; details.info.hash = fi->file.hash;
details.info.size = fi->file.filesize; details.info.size = fi->file.filesize;
details.info.age = fi->file.age; /* time that we remove it. */ details.info.age = fi->file.age; /* time that we remove it. */
details.flags = fi->flags; details.flags = TransferRequestFlags(fi->flags);
/* stick it in the available queue */ /* stick it in the available queue */
mFiles[details.info.hash] = details; mFiles[details.info.hash] = details;

View File

@ -70,14 +70,14 @@ class FileDetails
return; return;
} }
FileDetails(std::string path, uint32_t p, uint32_t f) FileDetails(std::string path, uint32_t p, TransferRequestFlags f)
{ {
info.path = path; info.path = path;
period = p; period = p;
flags = f; flags = f;
} }
FileDetails(FileInfo &i, uint32_t p, uint32_t f) FileDetails(FileInfo &i, uint32_t p, TransferRequestFlags f)
{ {
info = i; info = i;
period = p; period = p;
@ -96,7 +96,7 @@ class FileDetails
uint32_t start; uint32_t start;
uint32_t period; uint32_t period;
uint32_t flags; TransferRequestFlags flags;
}; };
const uint32_t FT_DETAILS_CLEANUP = 0x0100; /* remove when it expires */ const uint32_t FT_DETAILS_CLEANUP = 0x0100; /* remove when it expires */
@ -118,9 +118,9 @@ class ftExtraList: public RsThread, public p3Config, public ftSearch
**/ **/
bool addExtraFile(std::string path, std::string hash, bool addExtraFile(std::string path, std::string hash,
uint64_t size, uint32_t period, uint32_t flags); uint64_t size, uint32_t period, TransferRequestFlags flags);
bool removeExtraFile(std::string hash, uint32_t flags); bool removeExtraFile(std::string hash, TransferRequestFlags flags);
bool moveExtraFile(std::string fname, std::string hash, uint64_t size, bool moveExtraFile(std::string fname, std::string hash, uint64_t size,
std::string destpath); std::string destpath);
@ -130,7 +130,7 @@ bool moveExtraFile(std::string fname, std::string hash, uint64_t size,
* file is removed after period. * file is removed after period.
**/ **/
bool hashExtraFile(std::string path, uint32_t period, uint32_t flags); bool hashExtraFile(std::string path, uint32_t period, TransferRequestFlags flags);
bool hashExtraFileDone(std::string path, FileInfo &info); bool hashExtraFileDone(std::string path, FileInfo &info);
/*** /***
@ -138,7 +138,7 @@ bool hashExtraFileDone(std::string path, FileInfo &info);
* implementation of ftSearch. * implementation of ftSearch.
* *
**/ **/
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
/*** /***
* Thread Main Loop * Thread Main Loop
@ -159,7 +159,7 @@ virtual bool loadList(std::list<RsItem *>& load);
/* Worker Functions */ /* Worker Functions */
void hashAFile(); void hashAFile();
bool cleanupOldFiles(); bool cleanupOldFiles();
bool cleanupEntry(std::string path, uint32_t flags); bool cleanupEntry(std::string path, TransferRequestFlags flags);
mutable RsMutex extMutex; mutable RsMutex extMutex;

View File

@ -39,9 +39,9 @@ ftFileSearch::ftFileSearch()
} }
} }
bool ftFileSearch::addSearchMode(ftSearch *search, uint32_t hintflags) bool ftFileSearch::addSearchMode(ftSearch *search, FileSearchFlags hintflags)
{ {
hintflags &= 0x00ffffff; hintflags &= FileSearchFlags(0x000000ff);
#ifdef DEBUG_SEARCH #ifdef DEBUG_SEARCH
std::cerr << "ftFileSearch::addSearchMode() : " << hintflags; std::cerr << "ftFileSearch::addSearchMode() : " << hintflags;
@ -51,7 +51,7 @@ bool ftFileSearch::addSearchMode(ftSearch *search, uint32_t hintflags)
uint32_t i; uint32_t i;
for (i = 0; i < MAX_SEARCHS; i++) for (i = 0; i < MAX_SEARCHS; i++)
{ {
uint32_t hints = hintflags >> i; uint32_t hints = hintflags.toUInt32() >> i;
if (hints & 0x0001) if (hints & 0x0001)
{ {
/* has the flag */ /* has the flag */
@ -75,7 +75,7 @@ bool ftFileSearch::addSearchMode(ftSearch *search, uint32_t hintflags)
return false; return false;
} }
bool ftFileSearch::search(const std::string &hash, uint32_t hintflags, FileInfo &info) const bool ftFileSearch::search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const
{ {
uint32_t hints, i; uint32_t hints, i;
@ -87,7 +87,7 @@ bool ftFileSearch::search(const std::string &hash, uint32_t hintflags, FileInfo
for (i = 0; i < MAX_SEARCHS; i++) for (i = 0; i < MAX_SEARCHS; i++)
{ {
hints = hintflags >> i; hints = hintflags.toUInt32() >> i;
if (hints & 0x0001) if (hints & 0x0001)
{ {
/* has the flag */ /* has the flag */
@ -140,7 +140,7 @@ bool ftFileSearch::search(const std::string &hash, uint32_t hintflags, FileInfo
*/ */
for (i = 0; i < MAX_SEARCHS; i++) for (i = 0; i < MAX_SEARCHS; i++)
{ {
hints = hintflags >> i; hints = hintflags.toUInt32() >> i;
if (hints & 0x0001) if (hints & 0x0001)
{ {
continue; continue;
@ -180,7 +180,7 @@ bool ftFileSearch::search(const std::string &hash, uint32_t hintflags, FileInfo
} }
bool ftSearchDummy::search(std::string /*hash*/, uint32_t hintflags, FileInfo &/*info*/) const bool ftSearchDummy::search(std::string /*hash*/, FileSearchFlags hintflags, FileInfo &/*info*/) const
{ {
/* remove unused parameter warnings */ /* remove unused parameter warnings */
(void) hintflags; (void) hintflags;

View File

@ -44,8 +44,8 @@ class ftFileSearch: public ftSearch
ftFileSearch(); ftFileSearch();
bool addSearchMode(ftSearch *search, uint32_t hintflags); bool addSearchMode(ftSearch *search, FileSearchFlags hintflags);
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const;
private: private:

View File

@ -42,12 +42,12 @@ class ftSearch
public: public:
ftSearch() { return; } ftSearch() { return; }
virtual ~ftSearch() { return; } virtual ~ftSearch() { return; }
virtual bool search(const std::string &hash, uint32_t hintflags,const std::string& peer_id, FileInfo &info) const virtual bool search(const std::string &hash, FileSearchFlags hintflags,const std::string& peer_id, FileInfo &info) const
{ {
std::cerr << "Non overloaded search method called!!!" << std::endl; std::cerr << "Non overloaded search method called!!!" << std::endl;
return false; return false;
} }
virtual bool search(const std::string &hash, uint32_t hintflags, FileInfo &info) const = 0; virtual bool search(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) const = 0;
}; };
@ -58,7 +58,7 @@ class ftSearchDummy: public ftSearch
ftSearchDummy() { return; } ftSearchDummy() { return; }
virtual ~ftSearchDummy() { return; } virtual ~ftSearchDummy() { return; }
virtual bool search(std::string hash, uint32_t hintflags, FileInfo &info) const; virtual bool search(std::string hash, FileSearchFlags hintflags, FileInfo &info) const;
}; };
#endif #endif

View File

@ -270,7 +270,7 @@ bool ftServer::alreadyHaveFile(const std::string& hash, FileInfo &info)
return mFtController->alreadyHaveFile(hash, info); return mFtController->alreadyHaveFile(hash, info);
} }
bool ftServer::FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferInfoFlags flags, const std::list<std::string>& srcIds) bool ftServer::FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<std::string>& srcIds)
{ {
std::string error_string ; std::string error_string ;
@ -415,7 +415,7 @@ bool ftServer::FileUploads(std::list<std::string> &hashs)
return mFtDataplex->FileUploads(hashs); return mFtDataplex->FileUploads(hashs);
} }
bool ftServer::FileDetails(const std::string &hash, TransferInfoFlags hintflags, FileInfo &info) bool ftServer::FileDetails(const std::string &hash, FileSearchFlags hintflags, FileInfo &info)
{ {
if (hintflags & RS_FILE_HINTS_DOWNLOAD) if (hintflags & RS_FILE_HINTS_DOWNLOAD)
if(mFtController->FileDetails(hash, info)) if(mFtController->FileDetails(hash, info))
@ -429,7 +429,7 @@ bool ftServer::FileDetails(const std::string &hash, TransferInfoFlags hintflags,
// file, we skip the call to fileDetails() for efficiency reasons. // file, we skip the call to fileDetails() for efficiency reasons.
// //
FileInfo info2 ; FileInfo info2 ;
if( (!(info.transfer_info_flags & RS_FILE_HINTS_CACHE)) && mFtController->FileDetails(hash, info2)) if( (!(info.transfer_info_flags & RS_FILE_REQ_CACHE)) && mFtController->FileDetails(hash, info2))
info.fname = info2.fname ; info.fname = info2.fname ;
return true ; return true ;
@ -447,17 +447,17 @@ bool ftServer::FileDetails(const std::string &hash, TransferInfoFlags hintflags,
/***************************************************************/ /***************************************************************/
bool ftServer::ExtraFileAdd(std::string fname, std::string hash, uint64_t size, bool ftServer::ExtraFileAdd(std::string fname, std::string hash, uint64_t size,
uint32_t period, TransferInfoFlags flags) uint32_t period, TransferRequestFlags flags)
{ {
return mFtExtra->addExtraFile(fname, hash, size, period, flags); return mFtExtra->addExtraFile(fname, hash, size, period, flags);
} }
bool ftServer::ExtraFileRemove(std::string hash, TransferInfoFlags flags) bool ftServer::ExtraFileRemove(std::string hash, TransferRequestFlags flags)
{ {
return mFtExtra->removeExtraFile(hash, flags); return mFtExtra->removeExtraFile(hash, flags);
} }
bool ftServer::ExtraFileHash(std::string localpath, uint32_t period, TransferInfoFlags flags) bool ftServer::ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags)
{ {
return mFtExtra->hashExtraFile(localpath, period, flags); return mFtExtra->hashExtraFile(localpath, period, flags);
} }
@ -497,7 +497,7 @@ int ftServer::RequestDirDetails(const std::string& uid, const std::string& path,
return mFiStore->RequestDirDetails(uid, path, details); return mFiStore->RequestDirDetails(uid, path, details);
} }
int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileStorageFlags flags) int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::RequestDirDetails(ref:" << ref; std::cerr << "ftServer::RequestDirDetails(ref:" << ref;
@ -516,7 +516,7 @@ int ftServer::RequestDirDetails(void *ref, DirDetails &details, FileStorageFlags
else else
return mFiStore->RequestDirDetails(ref, details, flags); return mFiStore->RequestDirDetails(ref, details, flags);
} }
uint32_t ftServer::getType(void *ref, TransferInfoFlags flags) uint32_t ftServer::getType(void *ref, FileSearchFlags flags)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::RequestDirDetails(ref:" << ref; std::cerr << "ftServer::RequestDirDetails(ref:" << ref;
@ -540,12 +540,12 @@ uint32_t ftServer::getType(void *ref, TransferInfoFlags flags)
/***************************************************************/ /***************************************************************/
int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags) int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags)
{ {
std::cerr << "(WW) ********* ftServer::SearchBoolExp:: called without peer id" << std::endl; std::cerr << "(WW) ********* ftServer::SearchBoolExp:: called without peer id" << std::endl;
return 0 ; return 0 ;
} }
int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id)
{ {
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer::SearchKeywords()"; std::cerr << "ftServer::SearchKeywords()";
@ -564,12 +564,12 @@ int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<DirDetai
return mFiStore->SearchKeywords(keywords, results,flags); return mFiStore->SearchKeywords(keywords, results,flags);
} }
int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags) int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags)
{ {
std::cerr << "(WW) ********* ftServer::SearchBoolExp:: called without peer id" << std::endl; std::cerr << "(WW) ********* ftServer::SearchBoolExp:: called without peer id" << std::endl;
return 0 ; return 0 ;
} }
int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) int ftServer::SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id)
{ {
if(flags & RS_FILE_HINTS_LOCAL) if(flags & RS_FILE_HINTS_LOCAL)
return mFiMon->SearchBoolExp(exp,results,flags,peer_id) ; return mFiMon->SearchBoolExp(exp,results,flags,peer_id) ;

View File

@ -125,7 +125,7 @@ ftController *getController() const { return mFtController ; }
* Control of Downloads * Control of Downloads
***/ ***/
virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info); virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info);
virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferInfoFlags flags, const std::list<std::string>& srcIds); virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<std::string>& srcIds);
virtual bool FileCancel(const std::string& hash); virtual bool FileCancel(const std::string& hash);
virtual bool FileControl(const std::string& hash, uint32_t flags); virtual bool FileControl(const std::string& hash, uint32_t flags);
virtual bool FileClearCompleted(); virtual bool FileClearCompleted();
@ -154,7 +154,7 @@ virtual bool clearDownload(const std::string hash);
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs); virtual bool FileDownloads(std::list<std::string> &hashs);
virtual bool FileUploads(std::list<std::string> &hashs); virtual bool FileUploads(std::list<std::string> &hashs);
virtual bool FileDetails(const std::string &hash, TransferInfoFlags hintflags, FileInfo &info); virtual bool FileDetails(const std::string &hash, FileSearchFlags hintflags, FileInfo &info);
virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) ; virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) ;
virtual bool FileUploadChunksDetails(const std::string& hash,const std::string& peer_id,CompressedChunkMap& map) ; virtual bool FileUploadChunksDetails(const std::string& hash,const std::string& peer_id,CompressedChunkMap& map) ;
@ -162,9 +162,9 @@ virtual bool FileUploadChunksDetails(const std::string& hash,const std::string&
/*** /***
* Extra List Access * Extra List Access
***/ ***/
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferInfoFlags flags); virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferRequestFlags flags);
virtual bool ExtraFileRemove(std::string hash, TransferInfoFlags flags); virtual bool ExtraFileRemove(std::string hash, TransferRequestFlags flags);
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferInfoFlags flags); virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags);
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info); virtual bool ExtraFileStatus(std::string localpath, FileInfo &info);
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, std::string destpath); virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, std::string destpath);
@ -173,13 +173,13 @@ virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, s
* Directory Listing / Search Interface * Directory Listing / Search Interface
***/ ***/
virtual int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details); virtual int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details);
virtual int RequestDirDetails(void *ref, DirDetails &details, FileStorageFlags flags); virtual int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags);
virtual uint32_t getType(void *ref,TransferInfoFlags flags) ; virtual uint32_t getType(void *ref,FileSearchFlags flags) ;
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags); virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags);
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id); virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id);
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags); virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags);
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id); virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id);
/*** /***
* Utility Functions * Utility Functions

View File

@ -65,24 +65,27 @@ const uint32_t RS_FILE_PEER_OFFLINE = 0x00002000;
// Flags used when requesting info about transfers, mostly to filter out the result. // Flags used when requesting info about transfers, mostly to filter out the result.
// //
const TransferInfoFlags RS_FILE_HINTS_CACHE = 0x00000001; const FileSearchFlags RS_FILE_HINTS_CACHE ( 0x00000001 );
const TransferInfoFlags RS_FILE_HINTS_EXTRA = 0x00000002; const FileSearchFlags RS_FILE_HINTS_EXTRA ( 0x00000002 );
const TransferInfoFlags RS_FILE_HINTS_LOCAL = 0x00000004; const FileSearchFlags RS_FILE_HINTS_LOCAL ( 0x00000004 );
const TransferInfoFlags RS_FILE_HINTS_REMOTE = 0x00000008; const FileSearchFlags RS_FILE_HINTS_REMOTE ( 0x00000008 );
const TransferInfoFlags RS_FILE_HINTS_DOWNLOAD = 0x00000010; const FileSearchFlags RS_FILE_HINTS_DOWNLOAD ( 0x00000010 );
const TransferInfoFlags RS_FILE_HINTS_UPLOAD = 0x00000020; const FileSearchFlags RS_FILE_HINTS_UPLOAD ( 0x00000020 );
const TransferInfoFlags RS_FILE_HINTS_NETWORK_WIDE = 0x00000080;// anonymously shared over network const FileSearchFlags RS_FILE_HINTS_SPEC_ONLY ( 0x01000000 );
const TransferInfoFlags RS_FILE_HINTS_BROWSABLE = 0x00000100;// browsable by friends
const TransferInfoFlags RS_FILE_HINTS_PERMISSION_MASK = 0x00000180;// OR of the last two flags. Used to filter out. const FileSearchFlags RS_FILE_HINTS_NETWORK_WIDE ( 0x00000080 );// anonymously shared over network
const FileSearchFlags RS_FILE_HINTS_BROWSABLE ( 0x00000100 );// browsable by friends
const FileSearchFlags RS_FILE_HINTS_PERMISSION_MASK ( 0x00000180 );// OR of the last two flags. Used to filter out.
// Flags used when requesting a transfer // Flags used when requesting a transfer
// //
const TransferInfoFlags RS_FILE_HINTS_ANONYMOUS_ROUTING = 0x00000040; // Use to ask turtle router to download the file. const TransferRequestFlags RS_FILE_REQ_ANONYMOUS_ROUTING ( 0x00000040 ); // Use to ask turtle router to download the file.
const TransferInfoFlags RS_FILE_HINTS_ASSUME_AVAILABILITY = 0x00000200; // Assume full source availability. Used for cache files. const TransferRequestFlags RS_FILE_REQ_ASSUME_AVAILABILITY ( 0x00000200 ); // Assume full source availability. Used for cache files.
const TransferInfoFlags RS_FILE_HINTS_MEDIA = 0x00001000; const TransferRequestFlags RS_FILE_REQ_CACHE ( 0x00000400 ); // Assume full source availability. Used for cache files.
const TransferInfoFlags RS_FILE_HINTS_BACKGROUND = 0x00002000; // To download slowly. const TransferRequestFlags RS_FILE_REQ_EXTRA ( 0x00000800 );
const TransferInfoFlags RS_FILE_HINTS_SPEC_ONLY = 0x01000000; const TransferRequestFlags RS_FILE_REQ_MEDIA ( 0x00001000 );
const TransferInfoFlags RS_FILE_HINTS_NO_SEARCH = 0x02000000; // disable searching for potential direct sources. const TransferRequestFlags RS_FILE_REQ_BACKGROUND ( 0x00002000 ); // To download slowly.
const TransferRequestFlags RS_FILE_REQ_NO_SEARCH ( 0x02000000 ); // disable searching for potential direct sources.
// const uint32_t RS_FILE_HINTS_SHARE_FLAGS_MASK = RS_FILE_HINTS_NETWORK_WIDE_OTHERS | RS_FILE_HINTS_BROWSABLE_OTHERS // const uint32_t RS_FILE_HINTS_SHARE_FLAGS_MASK = RS_FILE_HINTS_NETWORK_WIDE_OTHERS | RS_FILE_HINTS_BROWSABLE_OTHERS
// | RS_FILE_HINTS_NETWORK_WIDE_GROUPS | RS_FILE_HINTS_BROWSABLE_GROUPS ; // | RS_FILE_HINTS_NETWORK_WIDE_GROUPS | RS_FILE_HINTS_BROWSABLE_GROUPS ;
@ -95,7 +98,7 @@ struct SharedDirInfo
{ {
std::string filename ; std::string filename ;
std::string virtualname ; std::string virtualname ;
uint32_t shareflags ; // RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE FileStorageFlags shareflags ; // DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_GROUPS | ...
std::list<std::string> parent_groups ; std::list<std::string> parent_groups ;
}; };
@ -116,7 +119,7 @@ class RsFiles
virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info) = 0; virtual bool alreadyHaveFile(const std::string& hash, FileInfo &info) = 0;
/// Returns false is we already have the file. Otherwise, initiates the dl and returns true. /// Returns false is we already have the file. Otherwise, initiates the dl and returns true.
virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferInfoFlags flags, const std::list<std::string>& srcIds) = 0; virtual bool FileRequest(const std::string& fname, const std::string& hash, uint64_t size, const std::string& dest, TransferRequestFlags flags, const std::list<std::string>& srcIds) = 0;
virtual bool FileCancel(const std::string& hash) = 0; virtual bool FileCancel(const std::string& hash) = 0;
virtual bool setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStrategy) = 0; virtual bool setChunkStrategy(const std::string& hash,FileChunksInfo::ChunkStrategy) = 0;
virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) = 0; virtual void setDefaultChunkStrategy(FileChunksInfo::ChunkStrategy) = 0;
@ -144,7 +147,7 @@ class RsFiles
***/ ***/
virtual bool FileDownloads(std::list<std::string> &hashs) = 0; virtual bool FileDownloads(std::list<std::string> &hashs) = 0;
virtual bool FileUploads(std::list<std::string> &hashs) = 0; virtual bool FileUploads(std::list<std::string> &hashs) = 0;
virtual bool FileDetails(const std::string &hash, TransferInfoFlags hintflags, FileInfo &info) = 0; virtual bool FileDetails(const std::string &hash, FileSearchFlags hintflags, FileInfo &info) = 0;
/// Gives chunk details about the downloaded file with given hash. /// Gives chunk details about the downloaded file with given hash.
virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) = 0 ; virtual bool FileDownloadChunksDetails(const std::string& hash,FileChunksInfo& info) = 0 ;
@ -155,9 +158,9 @@ class RsFiles
/*** /***
* Extra List Access * Extra List Access
***/ ***/
virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferInfoFlags flags) = 0; virtual bool ExtraFileAdd(std::string fname, std::string hash, uint64_t size, uint32_t period, TransferRequestFlags flags) = 0;
virtual bool ExtraFileRemove(std::string hash, TransferInfoFlags flags) = 0; virtual bool ExtraFileRemove(std::string hash, TransferRequestFlags flags) = 0;
virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferInfoFlags flags) = 0; virtual bool ExtraFileHash(std::string localpath, uint32_t period, TransferRequestFlags flags) = 0;
virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0; virtual bool ExtraFileStatus(std::string localpath, FileInfo &info) = 0;
virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size, virtual bool ExtraFileMove(std::string fname, std::string hash, uint64_t size,
std::string destpath) = 0; std::string destpath) = 0;
@ -168,14 +171,13 @@ class RsFiles
* Directory Listing / Search Interface * Directory Listing / Search Interface
*/ */
virtual int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details) = 0; virtual int RequestDirDetails(const std::string& uid, const std::string& path, DirDetails &details) = 0;
virtual int RequestDirDetails(void *ref, DirDetails &details, FileSearchFlags flags) = 0;
virtual uint32_t getType(void *ref,FileSearchFlags flags) = 0;
virtual int RequestDirDetails(void *ref, DirDetails &details, FileStorageFlags flags) = 0; virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags) = 0;
virtual uint32_t getType(void *ref,TransferInfoFlags flags) = 0; virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id) = 0;
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags) = 0;
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags) = 0; virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,FileSearchFlags flags,const std::string& peer_id) = 0;
virtual int SearchKeywords(std::list<std::string> keywords, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) = 0;
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags) = 0;
virtual int SearchBoolExp(Expression * exp, std::list<DirDetails> &results,uint32_t flags,const std::string& peer_id) = 0;
/*** /***
* Utility Functions. * Utility Functions.

View File

@ -1,29 +1,64 @@
#pragma once
#include <stdint.h> #include <stdint.h>
// This class provides a representation for flags that can be combined with bitwise
// operations. However, because the class is templated with an id, it's not possible to
// mixup flags belonging to different classes. This avoids many bugs due to confusion of flags types
// that occur when all flags are uint32_t values.
//
// To use this class, define an ID that is different than other flags classes, and do a typedef:
//
// #define TRANSFER_INFO_FLAGS_TAG 0x8133ea
// typedef t_RsFlags32<TRANSFER_INFO_FLAGS_TAG> TransferInfoFlags ;
//
// Implementation details:
// - we cannot have at the same time a implicit contructor from uint32_t and a bool operator, otherwise c++
// mixes up operators and transforms flags into booleans before combining them further.
//
// So I decided to have:
// - an explicit constructor from uint32_t
// - an implicit bool operator, that allows test like if(flags & FLAGS_VALUE)
//
template<int n> class t_RsFlags32 template<int n> class t_RsFlags32
{ {
public: public:
t_RsFlags32() {} inline t_RsFlags32() { _bits=0; }
inline explicit t_RsFlags32(uint32_t N) : _bits(N) {} // allows initialization from a set of uint32_t
t_RsFlags32(uint32_t N) : _bits(N) {} inline t_RsFlags32<n> operator| (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits | f._bits) ; }
operator uint32_t() const { return _bits ; } inline t_RsFlags32<n> operator^ (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits ^ f._bits) ; }
t_RsFlags32<n> operator| (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits | f._bits) ; } inline bool operator!=(const t_RsFlags32<n>& f) const { return _bits != f._bits ; }
t_RsFlags32<n> operator^ (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits ^ f._bits) ; } inline bool operator& (const t_RsFlags32<n>& f) const { return (_bits & f._bits)>0 ; }
t_RsFlags32<n> operator& (const t_RsFlags32<n>& f) const { return t_RsFlags32<n>(_bits & f._bits) ; }
t_RsFlags32<n> operator|=(const t_RsFlags32<n>& f) { _bits |= f._bits ; return *this ;} inline t_RsFlags32<n> operator|=(const t_RsFlags32<n>& f) { _bits |= f._bits ; return *this ;}
t_RsFlags32<n> operator^=(const t_RsFlags32<n>& f) { _bits ^= f._bits ; return *this ;} inline t_RsFlags32<n> operator^=(const t_RsFlags32<n>& f) { _bits ^= f._bits ; return *this ;}
t_RsFlags32<n> operator&=(const t_RsFlags32<n>& f) { _bits &= f._bits ; return *this ;} inline t_RsFlags32<n> operator&=(const t_RsFlags32<n>& f) { _bits &= f._bits ; return *this ;}
t_RsFlags32<n> operator~() const { return t_RsFlags32<n>(~_bits) ; } inline t_RsFlags32<n> operator~() const { return t_RsFlags32<n>(~_bits) ; }
//inline explicit operator bool() const { return _bits>0; }
inline uint32_t toUInt32() const { return _bits ; }
void clear() { _bits = 0 ; }
friend std::ostream& operator<<(std::ostream& o,const t_RsFlags32<n>& f) // friendly print with 0 and I
{
for(int i=31;i>=0;--i) { o << ( (f._bits&(1<<i))?"I":"0") ; if(i%8==0) o << " " ; }
return o ;
}
private: private:
uint32_t _bits ; uint32_t _bits ;
}; };
#define TRANSFER_INFO_FLAGS_TAG 0x8133ea #define FLAGS_TAG_FILE_SEARCH 0xf29ba5
#define FILE_STORAGE_FLAGS_TAG 0x184738 #define FLAGS_TAG_PERMISSION 0x8133ea
#define FLAGS_TAG_TRANSFER_REQS 0x4228af
#define FLAGS_TAG_FILE_STORAGE 0x184738
typedef t_RsFlags32<TRANSFER_INFO_FLAGS_TAG> TransferInfoFlags ; typedef t_RsFlags32<FLAGS_TAG_PERMISSION> FilePermissionFlags ;
typedef t_RsFlags32<FILE_STORAGE_FLAGS_TAG > FileStorageFlags ; // this makes it a uint32_t class incompatible with other flag class typedef t_RsFlags32<FLAGS_TAG_TRANSFER_REQS> TransferRequestFlags ;
typedef t_RsFlags32<FLAGS_TAG_FILE_STORAGE > FileStorageFlags ; // this makes it a uint32_t class incompatible with other flag class
typedef t_RsFlags32<FLAGS_TAG_FILE_SEARCH > FileSearchFlags ; // this makes it a uint32_t class incompatible with other flag class

View File

@ -307,7 +307,7 @@ class RsPeers
// ... computes the sharing file permission hint flags set for this peer, that is a combination of // ... computes the sharing file permission hint flags set for this peer, that is a combination of
// RS_FILE_HINTS_NETWORK_WIDE and RS_FILE_HINTS_BROWSABLE. // RS_FILE_HINTS_NETWORK_WIDE and RS_FILE_HINTS_BROWSABLE.
// //
virtual TransferInfoFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags file_sharing_flags,const std::list<std::string>& file_parent_groups) = 0; virtual FileSearchFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags file_sharing_flags,const std::list<std::string>& file_parent_groups) = 0;
}; };

View File

@ -202,19 +202,19 @@ class SearchRequest
* (TODO) * (TODO)
*/ */
const FileStorageFlags DIR_FLAGS_PARENT = 0x0001; const FileStorageFlags DIR_FLAGS_PARENT ( 0x0001 );
const FileStorageFlags DIR_FLAGS_DETAILS = 0x0002; const FileStorageFlags DIR_FLAGS_DETAILS ( 0x0002 ); // apparently unused
const FileStorageFlags DIR_FLAGS_CHILDREN = 0x0004; const FileStorageFlags DIR_FLAGS_CHILDREN ( 0x0004 ); // apparently unused
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_OTHERS = 0x0080; // Flags for directory sharing permissions. The last const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_OTHERS ( 0x0080 ); // Flags for directory sharing permissions. The last
const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS = 0x0100; // one should be the OR of the all four flags. const FileStorageFlags DIR_FLAGS_BROWSABLE_OTHERS ( 0x0100 ); // one should be the OR of the all four flags.
const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS = 0x0200; const FileStorageFlags DIR_FLAGS_NETWORK_WIDE_GROUPS ( 0x0200 );
const FileStorageFlags DIR_FLAGS_BROWSABLE_GROUPS = 0x0400; const FileStorageFlags DIR_FLAGS_BROWSABLE_GROUPS ( 0x0400 );
const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK = DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_OTHERS const FileStorageFlags DIR_FLAGS_PERMISSIONS_MASK ( DIR_FLAGS_NETWORK_WIDE_OTHERS | DIR_FLAGS_BROWSABLE_OTHERS
| DIR_FLAGS_NETWORK_WIDE_GROUPS | DIR_FLAGS_BROWSABLE_GROUPS ; | DIR_FLAGS_NETWORK_WIDE_GROUPS | DIR_FLAGS_BROWSABLE_GROUPS );
const FileStorageFlags DIR_FLAGS_LOCAL = 0x1000; const FileStorageFlags DIR_FLAGS_LOCAL ( 0x1000 );
const FileStorageFlags DIR_FLAGS_REMOTE = 0x2000; const FileStorageFlags DIR_FLAGS_REMOTE ( 0x2000 );
class FileInfo class FileInfo
{ {
@ -225,7 +225,7 @@ class FileInfo
RsCertId id; /* key for matching everything */ RsCertId id; /* key for matching everything */
FileStorageFlags storage_permission_flags; // Combination of the four RS_DIR_FLAGS_*. Updated when the file is a local stored file. FileStorageFlags storage_permission_flags; // Combination of the four RS_DIR_FLAGS_*. Updated when the file is a local stored file.
TransferInfoFlags transfer_info_flags ; // various flags from RS_FILE_HINTS_* TransferRequestFlags transfer_info_flags ; // various flags from RS_FILE_HINTS_*
/* allow this to be tweaked by the GUI Model */ /* allow this to be tweaked by the GUI Model */
mutable unsigned int mId; /* (GUI) Model Id -> unique number */ mutable unsigned int mId; /* (GUI) Model Id -> unique number */
@ -327,7 +327,6 @@ class FileChunksInfo
uint64_t file_size ; // real size of the file uint64_t file_size ; // real size of the file
uint32_t chunk_size ; // size of chunks uint32_t chunk_size ; // size of chunks
uint32_t flags ;
uint32_t strategy ; uint32_t strategy ;
// dl state of chunks. Only the last chunk may have size < chunk_size // dl state of chunks. Only the last chunk may have size < chunk_size

View File

@ -1100,7 +1100,7 @@ bool p3Peers::assignPeersToGroup(const std::string &groupId, const std::list<std
return mPeerMgr->assignPeersToGroup(groupId, peerIds, assign); return mPeerMgr->assignPeersToGroup(groupId, peerIds, assign);
} }
TransferInfoFlags p3Peers::computePeerPermissionFlags(const std::string& peer_id, FileSearchFlags p3Peers::computePeerPermissionFlags(const std::string& peer_id,
FileStorageFlags share_flags, FileStorageFlags share_flags,
const std::list<std::string>& directory_parent_groups) const std::list<std::string>& directory_parent_groups)
{ {
@ -1110,7 +1110,6 @@ TransferInfoFlags p3Peers::computePeerPermissionFlags(const std::string& peer_id
// very simple algorithm. // very simple algorithm.
// //
TransferInfoFlags final_flags = 0 ;
bool found = false ; bool found = false ;
for(std::list<std::string>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it) for(std::list<std::string>::const_iterator it(directory_parent_groups.begin());it!=directory_parent_groups.end() && !found;++it)
@ -1130,7 +1129,12 @@ TransferInfoFlags p3Peers::computePeerPermissionFlags(const std::string& peer_id
bool network_wide = (share_flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) || ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ; bool network_wide = (share_flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) || ( (share_flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) && found) ;
bool browsable = (share_flags & DIR_FLAGS_BROWSABLE_OTHERS) || ( (share_flags & DIR_FLAGS_BROWSABLE_GROUPS) && found) ; bool browsable = (share_flags & DIR_FLAGS_BROWSABLE_OTHERS) || ( (share_flags & DIR_FLAGS_BROWSABLE_GROUPS) && found) ;
return network_wide * RS_FILE_HINTS_NETWORK_WIDE + browsable * RS_FILE_HINTS_BROWSABLE ; FileSearchFlags final_flags ;
if(network_wide) final_flags |= RS_FILE_HINTS_NETWORK_WIDE ;
if(browsable ) final_flags |= RS_FILE_HINTS_BROWSABLE ;
return final_flags ;
} }
RsPeerDetails::RsPeerDetails() RsPeerDetails::RsPeerDetails()

View File

@ -121,7 +121,7 @@ virtual bool getGroupInfoList(std::list<RsGroupInfo> &groupInfoList);
virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign); virtual bool assignPeerToGroup(const std::string &groupId, const std::string &peerId, bool assign);
virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign); virtual bool assignPeersToGroup(const std::string &groupId, const std::list<std::string> &peerIds, bool assign);
virtual TransferInfoFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags share_flags,const std::list<std::string>& parent_groups) ; virtual FileSearchFlags computePeerPermissionFlags(const std::string& peer_id,FileStorageFlags share_flags,const std::list<std::string>& parent_groups) ;
private: private:
p3LinkMgr *mLinkMgr; p3LinkMgr *mLinkMgr;

View File

@ -475,8 +475,7 @@ bool p3Channels::channelExtraFileHash(const std::string &path, const std::string
// reverse string buff for correct file name // reverse string buff for correct file name
fname.append(fnameBuff.rbegin(), fnameBuff.rend()); fname.append(fnameBuff.rbegin(), fnameBuff.rend());
TransferRequestFlags flags = RS_FILE_REQ_ANONYMOUS_ROUTING;
uint32_t flags = RS_FILE_HINTS_NETWORK_WIDE;
// then hash file and get file info too // then hash file and get file info too
@ -490,14 +489,15 @@ bool p3Channels::channelExtraFileHash(const std::string &path, const std::string
} }
bool p3Channels::channelExtraFileRemove(const std::string &hash, const std::string &chId){ bool p3Channels::channelExtraFileRemove(const std::string &hash, const std::string &chId)
{
uint32_t flags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA; TransferRequestFlags tflags = RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA;
FileSearchFlags sflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA;
/* remove copy from channels directory */ /* remove copy from channels directory */
FileInfo fInfo; FileInfo fInfo;
mRsFiles->FileDetails(hash, flags, fInfo); mRsFiles->FileDetails(hash, sflags, fInfo);
std::string chPath = mChannelsDir + "/" + chId + "/" + fInfo.fname; std::string chPath = mChannelsDir + "/" + chId + "/" + fInfo.fname;
if(remove(chPath.c_str()) == 0){ if(remove(chPath.c_str()) == 0){
@ -509,8 +509,7 @@ bool p3Channels::channelExtraFileRemove(const std::string &hash, const std::stri
<< chPath.c_str() << std::endl; << chPath.c_str() << std::endl;
} }
return mRsFiles->ExtraFileRemove(hash, flags); return mRsFiles->ExtraFileRemove(hash, tflags);
} }
@ -835,7 +834,7 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
std::string channelname = grpId; std::string channelname = grpId;
std::string localpath; std::string localpath;
uint32_t flags; TransferRequestFlags flags;
// send to download directory if file is private // send to download directory if file is private
// We also add explicit sources only if the channel is private. Otherwise we DL in network wide mode // We also add explicit sources only if the channel is private. Otherwise we DL in network wide mode
@ -846,14 +845,14 @@ bool p3Channels::locked_eventDuplicateMsg(GroupInfo *grp, RsDistribMsg *msg, con
if(chanPrivate) if(chanPrivate)
{ {
localpath = mChannelsDir; localpath = mChannelsDir;
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_EXTRA; flags = RS_FILE_REQ_BACKGROUND | RS_FILE_REQ_EXTRA;
srcIds.push_back(id); srcIds.push_back(id);
} }
else else
{ {
localpath = ""; // forces dl to default directory localpath = ""; // forces dl to default directory
flags = RS_FILE_HINTS_BACKGROUND | RS_FILE_HINTS_NETWORK_WIDE; flags = RS_FILE_REQ_BACKGROUND | RS_FILE_REQ_ANONYMOUS_ROUTING;
} }
/* download it ... and flag for ExtraList /* download it ... and flag for ExtraList

View File

@ -261,8 +261,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
y += text_height ; painter->drawText(20,y,tr("Chunk strategy") + ":") ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ; y += text_height ; painter->drawText(20,y,tr("Chunk strategy") + ":") ; painter->drawText(tab_size,y,(info.strategy==FileChunksInfo::CHUNK_STRATEGY_RANDOM)?"Random":"Streaming") ;
y += block_sep ; y += block_sep ;
y += text_height ; painter->drawText(20,y,tr("Transfer type") + ":") ; y += text_height ; painter->drawText(20,y,tr("Transfer type") + ":") ;
if(info.flags & RS_FILE_HINTS_NETWORK_WIDE) painter->drawText(tab_size,y,tr("Anonymous F2F")) ; if(nfo.transfer_info_flags & RS_FILE_REQ_ANONYMOUS_ROUTING) painter->drawText(tab_size,y,tr("Anonymous F2F")) ;
if(info.flags & RS_FILE_HINTS_ASSUME_AVAILABILITY) painter->drawText(tab_size,y,tr("Direct friend transfer / Availability assumed")) ; if(nfo.transfer_info_flags & RS_FILE_REQ_ASSUME_AVAILABILITY) painter->drawText(tab_size,y,tr("Direct friend transfer / Availability assumed")) ;
y += text_height ; y += text_height ;
y += block_sep ; y += block_sep ;

View File

@ -31,6 +31,7 @@
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rsiface.h> #include <retroshare/rsiface.h>
#include <retroshare/rspeers.h> #include <retroshare/rspeers.h>
#include <retroshare/rstypes.h>
#include "settings/rsharesettings.h" #include "settings/rsharesettings.h"
@ -211,7 +212,7 @@ void QuickStartWizard::on_pushButtonSharesAdd_clicked()
{ {
SharedDirInfo sdi ; SharedDirInfo sdi ;
sdi.filename = dir ; sdi.filename = dir ;
sdi.shareflags = RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE ; sdi.shareflags = DIR_FLAGS_BROWSABLE_OTHERS | DIR_FLAGS_NETWORK_WIDE_OTHERS ;
rsFiles->addSharedDirectory(sdi); rsFiles->addSharedDirectory(sdi);
@ -307,8 +308,8 @@ void QuickStartWizard::loadShare()
QCheckBox *cb1 = new QCheckBox ; QCheckBox *cb1 = new QCheckBox ;
QCheckBox *cb2 = new QCheckBox ; QCheckBox *cb2 = new QCheckBox ;
cb1->setChecked( (*it).shareflags & RS_FILE_HINTS_NETWORK_WIDE ) ; cb1->setChecked( (*it).shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS ) ;
cb2->setChecked( (*it).shareflags & RS_FILE_HINTS_BROWSABLE ) ; cb2->setChecked( (*it).shareflags & DIR_FLAGS_BROWSABLE_OTHERS ) ;
cb1->setToolTip(QString("If checked, the share is anonymously shared to anybody.")) ; cb1->setToolTip(QString("If checked, the share is anonymously shared to anybody.")) ;
cb2->setToolTip(QString("If checked, the share is browsable by your friends.")) ; cb2->setToolTip(QString("If checked, the share is browsable by your friends.")) ;
@ -339,11 +340,11 @@ void QuickStartWizard::updateFlags(bool b)
for(it = dirs.begin(); it != dirs.end(); it++,++row) for(it = dirs.begin(); it != dirs.end(); it++,++row)
{ {
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ; std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
TransferInfoFlags current_flags = 0u ; FileStorageFlags current_flags(0u) ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? RS_FILE_HINTS_NETWORK_WIDE:(TransferInfoFlags)0u ; current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,1)))->isChecked()? DIR_FLAGS_NETWORK_WIDE_OTHERS:(FileStorageFlags)0u ;
current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? RS_FILE_HINTS_BROWSABLE:(TransferInfoFlags)0u ; current_flags |= (dynamic_cast<QCheckBox*>(ui.shareddirList->cellWidget(row,2)))->isChecked()? DIR_FLAGS_BROWSABLE_OTHERS :(FileStorageFlags)0u ;
if( (*it).shareflags ^ current_flags ) if( ((*it).shareflags ^ current_flags).toUInt32() )
{ {
(*it).shareflags = current_flags ; (*it).shareflags = current_flags ;
rsFiles->updateShareFlags(*it) ; // modifies the flags rsFiles->updateShareFlags(*it) ; // modifies the flags

View File

@ -91,11 +91,7 @@ bool TreeStyle_RDM::hasChildren(const QModelIndex &parent) const
void *ref = parent.internalPointer(); void *ref = parent.internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_CHILDREN; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{ {
@ -152,11 +148,7 @@ int TreeStyle_RDM::rowCount(const QModelIndex &parent) const
void *ref = (parent.isValid())? parent.internalPointer() : NULL ; void *ref = (parent.isValid())? parent.internalPointer() : NULL ;
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_CHILDREN; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{ {
@ -202,14 +194,14 @@ int FlatStyle_RDM::columnCount(const QModelIndex &/*parent*/) const
{ {
return 5; return 5;
} }
QString RetroshareDirModel::getFlagsString(uint32_t flags) QString RetroshareDirModel::getFlagsString(FileStorageFlags flags)
{ {
char str[8] = "- - - -" ; char str[11] = "- - - -" ;
if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ; if(flags & DIR_FLAGS_BROWSABLE_GROUPS) str[0] = 'B' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[2] = 'N' ; if(flags & DIR_FLAGS_NETWORK_WIDE_GROUPS) str[3] = 'N' ;
if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[4] = 'B' ; if(flags & DIR_FLAGS_BROWSABLE_OTHERS) str[6] = 'B' ;
if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[6] = 'N' ; if(flags & DIR_FLAGS_NETWORK_WIDE_OTHERS) str[9] = 'N' ;
return QString(str) ; return QString(str) ;
} }
@ -377,7 +369,7 @@ QString FlatStyle_RDM::computeDirectoryPath(const DirDetails& details) const
{ {
QString dir ; QString dir ;
DirDetails det(details) ; DirDetails det(details) ;
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if(!requestDirDetails(det.parent,det,flags)) if(!requestDirDetails(det.parent,det,flags))
return QString(); return QString();
@ -518,11 +510,7 @@ QVariant RetroshareDirModel::data(const QModelIndex &index, int role) const
int coln = index.column(); int coln = index.column();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
return QVariant(); return QVariant();
@ -582,12 +570,8 @@ void RetroshareDirModel::getAgeIndicatorRec(DirDetails &details, QString &ret) c
for (it = details.children.begin(); it != details.children.end(); it++) { for (it = details.children.begin(); it != details.children.end(); it++) {
void *ref = it->ref; void *ref = it->ref;
DirDetails childDetails; DirDetails childDetails;
uint32_t flags;
if (RemoteMode) FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (requestDirDetails(ref, childDetails, flags) && ret == tr("")) if (requestDirDetails(ref, childDetails, flags) && ret == tr(""))
getAgeIndicatorRec(childDetails, ret); getAgeIndicatorRec(childDetails, ret);
@ -704,11 +688,7 @@ QModelIndex TreeStyle_RDM::index(int row, int column, const QModelIndex & parent
********/ ********/
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_CHILDREN; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{ {
@ -787,7 +767,7 @@ QModelIndex TreeStyle_RDM::parent( const QModelIndex & index ) const
void *ref = index.internalPointer(); void *ref = index.internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = (RemoteMode)?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{ {
@ -838,11 +818,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
void *ref = index.internalPointer(); void *ref = index.internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
return Qt::ItemIsSelectable; // Error. return Qt::ItemIsSelectable; // Error.
@ -892,7 +868,7 @@ Qt::ItemFlags RetroshareDirModel::flags( const QModelIndex & index ) const
#endif #endif
} }
bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,uint32_t flags) const bool RetroshareDirModel::requestDirDetails(void *ref,DirDetails& details,FileSearchFlags flags) const
{ {
// We should use a cache instead of calling RsFiles::RequestDirDetails(), which is very costly // We should use a cache instead of calling RsFiles::RequestDirDetails(), which is very costly
// due to some pointer checking crap. // due to some pointer checking crap.
@ -950,7 +926,7 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
std::list<std::string> srcIds; std::list<std::string> srcIds;
srcIds.push_back(details.id); srcIds.push_back(details.id);
rsFiles -> FileRequest(details.name, details.hash, rsFiles -> FileRequest(details.name, details.hash,
details.count, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds); details.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
} }
/* if it is a dir, copy all files included*/ /* if it is a dir, copy all files included*/
else if (details.type == DIR_TYPE_DIR) else if (details.type == DIR_TYPE_DIR)
@ -971,7 +947,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
QString cleanPath = QDir::cleanPath(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()) + "/" + QString::fromUtf8(dirDetails.path.substr(prefixLen).c_str())); QString cleanPath = QDir::cleanPath(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()) + "/" + QString::fromUtf8(dirDetails.path.substr(prefixLen).c_str()));
srcIds.push_back(dirDetails.id); srcIds.push_back(dirDetails.id);
rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_HINTS_NETWORK_WIDE, srcIds); rsFiles->FileRequest(dirDetails.name, dirDetails.hash, dirDetails.count, cleanPath.toUtf8().constData(), RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
} }
else if (dirDetails.type & DIR_TYPE_DIR) else if (dirDetails.type & DIR_TYPE_DIR)
{ {
@ -986,7 +962,7 @@ void RetroshareDirModel::downloadDirectory(const DirDetails & dirDetails, int pr
if (!it->ref) continue; if (!it->ref) continue;
DirDetails subDirDetails; DirDetails subDirDetails;
uint32_t flags = DIR_FLAGS_CHILDREN | DIR_FLAGS_REMOTE; FileSearchFlags flags = RS_FILE_HINTS_REMOTE ;
if (!requestDirDetails(it->ref, subDirDetails, flags)) continue; if (!requestDirDetails(it->ref, subDirDetails, flags)) continue;
@ -1008,20 +984,10 @@ void RetroshareDirModel::getDirDetailsFromSelect (const QModelIndexList &list, s
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
{
flags |= DIR_FLAGS_REMOTE;
}
else
{
flags |= DIR_FLAGS_LOCAL;
}
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{
continue; continue;
}
dirVec.push_back(details); dirVec.push_back(details);
} }
@ -1056,12 +1022,7 @@ void RetroshareDirModel::getFileInfoFromIndexList(const QModelIndexList& list, s
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
continue; continue;
@ -1157,10 +1118,8 @@ void RetroshareDirModel::getFilePaths(const QModelIndexList &list, std::list<std
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS;
flags |= DIR_FLAGS_LOCAL;
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL))
{ {
#ifdef RDM_DEBUG #ifdef RDM_DEBUG
std::cerr << "getFilePaths() Bad Request" << std::endl; std::cerr << "getFilePaths() Bad Request" << std::endl;
@ -1214,15 +1173,7 @@ QMimeData * RetroshareDirModel::mimeData ( const QModelIndexList & indexes ) con
void *ref = it -> internalPointer(); void *ref = it -> internalPointer();
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
if (RemoteMode)
{
flags |= DIR_FLAGS_REMOTE;
}
else
{
flags |= DIR_FLAGS_LOCAL;
}
if (!requestDirDetails(ref, details, flags)) if (!requestDirDetails(ref, details, flags))
{ {
@ -1299,7 +1250,7 @@ int RetroshareDirModel::getType ( const QModelIndex & index ) const
//if (RemoteMode) // only local files can be opened //if (RemoteMode) // only local files can be opened
// return ; // return ;
uint32_t flags = RemoteMode?DIR_FLAGS_REMOTE:DIR_FLAGS_LOCAL; FileSearchFlags flags = (RemoteMode)?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL;
return rsFiles->getType(index.internalPointer(),flags); return rsFiles->getType(index.internalPointer(),flags);
} }
@ -1348,10 +1299,9 @@ void FlatStyle_RDM::updateRefs()
std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl; std::cerr << "FlatStyle_RDM::postMods(): poped ref " << ref << std::endl;
#endif #endif
_ref_stack.pop_back() ; _ref_stack.pop_back() ;
uint32_t flags = DIR_FLAGS_DETAILS;
DirDetails details ; DirDetails details ;
if (requestDirDetails(ref, details, flags)) if (requestDirDetails(ref, details, RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_REMOTE))
{ {
if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons. if(details.type == DIR_TYPE_FILE) // only push files, not directories nor persons.
_ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(details))); _ref_entries.push_back(std::pair<void*,QString>(ref,computeDirectoryPath(details)));

View File

@ -26,6 +26,7 @@
#include <QIcon> #include <QIcon>
#include <vector> #include <vector>
#include <stdint.h> #include <stdint.h>
#include <retroshare/rstypes.h>
class DirDetails; class DirDetails;
@ -65,7 +66,7 @@ class RetroshareDirModel : public QAbstractItemModel
void getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths); void getFilePaths(const QModelIndexList &list, std::list<std::string> &fullpaths);
void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; } void changeAgeIndicator(uint32_t indicator) { ageIndicator = indicator; }
bool requestDirDetails(void *ref,DirDetails& details,uint32_t flags) const; bool requestDirDetails(void *ref,DirDetails& details,FileSearchFlags flags) const;
void update() ; void update() ;
public: public:
@ -79,7 +80,7 @@ class RetroshareDirModel : public QAbstractItemModel
void treeStyle(); void treeStyle();
void downloadDirectory(const DirDetails & details, int prefixLen); void downloadDirectory(const DirDetails & details, int prefixLen);
static QString getFlagsString(uint32_t) ; static QString getFlagsString(FileStorageFlags f) ;
static QString getGroupsString(const std::list<std::string>&) ; static QString getGroupsString(const std::list<std::string>&) ;
QString getAgeIndicatorString(const DirDetails &) const; QString getAgeIndicatorString(const DirDetails &) const;
void getAgeIndicatorRec(DirDetails &details, QString &ret) const; void getAgeIndicatorRec(DirDetails &details, QString &ret) const;

View File

@ -973,7 +973,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
srcIds.push_back((*it).peerId) ; srcIds.push_back((*it).peerId) ;
} }
if (rsFiles->FileRequest(link.name().toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) { if (rsFiles->FileRequest(link.name().toUtf8().constData(), link.hash().toStdString(), link.size(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds)) {
fileAdded.append(link.name()); fileAdded.append(link.name());
} else { } else {
fileExist.append(link.name()); fileExist.append(link.name());

View File

@ -360,7 +360,7 @@ void SearchDialog::download()
std::string hash = item->text(SR_HASH_COL).toStdString(); std::string hash = item->text(SR_HASH_COL).toStdString();
getSourceFriendsForHash(hash,srcIds) ; getSourceFriendsForHash(hash,srcIds) ;
if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toUtf8().constData(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_HINTS_NETWORK_WIDE, srcIds)) if(!rsFiles -> FileRequest((item->text(SR_NAME_COL)).toUtf8().constData(), hash, (item->text(SR_SIZE_COL)).toULongLong(), "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds))
attemptDownloadLocal = true ; attemptDownloadLocal = true ;
else else
{ {
@ -391,7 +391,7 @@ void SearchDialog::downloadDirectory(const QTreeWidgetItem *item, const QString
rsFiles->FileRequest(item->text(SR_NAME_COL).toUtf8().constData(), rsFiles->FileRequest(item->text(SR_NAME_COL).toUtf8().constData(),
hash, hash,
item->text(SR_SIZE_COL).toULongLong(), item->text(SR_SIZE_COL).toULongLong(),
cleanPath.toUtf8().constData(),RS_FILE_HINTS_NETWORK_WIDE, srcIds); cleanPath.toUtf8().constData(),RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
std::cout << "SearchDialog::downloadDirectory(): "\ std::cout << "SearchDialog::downloadDirectory(): "\
"issuing file request from search dialog: -" "issuing file request from search dialog: -"
@ -614,7 +614,7 @@ void SearchDialog::advancedSearch(Expression* expression)
// The text "bool exp" should be replaced by an appropriate text describing the actual search. // The text "bool exp" should be replaced by an appropriate text describing the actual search.
initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ; initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ;
rsFiles -> SearchBoolExp(expression, results, DIR_FLAGS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE); rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
/* abstraction to allow reusee of tree rendering code */ /* abstraction to allow reusee of tree rendering code */
resultsToTree(advSearchDialog->getSearchAsString(),req_id, results); resultsToTree(advSearchDialog->getSearchAsString(),req_id, results);
@ -696,7 +696,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
{ {
std::list<DirDetails> initialResults; std::list<DirDetails> initialResults;
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_REMOTE) ; rsFiles->SearchBoolExp(&exprs, initialResults, RS_FILE_HINTS_REMOTE) ;
/* which extensions do we use? */ /* which extensions do we use? */
DirDetails dd; DirDetails dd;
@ -712,7 +712,7 @@ void SearchDialog::searchKeywords(const QString& keywords)
{ {
std::list<DirDetails> initialResults; std::list<DirDetails> initialResults;
rsFiles->SearchBoolExp(&exprs, initialResults, DIR_FLAGS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ; rsFiles->SearchBoolExp(&exprs, initialResults, RS_FILE_HINTS_LOCAL);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE) ;
/* which extensions do we use? */ /* which extensions do we use? */
DirDetails dd; DirDetails dd;
@ -866,7 +866,7 @@ void SearchDialog::insertDirectory(const QString &txt, qulonglong searchId, cons
/* go through all children directories/files for a recursive call */ /* go through all children directories/files for a recursive call */
for (std::list<DirStub>::const_iterator it(dir.children.begin()); it != dir.children.end(); it ++) { for (std::list<DirStub>::const_iterator it(dir.children.begin()); it != dir.children.end(); it ++) {
DirDetails details; DirDetails details;
rsFiles->RequestDirDetails(it->ref, details, 0); rsFiles->RequestDirDetails(it->ref, details, FileSearchFlags(0u));
insertDirectory(txt, searchId, details, child); insertDirectory(txt, searchId, details, child);
} }
} }

View File

@ -21,6 +21,7 @@
#include "ShareDialog.h" #include "ShareDialog.h"
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QFileDialog> #include <QFileDialog>
@ -61,8 +62,8 @@ ShareDialog::ShareDialog(std::string filename, QWidget *parent, Qt::WFlags flags
ui.browseButton->setDisabled(true); ui.browseButton->setDisabled(true);
ui.virtualpath_lineEdit->setText(QString::fromUtf8(it->virtualname.c_str())); ui.virtualpath_lineEdit->setText(QString::fromUtf8(it->virtualname.c_str()));
ui.browsableCheckBox->setChecked(it->shareflags & RS_FILE_HINTS_BROWSABLE); ui.browsableCheckBox->setChecked(it->shareflags & DIR_FLAGS_BROWSABLE_OTHERS);
ui.networkwideCheckBox->setChecked(it->shareflags & RS_FILE_HINTS_NETWORK_WIDE); ui.networkwideCheckBox->setChecked(it->shareflags & DIR_FLAGS_NETWORK_WIDE_OTHERS);
break; break;
} }
} }
@ -89,13 +90,13 @@ void ShareDialog::addDirectory()
sdi.filename = ui.localpath_lineEdit->text().toUtf8().constData(); sdi.filename = ui.localpath_lineEdit->text().toUtf8().constData();
sdi.virtualname = ui.virtualpath_lineEdit->text().toUtf8().constData(); sdi.virtualname = ui.virtualpath_lineEdit->text().toUtf8().constData();
sdi.shareflags = 0; sdi.shareflags.clear() ;
if (ui.browsableCheckBox->isChecked()) { if (ui.browsableCheckBox->isChecked()) {
sdi.shareflags |= RS_FILE_HINTS_BROWSABLE ; sdi.shareflags |= DIR_FLAGS_BROWSABLE_OTHERS ;
} }
if (ui.networkwideCheckBox->isChecked()) { if (ui.networkwideCheckBox->isChecked()) {
sdi.shareflags |= RS_FILE_HINTS_NETWORK_WIDE; sdi.shareflags |= DIR_FLAGS_NETWORK_WIDE_OTHERS;
} }
if (ui.localpath_lineEdit->isEnabled()) { if (ui.localpath_lineEdit->isEnabled()) {
@ -119,7 +120,7 @@ void ShareDialog::addDirectory()
rsFiles->addSharedDirectory(sdi); rsFiles->addSharedDirectory(sdi);
break; break;
} }
if (it->shareflags ^ sdi.shareflags) { if (it->shareflags != sdi.shareflags) {
/* modifies the flags */ /* modifies the flags */
it->shareflags = sdi.shareflags; it->shareflags = sdi.shareflags;
rsFiles->updateShareFlags(*it); rsFiles->updateShareFlags(*it);

View File

@ -27,6 +27,7 @@
#include <QUrl> #include <QUrl>
#include <retroshare/rsfiles.h> #include <retroshare/rsfiles.h>
#include <retroshare/rstypes.h>
#include "ShareManager.h" #include "ShareManager.h"
#include "ShareDialog.h" #include "ShareDialog.h"
@ -121,21 +122,21 @@ void ShareManager::load()
/* set new row count */ /* set new row count */
listWidget->setRowCount(dirs.size()); listWidget->setRowCount(dirs.size());
connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ;
int row=0 ; int row=0 ;
for(it = dirs.begin(); it != dirs.end(); it++,++row) for(it = dirs.begin(); it != dirs.end(); it++,++row)
{ {
listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str()))); listWidget->setItem(row, COLUMN_PATH, new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str())));
listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str()))); listWidget->setItem(row, COLUMN_VIRTUALNAME, new QTableWidgetItem(QString::fromUtf8((*it).virtualname.c_str())));
QWidget* widget = new GroupFlagsWidget(NULL,(*it).shareflags); GroupFlagsWidget *widget = new GroupFlagsWidget(NULL,(*it).shareflags);
listWidget->setRowHeight(row, 32); listWidget->setRowHeight(row, 32);
listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget); listWidget->setCellWidget(row, COLUMN_SHARE_FLAGS, widget);
listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem(QString(" - "))) ; // no groups! listWidget->setItem(row, COLUMN_GROUPS, new QTableWidgetItem(QString(" - "))) ; // no groups!
listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ; listWidget->item(row,COLUMN_GROUPS)->setBackgroundColor(QColor(183,236,181)) ;
connect(widget,SIGNAL(flagsChanged(FileStorageFlags)),this,SLOT(updateFlags())) ;
} }
listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ; listWidget->setColumnWidth(COLUMN_SHARE_FLAGS,132) ;
@ -168,12 +169,12 @@ void ShareManager::showYourself()
} }
} }
void ShareManager::updateFlags(bool b) void ShareManager::updateFlags()
{ {
if(isLoading) if(isLoading)
return ; return ;
std::cerr << "Updating flags (b=" << b << ") !!!" << std::endl ; std::cerr << "Updating flags" << std::endl;
std::list<SharedDirInfo>::iterator it; std::list<SharedDirInfo>::iterator it;
std::list<SharedDirInfo> dirs; std::list<SharedDirInfo> dirs;
@ -182,10 +183,10 @@ void ShareManager::updateFlags(bool b)
int row=0 ; int row=0 ;
for(it = dirs.begin(); it != dirs.end(); it++,++row) for(it = dirs.begin(); it != dirs.end(); it++,++row)
{ {
std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ; //std::cerr << "Looking for row=" << row << ", file=" << (*it).filename << ", flags=" << (*it).shareflags << std::endl ;
uint32_t current_flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)->children().front()))->flags() ; FileStorageFlags current_flags = (dynamic_cast<GroupFlagsWidget*>(ui.shareddirList->cellWidget(row,COLUMN_SHARE_FLAGS)))->flags() ;
if( (*it).shareflags ^ current_flags ) if( (*it).shareflags != current_flags )
{ {
(*it).shareflags = current_flags ; (*it).shareflags = current_flags ;
rsFiles->updateShareFlags(*it) ; // modifies the flags rsFiles->updateShareFlags(*it) ; // modifies the flags
@ -298,7 +299,7 @@ void ShareManager::dropEvent(QDropEvent *event)
sdi.filename = localpath.toUtf8().constData(); sdi.filename = localpath.toUtf8().constData();
sdi.virtualname.clear(); sdi.virtualname.clear();
sdi.shareflags = 0; sdi.shareflags.clear() ;
/* add new share */ /* add new share */
rsFiles->addSharedDirectory(sdi); rsFiles->addSharedDirectory(sdi);

View File

@ -59,7 +59,7 @@ private slots:
void showShareDialog(); void showShareDialog();
void editShareDirectory(); void editShareDirectory();
void removeShareDirectory(); void removeShareDirectory();
void updateFlags(bool); void updateFlags();
private: private:
static ShareManager *_instance; static ShareManager *_instance;

View File

@ -463,11 +463,7 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
const DirStub& dirStub = *cit; const DirStub& dirStub = *cit;
DirDetails details; DirDetails details;
uint32_t flags = DIR_FLAGS_DETAILS; FileSearchFlags flags = remote?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
if (remote)
flags |= DIR_FLAGS_REMOTE;
else
flags |= DIR_FLAGS_LOCAL;
// do not recursive copy sub dirs. // do not recursive copy sub dirs.
if (!rsFiles->RequestDirDetails(dirStub.ref, details, flags) || details.type != DIR_TYPE_FILE) if (!rsFiles->RequestDirDetails(dirStub.ref, details, flags) || details.type != DIR_TYPE_FILE)

View File

@ -945,7 +945,7 @@ void TransfersDialog::insertTransfers()
continue; continue;
} }
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) { if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
// if file transfer is a cache file index file, don't show it // if file transfer is a cache file index file, don't show it
DLListModel->removeRow(row); DLListModel->removeRow(row);
rowCount = DLListModel->rowCount(); rowCount = DLListModel->rowCount();
@ -971,7 +971,7 @@ void TransfersDialog::insertTransfers()
continue; continue;
} }
if ((fileInfo.transfer_info_flags & RS_FILE_HINTS_CACHE) && !showCacheTransfers) { if ((fileInfo.transfer_info_flags & RS_FILE_REQ_CACHE) && !showCacheTransfers) {
//if file transfer is a cache file index file, don't show it //if file transfer is a cache file index file, don't show it
continue; continue;
} }
@ -998,7 +998,7 @@ void TransfersDialog::insertTransfers()
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info)) if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_UPLOAD, info))
continue; continue;
if((info.transfer_info_flags & RS_FILE_HINTS_CACHE) && showCacheTransfers) if((info.transfer_info_flags & RS_FILE_REQ_CACHE) && showCacheTransfers)
continue ; continue ;
std::list<TransferInfo>::iterator pit; std::list<TransferInfo>::iterator pit;

View File

@ -30,7 +30,7 @@ QString GroupFlagsWidget::_tooltips_off[4] = {
QObject::tr("") QObject::tr("")
}; };
GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,uint32_t flags) GroupFlagsWidget::GroupFlagsWidget(QWidget *parent,FileStorageFlags flags)
: QWidget(parent) : QWidget(parent)
{ {
_layout = new QHBoxLayout(this) ; _layout = new QHBoxLayout(this) ;
@ -79,9 +79,9 @@ void GroupFlagsWidget::updated()
emit flagsChanged(flags()) ; emit flagsChanged(flags()) ;
} }
uint32_t GroupFlagsWidget::flags() const FileStorageFlags GroupFlagsWidget::flags() const
{ {
uint32_t flags = 0x0 ; FileStorageFlags flags ;
for(int i=0;i<4;++i) for(int i=0;i<4;++i)
if(_buttons[i]->isChecked()) flags |= _flags[i] ; if(_buttons[i]->isChecked()) flags |= _flags[i] ;

View File

@ -3,16 +3,17 @@
#include <stdint.h> #include <stdint.h>
#include <QPushButton> #include <QPushButton>
#include <QWidget> #include <QWidget>
#include <retroshare/rsflags.h>
class GroupFlagsWidget: public QWidget class GroupFlagsWidget: public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GroupFlagsWidget(QWidget *parent,uint32_t flags) ; GroupFlagsWidget(QWidget *parent,FileStorageFlags flags) ;
virtual ~GroupFlagsWidget() ; virtual ~GroupFlagsWidget() ;
uint32_t flags() const ; FileStorageFlags flags() const ;
public slots: public slots:
void updated() ; void updated() ;
@ -24,7 +25,7 @@ class GroupFlagsWidget: public QWidget
void update_OB_button(bool) ; void update_OB_button(bool) ;
signals: signals:
void flagsChanged(uint32_t) const ; void flagsChanged(FileStorageFlags) const ;
private: private:
void update_button_state(bool b,int id) ; void update_button_state(bool b,int id) ;
@ -33,7 +34,7 @@ class GroupFlagsWidget: public QWidget
QLayout *_layout ; QLayout *_layout ;
QIcon *_icons[6] ; QIcon *_icons[6] ;
uint32_t _flags[4] ; FileStorageFlags _flags[4] ;
static QString _tooltips_on[4] ; static QString _tooltips_on[4] ;
static QString _tooltips_off[4] ; static QString _tooltips_off[4] ;

View File

@ -217,7 +217,7 @@ void RsCollectionDialog::download()
if(!QDir(QApplication::applicationDirPath()).mkpath(cleanPath)) if(!QDir(QApplication::applicationDirPath()).mkpath(cleanPath))
QMessageBox::warning(NULL,QObject::tr("Unable to make path"),QObject::tr("Unable to make path:")+"<br> "+cleanPath) ; QMessageBox::warning(NULL,QObject::tr("Unable to make path"),QObject::tr("Unable to make path:")+"<br> "+cleanPath) ;
rsFiles->FileRequest(dlinfo.name.toUtf8().constData(), dlinfo.hash.toUtf8().constData(), dlinfo.size, cleanPath.toUtf8().constData(), RS_FILE_HINTS_NETWORK_WIDE, std::list<std::string>()); rsFiles->FileRequest(dlinfo.name.toUtf8().constData(), dlinfo.hash.toUtf8().constData(), dlinfo.size, cleanPath.toUtf8().constData(), RS_FILE_REQ_ANONYMOUS_ROUTING, std::list<std::string>());
} }
else else
std::cerr<<"Skipping file : " << dlinfo.name.toStdString() << std::endl; std::cerr<<"Skipping file : " << dlinfo.name.toStdString() << std::endl;

View File

@ -110,7 +110,7 @@ void RsCollectionFile::recursAddElements(QDomDocument& doc,const DirDetails& det
continue; continue;
DirDetails subDirDetails; DirDetails subDirDetails;
uint32_t flags = DIR_FLAGS_CHILDREN | DIR_FLAGS_LOCAL; FileSearchFlags flags = RS_FILE_HINTS_LOCAL;
if (!rsFiles->RequestDirDetails(it->ref, subDirDetails, flags)) if (!rsFiles->RequestDirDetails(it->ref, subDirDetails, flags))
continue; continue;

View File

@ -100,7 +100,7 @@ AttachFileItem::AttachFileItem(const QString& path)
mType = AFI_TYPE_ATTACH; mType = AFI_TYPE_ATTACH;
/* ask for Files to hash/prepare it for us */ /* ask for Files to hash/prepare it for us */
if ((!rsFiles) || (!rsFiles->ExtraFileHash(path.toUtf8().constData(), AFI_DEFAULT_PERIOD, 0))) if ((!rsFiles) || (!rsFiles->ExtraFileHash(path.toUtf8().constData(), AFI_DEFAULT_PERIOD, TransferRequestFlags(0u))))
{ {
mMode = AFI_STATE_ERROR; mMode = AFI_STATE_ERROR;
} }
@ -123,7 +123,7 @@ void AttachFileItem::Setup()
if (mMode == AFI_STATE_REMOTE) if (mMode == AFI_STATE_REMOTE)
{ {
FileInfo fi; FileInfo fi;
uint32_t hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY; FileSearchFlags hintflags = RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY;
/* look up path */ /* look up path */
if (rsFiles->FileDetails(mFileHash, hintflags, fi)) if (rsFiles->FileDetails(mFileHash, hintflags, fi))
@ -194,7 +194,7 @@ void AttachFileItem::updateItemStatic()
if (mPath == "") if (mPath == "")
{ {
FileInfo fi; FileInfo fi;
uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL FileSearchFlags hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL
| RS_FILE_HINTS_SPEC_ONLY; | RS_FILE_HINTS_SPEC_ONLY;
/* look up path */ /* look up path */
@ -350,7 +350,7 @@ void AttachFileItem::updateItem()
} }
else else
{ {
uint32_t hintflags = 0; FileSearchFlags hintflags(0u);
switch(mMode) switch(mMode)
{ {
case AFI_STATE_REMOTE: case AFI_STATE_REMOTE:

View File

@ -182,7 +182,7 @@ void SubFileItem::updateItemStatic()
if (mPath == "") if (mPath == "")
{ {
FileInfo fi; FileInfo fi;
uint32_t hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE; FileSearchFlags hintflags = RS_FILE_HINTS_UPLOAD | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_BROWSABLE;
/* look up path */ /* look up path */
if (!rsFiles->FileDetails(mFileHash, hintflags, fi)) if (!rsFiles->FileDetails(mFileHash, hintflags, fi))
@ -364,7 +364,7 @@ void SubFileItem::updateItem()
} }
else else
{ {
uint32_t hintflags = 0; FileSearchFlags hintflags(0u) ;
switch(mMode) switch(mMode)
{ {
case SFI_STATE_REMOTE: case SFI_STATE_REMOTE:
@ -544,7 +544,7 @@ void SubFileItem::cancel()
if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE)) if (((mType == SFI_TYPE_ATTACH) || (mType == SFI_TYPE_CHANNEL)) && (mFlag & SFI_FLAG_CREATE))
{ {
hide(); hide();
rsFiles->ExtraFileRemove(FileHash(), RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_EXTRA); rsFiles->ExtraFileRemove(FileHash(), RS_FILE_REQ_ANONYMOUS_ROUTING | RS_FILE_REQ_EXTRA);
mPath = ""; mPath = "";
} }
else else
@ -559,7 +559,7 @@ void SubFileItem::cancel()
void SubFileItem::play() void SubFileItem::play()
{ {
FileInfo info; FileInfo info;
uint32_t flags = RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_NETWORK_WIDE; FileSearchFlags flags = RS_FILE_HINTS_DOWNLOAD | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_NETWORK_WIDE;
if (!rsFiles->FileDetails( mFileHash, flags, info)) if (!rsFiles->FileDetails( mFileHash, flags, info))
@ -612,7 +612,7 @@ void SubFileItem::download()
if (mSrcId != "") if (mSrcId != "")
sources.push_back(mSrcId); sources.push_back(mSrcId);
rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", RS_FILE_HINTS_NETWORK_WIDE, sources); rsFiles->FileRequest(mFileName, mFileHash, mFileSize, "", RS_FILE_REQ_ANONYMOUS_ROUTING, sources);
downloadButton->setEnabled(false); downloadButton->setEnabled(false);

View File

@ -323,7 +323,7 @@ void MessageWidget::getcurrentrecommended()
const FileInfo& fi(it->second) ; const FileInfo& fi(it->second) ;
std::cout << "Requesting file " << fi.fname << ", size=" << fi.size << ", hash=" << fi.hash << std::endl ; std::cout << "Requesting file " << fi.fname << ", size=" << fi.size << ", hash=" << fi.hash << std::endl ;
if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds) == false) { if (rsFiles->FileRequest(fi.fname, fi.hash, fi.size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds) == false) {
QMessageBox mb(QObject::tr("File Request canceled"), QObject::tr("The following has not been added to your download list, because you already have it:\n ") + QString::fromUtf8(fi.fname.c_str()), QMessageBox::Critical, QMessageBox::Ok, 0, 0); QMessageBox mb(QObject::tr("File Request canceled"), QObject::tr("The following has not been added to your download list, because you already have it:\n ") + QString::fromUtf8(fi.fname.c_str()), QMessageBox::Critical, QMessageBox::Ok, 0, 0);
mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png"))); mb.setWindowIcon(QIcon(QString::fromUtf8(":/images/rstray3.png")));
mb.exec(); mb.exec();
@ -347,7 +347,7 @@ void MessageWidget::getallrecommended()
std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl; std::cerr << "MessageWidget::getallrecommended() Calling File Request" << std::endl;
std::list<std::string> srcIds; std::list<std::string> srcIds;
srcIds.push_back(msgInfo.srcId); srcIds.push_back(msgInfo.srcId);
rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_HINTS_NETWORK_WIDE, srcIds); rsFiles->FileRequest(it->fname, it->hash, it->size, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
} }
} }