From: David ‘Bombe’ Roden Date: Wed, 9 Apr 2008 20:26:54 +0000 (+0000) Subject: add NodeData message X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4f69b0b7f7dd68527ac69d75c404f85edb116975;p=jSite2.git add NodeData message git-svn-id: http://trooper/svn/projects/jSite/trunk@680 c3eda9e8-030b-0410-8277-bc7414b0a119 --- diff --git a/src/net/pterodactylus/util/fcp/FcpAdapter.java b/src/net/pterodactylus/util/fcp/FcpAdapter.java index 91e53c8..5e42184 100644 --- a/src/net/pterodactylus/util/fcp/FcpAdapter.java +++ b/src/net/pterodactylus/util/fcp/FcpAdapter.java @@ -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) */ diff --git a/src/net/pterodactylus/util/fcp/FcpConnection.java b/src/net/pterodactylus/util/fcp/FcpConnection.java index ba167d1..818025c 100644 --- a/src/net/pterodactylus/util/fcp/FcpConnection.java +++ b/src/net/pterodactylus/util/fcp/FcpConnection.java @@ -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)) { diff --git a/src/net/pterodactylus/util/fcp/FcpListener.java b/src/net/pterodactylus/util/fcp/FcpListener.java index 8b2c621..dde8c3c 100644 --- a/src/net/pterodactylus/util/fcp/FcpListener.java +++ b/src/net/pterodactylus/util/fcp/FcpListener.java @@ -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!