X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fnet%2Fpterodactylus%2Ffcp%2FPeer.java;h=f7d33787d0c5639d7d15fcd78b49fdc33a53c0fe;hb=667d508c8e782ea52151fc83d8020d3babdac731;hp=e45d563489255e16a6aa268d3879514e0e0e31bc;hpb=f553531be78d6d6d95dc152728f2b8d40242b57d;p=jFCPlib.git diff --git a/src/net/pterodactylus/fcp/Peer.java b/src/net/pterodactylus/fcp/Peer.java index e45d563..f7d3378 100644 --- a/src/net/pterodactylus/fcp/Peer.java +++ b/src/net/pterodactylus/fcp/Peer.java @@ -59,6 +59,15 @@ public class Peer extends BaseMessage { } /** + * Returns the identifier of the request. + * + * @return The identifier of the request + */ + public String getIdentifier() { + return getField("Identifier"); + } + + /** * Returns the “physical.udp” line from the message. It contains all IP * addresses and port numbers of the peer. * @@ -174,4 +183,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); + } + }