From: David ‘Bombe’ Roden Date: Tue, 14 Jul 2015 18:39:43 +0000 (+0200) Subject: Add constructor with identifier, add methods to set type and text X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=74b8a73a378fd921b0bb5cae88fd1e8e071840bc;p=jFCPlib.git Add constructor with identifier, add methods to set type and text --- diff --git a/src/main/java/net/pterodactylus/fcp/ModifyPeerNote.java b/src/main/java/net/pterodactylus/fcp/ModifyPeerNote.java index 27927aa..485467d 100644 --- a/src/main/java/net/pterodactylus/fcp/ModifyPeerNote.java +++ b/src/main/java/net/pterodactylus/fcp/ModifyPeerNote.java @@ -25,20 +25,15 @@ package net.pterodactylus.fcp; */ public class ModifyPeerNote extends FcpMessage { - /** - * Creates a new “ModifyPeerNote” request that changes peer note of the - * given type and node to the given text. - * - * @see PeerNote - * @param nodeIdentifier - * The identifier of the node, i.e. name, identity, or IP - * address and port - * @param noteText - * The base64-encoded text - * @param peerNoteType - * The type of the note to change, possible values are only - * {@link PeerNote#TYPE_PRIVATE_PEER_NOTE} at the moment - */ + // TODO: move base64-encoding to this class + + public ModifyPeerNote(String identifier, String nodeIdentifier) { + super("ModifyPeerNote"); + setField("Identifier", identifier); + setField("NodeIdentifier", nodeIdentifier); + } + + @Deprecated public ModifyPeerNote(String nodeIdentifier, String noteText, int peerNoteType) { super("ModifyPeerNote"); setField("NodeIdentifier", nodeIdentifier); @@ -46,4 +41,12 @@ public class ModifyPeerNote extends FcpMessage { setField("PeerNoteType", String.valueOf(peerNoteType)); } + public void setNoteText(String noteText) { + setField("NoteText", noteText); + } + + public void setPeerNoteType(PeerNoteType peerNoteType) { + setField("PeerNoteType", peerNoteType.toString()); + } + } diff --git a/src/main/java/net/pterodactylus/fcp/PeerNoteType.java b/src/main/java/net/pterodactylus/fcp/PeerNoteType.java new file mode 100644 index 0000000..7ebede3 --- /dev/null +++ b/src/main/java/net/pterodactylus/fcp/PeerNoteType.java @@ -0,0 +1,23 @@ +package net.pterodactylus.fcp; + +/** + * All possible peer note types. + * + * @author David ‘Bombe’ Roden + */ +public enum PeerNoteType { + + PRIVATE_DARKNET_COMMENT(1); + + private int value; + + PeerNoteType(int value) { + this.value = value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + +}