aeeeb1e2fb05aad75b02f31bdfa5b5e67d6ee9db
[jFCPlib.git] / src / net / pterodactylus / fcp / PeerNote.java
1 /*
2  * jSite2 - PeerNote.java -
3  * Copyright © 2008 David Roden
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19
20 package net.pterodactylus.fcp;
21
22 /**
23  * The “PeerNote” message contains a private note that has been entered for a
24  * darknet peer.
25  * 
26  * @author David ‘Bombe’ Roden <bombe@freenetproject.org>
27  */
28 public class PeerNote extends BaseMessage {
29
30         /** The type for base64 encoded peer notes. */
31         public static final int TYPE_PRIVATE_PEER_NOTE = 1;
32
33         /**
34          * Creates a “PeerNote” message that wraps the recevied message.
35          * 
36          * @param receivedMessage
37          *            The received message
38          */
39         PeerNote(FcpMessage receivedMessage) {
40                 super(receivedMessage);
41         }
42
43         /**
44          * Returns the base64-encoded note text.
45          * 
46          * @return The note text
47          */
48         public String getNoteText() {
49                 return getField("NoteText");
50         }
51
52         /**
53          * Returns the type of the peer note.
54          * 
55          * @return The type of the peer note, or <code>-1</code> if the type can
56          *         not be parsed
57          */
58         public int getPeerNoteType() {
59                 return FcpUtils.safeParseInt(getField("PeerNoteType"));
60         }
61
62 }