X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FPeer.java;h=9fd966518e05fbaa2bb39da7b34b88dbd59d9e4e;hb=64c2c9bd494f3ea9d1ae84f8d86827dea025bee6;hp=4a21f5cd0651e79455df2fad6d12168590d96d7f;hpb=60fa4ea6401f9cb7b3615f81526fda8212ace6c8;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/Peer.java b/src/net/pterodactylus/fcp/Peer.java index 4a21f5c..9fd9665 100644 --- a/src/net/pterodactylus/fcp/Peer.java +++ b/src/net/pterodactylus/fcp/Peer.java @@ -23,7 +23,6 @@ package net.pterodactylus.fcp; * The “Peer” reply by the node contains information about a peer. * * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - * @version $Id$ */ public class Peer extends BaseMessage { @@ -183,4 +182,33 @@ public class Peer extends BaseMessage { return FcpUtils.decodeMultiIntegerField(getField("auth.negTypes")); } + /** + * Returns one of the volatile fields from the message. The given field name + * is prepended with “volatile.” so if you want to get the value of the + * field with the name “volatile.status” you only need to specify “status”. + * + * @param field + * The name of the field + * @return The value of the field, or null if there is no + * such field + */ + public String getVolatile(String field) { + return getField("volatile." + field); + } + + /** + * Returns one of the metadata fields from the message. The given field name + * is prepended with “metadata.” so if you want to get the value of the + * field with the name “metadata.timeLastRoutable” you only need to specify + * “timeLastRoutable”. + * + * @param field + * The name of the field + * @return The value of the field, or null if there is no + * such field + */ + public String getMetadata(String field) { + return getField("metadata." + field); + } + }