Add support for comments and reblogging to Blog Client

Comments and reblogs need to depend on the post they refer to.
Since message dependencies are limited to one group,
the post and also the comments need to be wrapped
when commented on or reblogged to another blog.

For this reason, in addition to comments, two new wrapping message types
are introduced. They retain all data of the original messages and allow
for reconstruction and signature verification.

This commit breaks backwards compatibility with old blog posts.
It removes the content type, title and parent ID from the post
message structure.
This commit is contained in:
Torsten Grote
2016-08-11 19:34:52 -03:00
parent 743fc7dd1f
commit 3dd3a18694
29 changed files with 874 additions and 320 deletions

View File

@@ -10,6 +10,7 @@ import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.Message;
import org.briarproject.api.sync.MessageId;
import java.security.GeneralSecurityException;
import java.util.Map;
public interface ClientHelper {
@@ -83,4 +84,9 @@ public interface ClientHelper {
throws FormatException;
BdfList toList(byte[] b, int off, int len) throws FormatException;
BdfList toList(byte[] b) throws FormatException;
byte[] sign(BdfList toSign, byte[] privateKey)
throws FormatException, GeneralSecurityException;
}

View File

@@ -1,6 +1,7 @@
package org.briarproject.api.clients;
import org.briarproject.api.identity.Author;
import org.briarproject.api.identity.Author.Status;
import org.briarproject.api.sync.MessageId;
public abstract class PostHeader {
@@ -9,19 +10,16 @@ public abstract class PostHeader {
private final MessageId parentId;
private final long timestamp;
private final Author author;
private final Author.Status authorStatus;
private final String contentType;
private final Status authorStatus;
private final boolean read;
public PostHeader(MessageId id, MessageId parentId, long timestamp,
Author author, Author.Status authorStatus, String contentType,
boolean read) {
Author author, Status authorStatus, boolean read) {
this.id = id;
this.parentId = parentId;
this.timestamp = timestamp;
this.author = author;
this.authorStatus = authorStatus;
this.contentType = contentType;
this.read = read;
}
@@ -33,14 +31,10 @@ public abstract class PostHeader {
return author;
}
public Author.Status getAuthorStatus() {
public Status getAuthorStatus() {
return authorStatus;
}
public String getContentType() {
return contentType;
}
public long getTimestamp() {
return timestamp;
}