From 82f9e000ee9103bd912275b012ac7002764aaead Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 23 Jul 2009 08:43:04 +0200 Subject: [PATCH] =?utf8?q?Implement=20=E2=80=9CSentFeed=E2=80=9D=20respons?= =?utf8?q?e=20message.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/net/pterodactylus/fcp/FcpAdapter.java | 7 +++ src/net/pterodactylus/fcp/FcpConnection.java | 2 + src/net/pterodactylus/fcp/FcpListener.java | 10 +++ src/net/pterodactylus/fcp/FcpListenerManager.java | 13 ++++ src/net/pterodactylus/fcp/SentFeed.java | 76 +++++++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 src/net/pterodactylus/fcp/SentFeed.java diff --git a/src/net/pterodactylus/fcp/FcpAdapter.java b/src/net/pterodactylus/fcp/FcpAdapter.java index 6bb2f50..a358d4c 100644 --- a/src/net/pterodactylus/fcp/FcpAdapter.java +++ b/src/net/pterodactylus/fcp/FcpAdapter.java @@ -277,6 +277,13 @@ public class FcpAdapter implements FcpListener { /** * {@inheritDoc} */ + public void receivedSentFeed(FcpConnection source, SentFeed sentFeed) { + /* empty. */ + } + + /** + * {@inheritDoc} + */ public void receivedBookmarkFeed(FcpConnection fcpConnection, ReceivedBookmarkFeed receivedBookmarkFeed) { /* empty. */ } diff --git a/src/net/pterodactylus/fcp/FcpConnection.java b/src/net/pterodactylus/fcp/FcpConnection.java index b7129b7..2f40785 100644 --- a/src/net/pterodactylus/fcp/FcpConnection.java +++ b/src/net/pterodactylus/fcp/FcpConnection.java @@ -308,6 +308,8 @@ public class FcpConnection implements Closeable { fcpListenerManager.fireReceivedNodeHello(new NodeHello(fcpMessage)); } else if ("CloseConnectionDuplicateClientName".equals(messageName)) { fcpListenerManager.fireReceivedCloseConnectionDuplicateClientName(new CloseConnectionDuplicateClientName(fcpMessage)); + } else if ("SentFeed".equals(messageName)) { + fcpListenerManager.fireSentFeed(new SentFeed(fcpMessage)); } else if ("ReceivedBookmarkFeed".equals(messageName)) { fcpListenerManager.fireReceivedBookmarkFeed(new ReceivedBookmarkFeed(fcpMessage)); } else { diff --git a/src/net/pterodactylus/fcp/FcpListener.java b/src/net/pterodactylus/fcp/FcpListener.java index a23b7ee..4f0c77a 100644 --- a/src/net/pterodactylus/fcp/FcpListener.java +++ b/src/net/pterodactylus/fcp/FcpListener.java @@ -371,6 +371,16 @@ public interface FcpListener extends EventListener { public void receivedPutFetchable(FcpConnection fcpConnection, PutFetchable putFetchable); /** + * Notifies a listener that a feed was sent to a peer. + * + * @param source + * The connection that received the message + * @param sentFeed + * The “SentFeed” message + */ + public void receivedSentFeed(FcpConnection source, SentFeed sentFeed); + + /** * Notifies a listener that a bookmark was updated. * * @param fcpConnection diff --git a/src/net/pterodactylus/fcp/FcpListenerManager.java b/src/net/pterodactylus/fcp/FcpListenerManager.java index 11509bf..4e1cce6 100644 --- a/src/net/pterodactylus/fcp/FcpListenerManager.java +++ b/src/net/pterodactylus/fcp/FcpListenerManager.java @@ -511,6 +511,19 @@ public class FcpListenerManager extends AbstractListenerManager + *
    + *
  1. Connected
  2. + *
  3. Backed off
  4. + *
  5. Version too new
  6. + *
  7. Version too old
  8. + *
  9. Disconnected
  10. + *
  11. Never connected
  12. + *
  13. Disabled
  14. + *
  15. Bursting
  16. + *
  17. Listening
  18. + *
  19. Listening only
  20. + *
  21. Clock problem
  22. + *
  23. Connection error
  24. + *
  25. Disconnecting
  26. + *
  27. Routing disabled
  28. + *
+ * + * @return The node’s status + */ + public int getNodeStatus() { + return FcpUtils.safeParseInt(getField("NodeStatus")); + } + +} -- 2.7.4