[freenet-cvs] r12606 - trunk/freenet/src/freenet/node/fcp

nextgens at freenetproject.org nextgens at freenetproject.org
Thu Apr 12 14:38:38 UTC 2007


Author: nextgens
Date: 2007-04-12 14:38:38 +0000 (Thu, 12 Apr 2007)
New Revision: 12606

Modified:
   trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
   trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
Log:
Add a new field to TestFileAccessReply : isDDAReadAllowed

Modified: trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java	2007-04-12 14:32:34 UTC (rev 12605)
+++ trunk/freenet/src/freenet/node/fcp/TestFileAccessQueryMessage.java	2007-04-12 14:38:38 UTC (rev 12606)
@@ -40,7 +40,7 @@
 		File file = new File(filename);
 		if(!file.exists())
 			throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "The node isn't aware that \"" + filename + "\" exists!", filename, false);
-		TestFileAccessReplyMessage reply = new TestFileAccessReplyMessage(file);
+		TestFileAccessReplyMessage reply = new TestFileAccessReplyMessage(handler, file);
 		handler.outputHandler.queue(reply);
 	}
 

Modified: trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java	2007-04-12 14:32:34 UTC (rev 12605)
+++ trunk/freenet/src/freenet/node/fcp/TestFileAccessReplyMessage.java	2007-04-12 14:38:38 UTC (rev 12606)
@@ -19,11 +19,15 @@
 	public static final String name = "TestFileAccessReply";
 	public static final String CAN_READ = "CanRead";
 	public static final String CAN_WRITE = "CanWrite";
+	public static final String IS_DDA_READ_ALLOWED = "IsDDAReadAllowed";
+	public static final String IS_DDA_WRITE_ALLOWED = "IsDDAWriteAllowed";
 	
 	private final File file;
+	private final FCPConnectionHandler handler;
 
-	public TestFileAccessReplyMessage(File filename) {
+	public TestFileAccessReplyMessage(FCPConnectionHandler handler, File filename) {
 		this.file = FileUtil.getCanonicalFile(filename);
+		this.handler = handler;
 	}
 	
 	public SimpleFieldSet getFieldSet() {
@@ -32,6 +36,8 @@
 		sfs.putSingle(TestFileAccessQueryMessage.FILENAME, file.toString());
 		sfs.putSingle(CAN_READ, String.valueOf(file.canRead()));
 		sfs.putSingle(CAN_WRITE, String.valueOf(file.canWrite()));
+		sfs.putSingle(IS_DDA_READ_ALLOWED, String.valueOf(handler.allowDDAFrom(file, false)));
+		sfs.putSingle(IS_DDA_WRITE_ALLOWED, String.valueOf(handler.allowDDAFrom(file, true)));
 		
 		return sfs;
 	}




More information about the cvs mailing list