f139973e799c3737816a2aa217d6581d05e3cb57
[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 <a href="mailto:dr@ina-germany.de">David Roden</a>
27  * @version $Id$
28  */
29 public class PeerNote extends BaseMessage {
30
31         /** The type for base64 encoded peer notes. */
32         public static final int TYPE_PRIVATE_PEER_NOTE = 1;
33
34         /**
35          * Creates a “PeerNote” message that wraps the recevied message.
36          * 
37          * @param receivedMessage
38          *            The received message
39          */
40         PeerNote(FcpMessage receivedMessage) {
41                 super(receivedMessage);
42         }
43
44         /**
45          * Returns the base64-encoded note text.
46          * 
47          * @return The note text
48          */
49         public String getNoteText() {
50                 return getField("NoteText");
51         }
52
53         /**
54          * Returns the type of the peer note.
55          * 
56          * @return The type of the peer note, or <code>-1</code> if the type can
57          *         not be parsed
58          */
59         public int getPeerNoteType() {
60                 return FcpUtils.safeParseInt(getField("PeerNoteType"));
61         }
62
63 }