Remove content-type and parentId from private messages

and turn them into a regular string.
This commit is contained in:
Torsten Grote
2016-10-27 13:30:34 -02:00
parent a18317e912
commit 78740a6942
18 changed files with 81 additions and 112 deletions

View File

@@ -30,6 +30,6 @@ public interface MessagingManager extends MessageTracker {
throws DbException;
/** Returns the body of the private message with the given ID. */
byte[] getMessageBody(MessageId m) throws DbException;
String getMessageBody(MessageId m) throws DbException;
}

View File

@@ -1,23 +1,22 @@
package org.briarproject.api.messaging;
import org.briarproject.api.clients.BaseMessage;
import org.briarproject.api.nullsafety.NotNullByDefault;
import org.briarproject.api.sync.Message;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class PrivateMessage extends BaseMessage {
import javax.annotation.concurrent.Immutable;
private final String contentType;
@Immutable
@NotNullByDefault
public class PrivateMessage {
public PrivateMessage(@NotNull Message message, @Nullable MessageId parent,
@NotNull String contentType) {
super(message, parent);
this.contentType = contentType;
private final Message message;
public PrivateMessage(Message message) {
this.message = message;
}
public String getContentType() {
return contentType;
public Message getMessage() {
return message;
}
}

View File

@@ -1,12 +1,13 @@
package org.briarproject.api.messaging;
import org.briarproject.api.FormatException;
import org.briarproject.api.nullsafety.NotNullByDefault;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
@NotNullByDefault
public interface PrivateMessageFactory {
PrivateMessage createPrivateMessage(GroupId groupId, long timestamp,
MessageId parent, String contentType, byte[] body)
throws FormatException;
String body) throws FormatException;
}

View File

@@ -6,17 +6,10 @@ import org.briarproject.api.sync.MessageId;
public class PrivateMessageHeader extends BaseMessageHeader {
private final String contentType;
public PrivateMessageHeader(MessageId id, GroupId groupId, long timestamp,
String contentType, boolean local, boolean read, boolean sent,
boolean seen) {
boolean local, boolean read, boolean sent, boolean seen) {
super(id, groupId, timestamp, local, read, sent, seen);
this.contentType = contentType;
}
public String getContentType() {
return contentType;
}
}