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) {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue