X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FFCPPluginReply.java;h=f9dbc7f6c1642900d6e861394d80ee08d4552b17;hb=4654ee7f03bd580815c1387b4da26eaa6ea3f367;hp=271b8d73fb2e3aa4a7ecbc13af70dc31e6e07188;hpb=f553531be78d6d6d95dc152728f2b8d40242b57d;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/FCPPluginReply.java b/src/net/pterodactylus/fcp/FCPPluginReply.java index 271b8d7..f9dbc7f 100644 --- a/src/net/pterodactylus/fcp/FCPPluginReply.java +++ b/src/net/pterodactylus/fcp/FCPPluginReply.java @@ -20,13 +20,15 @@ package net.pterodactylus.fcp; import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; /** * The “FCPPluginReply” is sent by a plugin as a response to a * {@link FCPPluginMessage} message. * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ public class FCPPluginReply extends BaseMessage { @@ -86,6 +88,24 @@ public class FCPPluginReply extends BaseMessage { } /** + * Returns all replies from the plugin. The plugin sends replies as normal + * message fields prefixed by “Replies.”. The keys of the returned map do + * not contain this prefix! + * + * @return All replies from the plugin + */ + public Map getReplies() { + Map fields = getFields(); + Map replies = new HashMap(); + for (Entry field : fields.entrySet()) { + if (field.getKey().startsWith("Replies.")) { + replies.put(field.getKey().substring(8), field.getValue()); + } + } + return replies; + } + + /** * Returns the optional payload. * * @return The payload of the reply, or null if there is no