public CommandRequestInterface doNukeCheck(CommandRequest request) { String path = VirtualFileSystem.fixPath(request.getArgument()); if (!path.startsWith(VirtualFileSystem.separator)) { // Create full path if (request.getCurrentDirectory().isRoot()) { path = VirtualFileSystem.separator + path; } else { path = request.getCurrentDirectory().getPath() + VirtualFileSystem.separator + path; } } NukeData nd = NukeBeans.getNukeBeans().findPath(path); if (nd != null) { // This path exist in nukelog request.setAllowed(false); request.setDeniedResponse( new CommandResponse( 530, "Access denied - " + nd.getPath() + " already nuked for '" + nd.getReason() + "'")); } return request; }
public CommandResponse doSITE_NUKES(CommandRequest request) { CommandResponse response = StandardCommandManager.genericResponse("RESPONSE_200_COMMAND_OK"); ReplacerEnvironment env = new ReplacerEnvironment(); SectionInterface section = GlobalContext.getGlobalContext().getSectionManager().getSection(request.getArgument()); if (request.hasArgument() && section.getName().equalsIgnoreCase("")) { return new CommandResponse(501, "Invalid section!"); } if (NukeBeans.getNukeBeans().getAll().isEmpty()) { response.addComment( request .getSession() .jprintf(_bundle, _keyPrefix + "nukes.empty", env, request.getUser())); } for (NukeData nd : NukeBeans.getNukeBeans().getAll()) { if (nd.getPath().startsWith(request.getArgument(), 1)) { env.add("path", nd.getPath()); env.add("multiplier", nd.getMultiplier()); env.add("usersnuked", nd.getNukees().size()); env.add("size", nd.getSize()); env.add("reason", nd.getReason()); env.add("amount", nd.getAmount()); env.add("nuker", nd.getUser()); response.addComment( request.getSession().jprintf(_bundle, _keyPrefix + "nukes", env, request.getUser())); } } if (response.getComment().isEmpty()) { env.add("section", section.getName()); response.addComment( request .getSession() .jprintf(_bundle, _keyPrefix + "nukes.empty.section", env, request.getUser())); } return response; }