projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'partial-rewrite' into next
[Sone.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
sone
/
freenet
/
fcp
/
Command.java
diff --git
a/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
b/src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
index
2a083ee
..
32df6d8
100644
(file)
--- a/
src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
+++ b/
src/main/java/net/pterodactylus/sone/freenet/fcp/Command.java
@@
-1,5
+1,5
@@
/*
/*
- * Sone - Command.java - Copyright © 2011 David Roden
+ * Sone - Command.java - Copyright © 2011
–2013
David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-70,6
+70,9
@@
public interface Command {
*/
public static class Response {
*/
public static class Response {
+ /** The message name of the reponse. */
+ private final String messageName;
+
/** The reply parameters. */
private final SimpleFieldSet replyParameters;
/** The reply parameters. */
private final SimpleFieldSet replyParameters;
@@
-82,40
+85,48
@@
public interface Command {
/**
* Creates a new reply with the given parameters.
*
/**
* Creates a new reply with the given parameters.
*
+ * @param messageName
+ * The message name
* @param replyParameters
* The reply parameters
*/
* @param replyParameters
* The reply parameters
*/
- public Response(SimpleFieldSet replyParameters) {
- this(replyParameters, null, null);
+ public Response(S
tring messageName, S
impleFieldSet replyParameters) {
+ this(
messageName,
replyParameters, null, null);
}
/**
* Creates a new reply with the given parameters.
*
}
/**
* Creates a new reply with the given parameters.
*
+ * @param messageName
+ * The message name
* @param replyParameters
* The reply parameters
* @param data
* The data of the reply (may be {@code null})
*/
* @param replyParameters
* The reply parameters
* @param data
* The data of the reply (may be {@code null})
*/
- public Response(SimpleFieldSet replyParameters, byte[] data) {
- this(replyParameters, data, null);
+ public Response(S
tring messageName, S
impleFieldSet replyParameters, byte[] data) {
+ this(
messageName,
replyParameters, data, null);
}
/**
* Creates a new reply with the given parameters.
*
}
/**
* Creates a new reply with the given parameters.
*
+ * @param messageName
+ * The message name
* @param replyParameters
* The reply parameters
* @param bucket
* The bucket of the reply (may be {@code null})
*/
* @param replyParameters
* The reply parameters
* @param bucket
* The bucket of the reply (may be {@code null})
*/
- public Response(SimpleFieldSet replyParameters, Bucket bucket) {
- this(replyParameters, null, bucket);
+ public Response(S
tring messageName, S
impleFieldSet replyParameters, Bucket bucket) {
+ this(
messageName,
replyParameters, null, bucket);
}
/**
* Creates a new reply with the given parameters.
*
}
/**
* Creates a new reply with the given parameters.
*
+ * @param messageName
+ * The message name
* @param replyParameters
* The reply parameters
* @param data
* @param replyParameters
* The reply parameters
* @param data
@@
-123,7
+134,8
@@
public interface Command {
* @param bucket
* The bucket of the reply (may be {@code null})
*/
* @param bucket
* The bucket of the reply (may be {@code null})
*/
- private Response(SimpleFieldSet replyParameters, byte[] data, Bucket bucket) {
+ private Response(String messageName, SimpleFieldSet replyParameters, byte[] data, Bucket bucket) {
+ this.messageName = messageName;
this.replyParameters = replyParameters;
this.data = data;
this.bucket = bucket;
this.replyParameters = replyParameters;
this.data = data;
this.bucket = bucket;
@@
-135,7
+147,7
@@
public interface Command {
* @return The reply parameters
*/
public SimpleFieldSet getReplyParameters() {
* @return The reply parameters
*/
public SimpleFieldSet getReplyParameters() {
- return
replyParameters
;
+ return
new SimpleFieldSetBuilder(replyParameters).put("Message", messageName).get()
;
}
/**
}
/**
@@
-194,7
+206,7
@@
public interface Command {
* The error message
*/
public ErrorResponse(String message) {
* The error message
*/
public ErrorResponse(String message) {
- super(new SimpleFieldSetBuilder().put("ErrorMessage", message).get());
+ super(
"Error",
new SimpleFieldSetBuilder().put("ErrorMessage", message).get());
}
/**
}
/**
@@
-206,7
+218,7
@@
public interface Command {
* The error message
*/
public ErrorResponse(int code, String message) {
* The error message
*/
public ErrorResponse(int code, String message) {
- super(new SimpleFieldSetBuilder().put("ErrorMessage", message).put("ErrorCode", code).get());
+ super(
"Error",
new SimpleFieldSetBuilder().put("ErrorMessage", message).put("ErrorCode", code).get());
}
}
}
}