4efbc4fba8b509d287e23206ba4a2a930296559d
[jSite2.git] / src / net / pterodactylus / util / fcp / PeerNote.java
1 /**
2  * © 2008 INA Service GmbH
3  */
4 package net.pterodactylus.util.fcp;
5
6 /**
7  * The “PeerNote” message contains a private note that has been entered for a
8  * darknet peer.
9  * 
10  * @author <a href="mailto:dr@ina-germany.de">David Roden</a>
11  * @version $Id$
12  */
13 public class PeerNote extends BaseMessage {
14
15         /** The type for base64 encoded peer notes. */
16         public static final int TYPE_PRIVATE_PEER_NOTE = 1;
17
18         /**
19          * Creates a “PeerNote” message that wraps the recevied message.
20          * 
21          * @param receivedMessage
22          *            The received message
23          */
24         PeerNote(FcpMessage receivedMessage) {
25                 super(receivedMessage);
26         }
27
28         /**
29          * Returns the base64-encoded note text.
30          * 
31          * @return The note text
32          */
33         public String getNoteText() {
34                 return getField("NoteText");
35         }
36
37         /**
38          * Returns the type of the peer note.
39          * 
40          * @return The type of the peer note, or <code>-1</code> if the type can
41          *         not be parsed
42          */
43         public int getPeerNoteType() {
44                 return FcpUtils.safeParseInt(getField("PeerNoteType"));
45         }
46
47 }