public boolean handleEvent(Event event, Connection connection) {
final String path = event.getProperty("file.path.ftp");
String filename = FileSystem.getNameFromPath(path);
String parentDirectory = FileSystem.getParentDirectoryFromPath(path);
if (ServiceManager.getServices().getPermissions().shouldLog(ActionPermission.DUPECHECK, parentDirectory, event.getUser())) {
Dupe dupe = dupelog.getDupe(filename);
if (dupe != null) {
// wouldn't it be nice (and memory intensive) to have the path to the file here too?
// the problem is that whenever it was moved, we'd have to update the object =(
connection.respond("553 This looks like a dupe! It was uploaded by " + dupe.getUsername() + ' ' + Formatter.shortDuration((System.currentTimeMillis() - dupe.getTime()) / 1000) + " ago");
return false;
} // if it returns null, we're happy
}
return true;
}