add NodeData message
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 9 Apr 2008 20:26:54 +0000 (20:26 +0000)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 9 Apr 2008 20:26:54 +0000 (20:26 +0000)
git-svn-id: http://trooper/svn/projects/jSite/trunk@680 c3eda9e8-030b-0410-8277-bc7414b0a119

src/net/pterodactylus/util/fcp/FcpAdapter.java
src/net/pterodactylus/util/fcp/FcpConnection.java
src/net/pterodactylus/util/fcp/FcpListener.java

index 91e53c8..5e42184 100644 (file)
@@ -76,6 +76,16 @@ public class FcpAdapter implements FcpListener {
        }
 
        /**
+        * {@inheritDoc}
+        * 
+        * @see FcpListener#receivedNodeData(net.pterodactylus.util.fcp.FcpConnection,
+        *      net.pterodactylus.util.fcp.NodeData)
+        */
+       public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData) {
+               /* empty. */
+       }
+
+       /**
         * @see net.pterodactylus.util.fcp.FcpListener#receivedMessage(net.pterodactylus.util.fcp.FcpConnection,
         *      net.pterodactylus.util.fcp.FcpMessage)
         */
index ba167d1..818025c 100644 (file)
@@ -246,6 +246,19 @@ public class FcpConnection {
        }
 
        /**
+        * Notifies all listeners that a “NodeData” message was received.
+        * 
+        * @see FcpListener#receivedNodeData(FcpConnection, NodeData)
+        * @param nodeData
+        *            The “NodeData” message
+        */
+       private void fireReceivedNodeData(NodeData nodeData) {
+               for (FcpListener fcpListener: fcpListeners) {
+                       fcpListener.receivedNodeData(this, nodeData);
+               }
+       }
+
+       /**
         * Notifies all registered listeners that a message has been received.
         * 
         * @see FcpListener#receivedMessage(FcpConnection, FcpMessage)
@@ -331,6 +344,8 @@ public class FcpConnection {
                        fireReceivedSSKKeypair(new SSKKeypair(fcpMessage));
                } else if ("PeerRemoved".equals(messageName)) {
                        fireReceivedPeerRemoved(new PeerRemoved(fcpMessage));
+               } else if ("NodeData".equals(messageName)) {
+                       fireReceivedNodeData(new NodeData(fcpMessage));
                } else if ("NodeHello".equals(messageName)) {
                        fireReceivedNodeHello(new NodeHello(fcpMessage));
                } else if ("CloseConnectionDuplicateClientName".equals(messageName)) {
index 8b2c621..dde8c3c 100644 (file)
@@ -111,6 +111,16 @@ public interface FcpListener extends EventListener {
        public void receviedPeerRemoved(FcpConnection fcpConnection, PeerRemoved peerRemoved);
 
        /**
+        * Notifies a listener that a “NodeData” message was received.
+        * 
+        * @param fcpConnection
+        *            The connection that received the message
+        * @param nodeData
+        *            The “NodeData” message
+        */
+       public void receivedNodeData(FcpConnection fcpConnection, NodeData nodeData);
+
+       /**
         * Notifies a listener that a message has been received. This method is only
         * called if {@link FcpConnection#handleMessage(FcpMessage)} does not
         * recognize the message. Should that ever happen, please file a bug report!