mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Share Flags
- now, only files with the NETWORK_WIDE flag are searchable by turtle hopping. Next move: - integrate turtle search in default gui. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1512 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
45618c39c5
commit
cb5f22a5c6
@ -59,8 +59,39 @@ FileIndexMonitor::~FileIndexMonitor()
|
||||
return;
|
||||
}
|
||||
|
||||
bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t flags,
|
||||
std::string &fullpath, uint64_t &size) const
|
||||
int FileIndexMonitor::SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags)
|
||||
{
|
||||
results.clear();
|
||||
std::list<FileEntry *> firesults;
|
||||
|
||||
fi.searchTerms(keywords, firesults);
|
||||
time_t now = time(NULL) ;
|
||||
|
||||
/* translate/filter results */
|
||||
|
||||
for(std::list<FileEntry*>::const_iterator rit(firesults.begin()); rit != firesults.end(); ++rit)
|
||||
{
|
||||
DirDetails details ;
|
||||
RequestDirDetails((*rit)->parent,details,0) ;
|
||||
|
||||
if(( details.flags & flags & (DIR_FLAGS_BROWSABLE | DIR_FLAGS_NETWORK_WIDE) ) > 0 )
|
||||
{
|
||||
FileDetail fd;
|
||||
fd.id = "Local"; //localId;
|
||||
fd.name = (*rit)->name;
|
||||
fd.hash = (*rit)->hash;
|
||||
fd.path = ""; /* TODO */
|
||||
fd.size = (*rit)->size;
|
||||
fd.age = now - (*rit)->modtime;
|
||||
fd.rank = (*rit)->pop;
|
||||
|
||||
results.push_back(fd);
|
||||
}
|
||||
}
|
||||
return !results.empty() ;
|
||||
}
|
||||
|
||||
bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t flags, std::string &fullpath, uint64_t &size) const
|
||||
{
|
||||
std::list<FileEntry *> results;
|
||||
bool ok = false;
|
||||
@ -72,6 +103,7 @@ bool FileIndexMonitor::findLocalFile(std::string hash,uint32_t flags,
|
||||
#endif
|
||||
/* search through the fileIndex */
|
||||
fi.searchHash(hash, results);
|
||||
|
||||
if (results.size() > 0)
|
||||
{
|
||||
/* find the full path for the first entry */
|
||||
|
@ -75,6 +75,7 @@ class FileIndexMonitor: public CacheSource, public RsThread
|
||||
|
||||
/* external interface for filetransfer */
|
||||
bool findLocalFile(std::string hash,uint32_t f, std::string &fullpath, uint64_t &size) const;
|
||||
int SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags) ;
|
||||
|
||||
/* external interface for local access to files */
|
||||
bool convertSharedFilePath(std::string path, std::string &fullpath);
|
||||
|
@ -447,6 +447,9 @@ int ftServer::SearchKeywords(std::list<std::string> keywords, std::list<FileDeta
|
||||
}
|
||||
|
||||
#endif
|
||||
if(flags & DIR_FLAGS_LOCAL)
|
||||
return mFiMon->SearchKeywords(keywords, results,flags);
|
||||
else
|
||||
return mFiStore->SearchKeywords(keywords, results,flags);
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ void p3turtle::performLocalSearch(const std::string& s,std::list<TurtleFileInfo>
|
||||
words.push_back(s) ;
|
||||
|
||||
// now, search!
|
||||
rsFiles->SearchKeywords(words, initialResults,DIR_FLAGS_LOCAL);
|
||||
rsFiles->SearchKeywords(words, initialResults,DIR_FLAGS_LOCAL | DIR_FLAGS_NETWORK_WIDE);
|
||||
|
||||
result.clear() ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user