mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
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.
48 lines
1.3 KiB
Java
48 lines
1.3 KiB
Java
package org.briarproject.api.blogs;
|
|
|
|
import org.briarproject.api.clients.PostHeader;
|
|
import org.briarproject.api.identity.Author;
|
|
import org.briarproject.api.identity.Author.Status;
|
|
import org.briarproject.api.sync.GroupId;
|
|
import org.briarproject.api.sync.MessageId;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
public class BlogPostHeader extends PostHeader {
|
|
|
|
private final MessageType type;
|
|
private final GroupId groupId;
|
|
private final long timeReceived;
|
|
|
|
public BlogPostHeader(@NotNull MessageType type, @NotNull GroupId groupId,
|
|
@NotNull MessageId id, @Nullable MessageId parentId, long timestamp,
|
|
long timeReceived, @NotNull Author author,
|
|
@NotNull Status authorStatus, boolean read) {
|
|
super(id, parentId, timestamp, author, authorStatus, read);
|
|
|
|
this.type = type;
|
|
this.groupId = groupId;
|
|
this.timeReceived = timeReceived;
|
|
}
|
|
|
|
public BlogPostHeader(@NotNull MessageType type, @NotNull GroupId groupId,
|
|
@NotNull MessageId id, long timestamp, long timeReceived,
|
|
@NotNull Author author, @NotNull Status authorStatus,
|
|
boolean read) {
|
|
this(type, groupId, id, null, timestamp, timeReceived, author,
|
|
authorStatus, read);
|
|
}
|
|
|
|
public MessageType getType() {
|
|
return type;
|
|
}
|
|
|
|
public GroupId getGroupId() {
|
|
return groupId;
|
|
}
|
|
|
|
public long getTimeReceived() {
|
|
return timeReceived;
|
|
}
|
|
}
|