Separated the subject line from the message body.

This commit is contained in:
akwizgran
2011-10-21 18:25:25 +01:00
parent 4d23e14d89
commit f2d80825bc
12 changed files with 95 additions and 54 deletions

View File

@@ -10,6 +10,9 @@ public interface Message {
static final int MAX_BODY_LENGTH =
ProtocolConstants.MAX_PACKET_LENGTH - 1024;
/** The maximum length of a subject line in UTF-8 bytes. */
static final int MAX_SUBJECT_LENGTH = 100;
/** The maximum length of a signature in bytes. */
static final int MAX_SIGNATURE_LENGTH = 100;
@@ -31,6 +34,9 @@ public interface Message {
/** Returns the message's author. */
AuthorId getAuthor();
/** Returns the message's subject line. */
String getSubject();
/** Returns the timestamp created by the message's author. */
long getTimestamp();

View File

@@ -7,24 +7,25 @@ import java.security.PrivateKey;
public interface MessageEncoder {
/** Encodes a private message. */
Message encodeMessage(MessageId parent, byte[] body) throws IOException,
GeneralSecurityException;
Message encodeMessage(MessageId parent, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Encodes an anonymous message to an unrestricted group. */
Message encodeMessage(MessageId parent, Group group, byte[] body)
throws IOException, GeneralSecurityException;
Message encodeMessage(MessageId parent, Group group, String subject,
byte[] body) throws IOException, GeneralSecurityException;
/** Encodes an anonymous message to a restricted group. */
Message encodeMessage(MessageId parent, Group group, PrivateKey groupKey,
byte[] body) throws IOException, GeneralSecurityException;
String subject, byte[] body) throws IOException,
GeneralSecurityException;
/** Encodes a pseudonymous message to an unrestricted group. */
Message encodeMessage(MessageId parent, Group group, Author author,
PrivateKey authorKey, byte[] body) throws IOException,
GeneralSecurityException;
PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
/** Encode a pseudonymous message to a restricted group. */
Message encodeMessage(MessageId parent, Group group, PrivateKey groupKey,
Author author, PrivateKey authorKey, byte[] body)
Author author, PrivateKey authorKey, String subject, byte[] body)
throws IOException, GeneralSecurityException;
}