add private URI
[jSite2.git] / src / net / pterodactylus / util / fcp / Peer.java
index c3dac0d..ca09ef3 100644 (file)
@@ -3,8 +3,6 @@
  */
 package net.pterodactylus.util.fcp;
 
-
-
 /**
  * The “Peer” reply by the node contains information about a peer.
  * 
@@ -24,6 +22,27 @@ public class Peer extends BaseMessage {
        }
 
        /**
+        * Returns a collection of fields as a node reference.
+        * 
+        * @return The node reference contained within this message
+        */
+       public NodeRef getNodeRef() {
+               NodeRef nodeRef = new NodeRef();
+               nodeRef.setArk(getARK());
+               nodeRef.setDSAGroup(getDSAGroup());
+               nodeRef.setDSAPublicKey(getDSAPublicKey());
+               nodeRef.setIdentity(getIdentity());
+               nodeRef.setLastGoodVersion(getLastGoodVersion());
+               nodeRef.setLocation(getLocation());
+               nodeRef.setName(getName());
+               nodeRef.setNegotiationTypes(getNegotiationTypes());
+               nodeRef.setOpennet(isOpennet());
+               nodeRef.setPhysicalUDP(getPhysicalUDP());
+               nodeRef.setVersion(getVersion());
+               return nodeRef;
+       }
+
+       /**
         * Returns the “physical.udp” line from the message. It contains all IP
         * addresses and port numbers of the peer.
         * 
@@ -136,7 +155,7 @@ public class Peer extends BaseMessage {
         * @return The supported negotiation types
         */
        public int[] getNegotiationTypes() {
-               return FcpUtils.parseMultiIntegerField(getField("auth.negTypes"));
+               return FcpUtils.decodeMultiIntegerField(getField("auth.negTypes"));
        }
 
 }