make message status persistent and initialize it from database

This commit is contained in:
Torsten Grote
2015-12-10 10:59:10 -02:00
parent 0a8c42b939
commit aa7d7642bf
6 changed files with 39 additions and 24 deletions

View File

@@ -6,17 +6,20 @@ import org.briarproject.api.messaging.MessageId;
public class MessageHeader {
public enum State { STORED, SENT, DELIVERED };
private final MessageId id, parent;
private final GroupId groupId;
private final Author author;
private final Author.Status authorStatus;
private final String contentType;
private final long timestamp;
private final boolean local, read, delivered;
private final boolean local, read;
private final State status;
public MessageHeader(MessageId id, MessageId parent, GroupId groupId,
Author author, Author.Status authorStatus, String contentType,
long timestamp, boolean local, boolean read, boolean delivered) {
long timestamp, boolean local, boolean read, State status) {
this.id = id;
this.parent = parent;
this.groupId = groupId;
@@ -26,7 +29,7 @@ public class MessageHeader {
this.timestamp = timestamp;
this.local = local;
this.read = read;
this.delivered = delivered;
this.status = status;
}
/** Returns the message's unique identifier. */
@@ -82,10 +85,9 @@ public class MessageHeader {
}
/**
* Returns true if the message has been delivered. (This only applies to
* locally generated private messages.)
* Returns message status. (This only applies to locally generated private messages.)
*/
public boolean isDelivered() {
return delivered;
public State getStatus() {
return status;
}
}

View File

@@ -9,12 +9,12 @@ import org.briarproject.api.messaging.MessageId;
public class MessagesSentEvent extends Event {
private final ContactId contactId;
private final Collection<MessageId> acked;
private final Collection<MessageId> messageIds;
public MessagesSentEvent(ContactId contactId,
Collection<MessageId> acked) {
Collection<MessageId> messageIds) {
this.contactId = contactId;
this.acked = acked;
this.messageIds = messageIds;
}
public ContactId getContactId() {
@@ -22,6 +22,6 @@ public class MessagesSentEvent extends Event {
}
public Collection<MessageId> getMessageIds() {
return acked;
return messageIds;
}
}