exclude files present locally from search results

This commit is contained in:
Zlatin Balevsky
2019-06-18 15:45:27 +01:00
parent e85a0c7b2c
commit deb7c0b4b0
2 changed files with 5 additions and 3 deletions

View File

@ -72,6 +72,7 @@ public class Core {
private final HasherService hasherService
private final DownloadManager downloadManager
private final DirectoryWatcher directoryWatcher
final FileManager fileManager
public Core(MuWireSettings props, File home, String myVersion) {
this.home = home
@ -155,7 +156,7 @@ public class Core {
log.info "initializing file manager"
FileManager fileManager = new FileManager(eventBus, props)
fileManager = new FileManager(eventBus, props)
eventBus.register(FileHashedEvent.class, fileManager)
eventBus.register(FileLoadedEvent.class, fileManager)
eventBus.register(FileDownloadedEvent.class, fileManager)

View File

@ -38,7 +38,7 @@ class SearchTabModel {
void handleResult(UIResultEvent e) {
if (uiSettings.excludeLocalResult &&
e.sender == core.me)
core.fileManager.rootToFiles.containsKey(e.infohash))
return
runInsideUIAsync {
def bucket = hashBucket.get(e.infohash)
@ -64,7 +64,8 @@ class SearchTabModel {
void handleResultBatch(UIResultEvent[] batch) {
runInsideUIAsync {
batch.each {
if (uiSettings.excludeLocalResult && it.sender == core.me)
if (uiSettings.excludeLocalResult &&
core.fileManager.rootToFiles.containsKey(it.infohash))
return
def bucket = hashBucket.get(it.infohash)
if (bucket == null) {