mirror of https://github.com/zlatinb/muwire
fix plugin compilation after recent UnsharedFileEvent changes
parent
57e60c631b
commit
0f3c22ddd4
|
@ -33,9 +33,9 @@ public class DownloadedContentServlet extends BasicServlet {
|
|||
public File getResource(String pathInContext) {
|
||||
String infoHashB64 = pathInContext.substring("/DownloadedContent/".length());
|
||||
InfoHash infoHash = new InfoHash(Base64.decode(infoHashB64));
|
||||
Set<SharedFile> sharedFiles = core.getFileManager().getRootToFiles().get(infoHash);
|
||||
if (sharedFiles == null || sharedFiles.isEmpty())
|
||||
SharedFile[] sharedFiles = core.getFileManager().getRootToFiles().get(infoHash);
|
||||
if (sharedFiles == null || sharedFiles.length == 0)
|
||||
return null;
|
||||
return sharedFiles.iterator().next().getFile();
|
||||
return sharedFiles[0].getFile();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,9 @@ public class FileManager {
|
|||
public void onFileUnsharedEvent(FileUnsharedEvent e) {
|
||||
if (!e.getDeleted())
|
||||
return;
|
||||
fileTree.remove(e.getUnsharedFile().getFile());
|
||||
for (SharedFile sf : e.getUnsharedFiles()) {
|
||||
fileTree.remove(sf.getFile());
|
||||
}
|
||||
revision++;
|
||||
}
|
||||
|
||||
|
@ -127,7 +129,7 @@ public class FileManager {
|
|||
fileTree.remove(file);
|
||||
revision++;
|
||||
FileUnsharedEvent event = new FileUnsharedEvent();
|
||||
event.setUnsharedFile(sf);
|
||||
event.setUnsharedFiles(new SharedFile[]{sf});
|
||||
core.getEventBus().publish(event);
|
||||
} else {
|
||||
|
||||
|
@ -139,7 +141,7 @@ public class FileManager {
|
|||
|
||||
for (SharedFile found : cb.found) {
|
||||
FileUnsharedEvent e = new FileUnsharedEvent();
|
||||
e.setUnsharedFile(found);
|
||||
e.setUnsharedFiles(new SharedFile[]{found});
|
||||
core.getEventBus().publish(e);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue