import net.pterodactylus.util.fcp.message.CloseConnectionDuplicateClientName;
import net.pterodactylus.util.fcp.message.NodeHello;
+import net.pterodactylus.util.fcp.message.SSKKeypair;
/**
* Adapter for {@link FcpListener}.
}
/**
+ * @see net.pterodactylus.util.fcp.FcpListener#receivedSSKKeypair(net.pterodactylus.util.fcp.FcpConnection,
+ * net.pterodactylus.util.fcp.message.SSKKeypair)
+ */
+ public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair) {
+ /* empty. */
+ }
+
+ /**
* @see net.pterodactylus.util.fcp.FcpListener#receivedMessage(net.pterodactylus.util.fcp.FcpConnection,
* net.pterodactylus.util.fcp.FcpMessage)
*/
import net.pterodactylus.util.fcp.message.CloseConnectionDuplicateClientName;
import net.pterodactylus.util.fcp.message.NodeHello;
+import net.pterodactylus.util.fcp.message.SSKKeypair;
import net.pterodactylus.util.io.Closer;
/**
}
/**
+ * Notifies listeners that a “SSKKeypair” message was received.
+ *
+ * @see FcpListener#receivedSSKKeypair(FcpConnection, SSKKeypair)
+ * @param sskKeypair
+ * The “SSKKeypair” message
+ */
+ private void fireReceivedSSKKeypair(SSKKeypair sskKeypair) {
+ for (FcpListener fcpListener: fcpListeners) {
+ fcpListener.receivedSSKKeypair(this, sskKeypair);
+ }
+ }
+
+ /**
* Notifies all registered listeners that a message has been received.
*
* @see FcpListener#receivedMessage(FcpConnection, FcpMessage)
*/
void handleMessage(FcpMessage fcpMessage) {
String messageName = fcpMessage.getName();
- if ("NodeHello".equals(messageName)) {
+ if ("SSKKeypair".equals(messageName)) {
+ fireReceivedSSKKeypair(new SSKKeypair(fcpMessage));
+ } else if ("NodeHello".equals(messageName)) {
fireReceivedNodeHello(new NodeHello(fcpMessage));
} else if ("CloseConnectionDuplicateClientName".equals(messageName)) {
fireReceivedCloseConnectionDuplicateClientName(new CloseConnectionDuplicateClientName(fcpMessage));
import net.pterodactylus.util.fcp.message.CloseConnectionDuplicateClientName;
import net.pterodactylus.util.fcp.message.NodeHello;
+import net.pterodactylus.util.fcp.message.SSKKeypair;
/**
* Interface for objects that want to be notified on certain FCP events.
public void receivedCloseConnectionDuplicateClientName(FcpConnection fcpConnection, CloseConnectionDuplicateClientName closeConnectionDuplicateClientName);
/**
+ * Notifies all listeners that a “SSKKeypair” message was received.
+ *
+ * @param fcpConnection
+ * The connection that received themessage
+ * @param sskKeypair
+ * The “SSKKeypair” message
+ */
+ public void receivedSSKKeypair(FcpConnection fcpConnection, SSKKeypair sskKeypair);
+
+ /**
* Notifies listeners 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!