fix plugin compilation after recent UnsharedFileEvent changes

pull/62/head
Zlatin Balevsky 2021-07-05 20:44:48 +01:00
parent 57e60c631b
commit 0f3c22ddd4
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 8 additions and 6 deletions

View File

@ -33,9 +33,9 @@ public class DownloadedContentServlet extends BasicServlet {
public File getResource(String pathInContext) { public File getResource(String pathInContext) {
String infoHashB64 = pathInContext.substring("/DownloadedContent/".length()); String infoHashB64 = pathInContext.substring("/DownloadedContent/".length());
InfoHash infoHash = new InfoHash(Base64.decode(infoHashB64)); InfoHash infoHash = new InfoHash(Base64.decode(infoHashB64));
Set<SharedFile> sharedFiles = core.getFileManager().getRootToFiles().get(infoHash); SharedFile[] sharedFiles = core.getFileManager().getRootToFiles().get(infoHash);
if (sharedFiles == null || sharedFiles.isEmpty()) if (sharedFiles == null || sharedFiles.length == 0)
return null; return null;
return sharedFiles.iterator().next().getFile(); return sharedFiles[0].getFile();
} }
} }

View File

@ -70,7 +70,9 @@ public class FileManager {
public void onFileUnsharedEvent(FileUnsharedEvent e) { public void onFileUnsharedEvent(FileUnsharedEvent e) {
if (!e.getDeleted()) if (!e.getDeleted())
return; return;
fileTree.remove(e.getUnsharedFile().getFile()); for (SharedFile sf : e.getUnsharedFiles()) {
fileTree.remove(sf.getFile());
}
revision++; revision++;
} }
@ -127,7 +129,7 @@ public class FileManager {
fileTree.remove(file); fileTree.remove(file);
revision++; revision++;
FileUnsharedEvent event = new FileUnsharedEvent(); FileUnsharedEvent event = new FileUnsharedEvent();
event.setUnsharedFile(sf); event.setUnsharedFiles(new SharedFile[]{sf});
core.getEventBus().publish(event); core.getEventBus().publish(event);
} else { } else {
@ -139,7 +141,7 @@ public class FileManager {
for (SharedFile found : cb.found) { for (SharedFile found : cb.found) {
FileUnsharedEvent e = new FileUnsharedEvent(); FileUnsharedEvent e = new FileUnsharedEvent();
e.setUnsharedFile(found); e.setUnsharedFiles(new SharedFile[]{found});
core.getEventBus().publish(e); core.getEventBus().publish(e);
} }