mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Include author and rating in private message headers.
This commit is contained in:
@@ -180,6 +180,10 @@ public interface DatabaseComponent {
|
||||
/** Returns the group with the given ID, if the user subscribes to it. */
|
||||
Group getGroup(GroupId g) throws DbException;
|
||||
|
||||
/** Returns the headers of all messages in the given group. */
|
||||
Collection<GroupMessageHeader> getGroupMessageHeaders(GroupId g)
|
||||
throws DbException;
|
||||
|
||||
/** Returns the pseudonym with the given ID. */
|
||||
LocalAuthor getLocalAuthor(AuthorId a) throws DbException;
|
||||
|
||||
@@ -199,10 +203,6 @@ public interface DatabaseComponent {
|
||||
/** Returns the body of the message with the given ID. */
|
||||
byte[] getMessageBody(MessageId m) throws DbException;
|
||||
|
||||
/** Returns the headers of all messages in the given group. */
|
||||
Collection<GroupMessageHeader> getMessageHeaders(GroupId g)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the headers of all private messages to or from the given
|
||||
* contact.
|
||||
|
||||
@@ -8,35 +8,17 @@ import net.sf.briar.api.messaging.Rating;
|
||||
public class GroupMessageHeader extends MessageHeader {
|
||||
|
||||
private final GroupId groupId;
|
||||
private final Author author;
|
||||
private final Rating rating;
|
||||
|
||||
public GroupMessageHeader(MessageId id, MessageId parent,
|
||||
public GroupMessageHeader(MessageId id, MessageId parent, Author author,
|
||||
String contentType, String subject, long timestamp, boolean read,
|
||||
boolean starred, GroupId groupId, Author author, Rating rating) {
|
||||
super(id, parent, contentType, subject, timestamp, read, starred);
|
||||
boolean starred, Rating rating, GroupId groupId) {
|
||||
super(id, parent, author, contentType, subject, timestamp, read,
|
||||
starred, rating);
|
||||
this.groupId = groupId;
|
||||
this.author = author;
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
/** Returns the ID of the group to which the message belongs. */
|
||||
public GroupId getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message's author, or null if this is an anonymous message.
|
||||
*/
|
||||
public Author getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating for the message's author, or Rating.UNRATED if this
|
||||
* is an anonymous message.
|
||||
*/
|
||||
public Rating getRating() {
|
||||
return rating;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,30 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
import net.sf.briar.api.Author;
|
||||
import net.sf.briar.api.messaging.MessageId;
|
||||
import net.sf.briar.api.messaging.Rating;
|
||||
|
||||
public abstract class MessageHeader {
|
||||
|
||||
private final MessageId id, parent;
|
||||
private final Author author;
|
||||
private final String contentType, subject;
|
||||
private final long timestamp;
|
||||
private final boolean read, starred;
|
||||
private final Rating rating;
|
||||
|
||||
protected MessageHeader(MessageId id, MessageId parent, String contentType,
|
||||
String subject, long timestamp, boolean read, boolean starred) {
|
||||
protected MessageHeader(MessageId id, MessageId parent, Author author,
|
||||
String contentType, String subject, long timestamp, boolean read,
|
||||
boolean starred, Rating rating) {
|
||||
this.id = id;
|
||||
this.parent = parent;
|
||||
this.author = author;
|
||||
this.contentType = contentType;
|
||||
this.subject = subject;
|
||||
this.timestamp = timestamp;
|
||||
this.read = read;
|
||||
this.starred = starred;
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
/** Returns the message's unique identifier. */
|
||||
@@ -33,6 +40,13 @@ public abstract class MessageHeader {
|
||||
return parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the message's author, or null if this is an anonymous message.
|
||||
*/
|
||||
public Author getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
/** Returns the message's content type. */
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
@@ -57,4 +71,12 @@ public abstract class MessageHeader {
|
||||
public boolean isStarred() {
|
||||
return starred;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating for the message's author, or Rating.UNRATED if this
|
||||
* is an anonymous message.
|
||||
*/
|
||||
public Rating getRating() {
|
||||
return rating;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
import net.sf.briar.api.Author;
|
||||
import net.sf.briar.api.ContactId;
|
||||
import net.sf.briar.api.messaging.MessageId;
|
||||
import net.sf.briar.api.messaging.Rating;
|
||||
|
||||
public class PrivateMessageHeader extends MessageHeader {
|
||||
|
||||
private final ContactId contactId;
|
||||
private final boolean incoming;
|
||||
|
||||
public PrivateMessageHeader(MessageId id, MessageId parent,
|
||||
public PrivateMessageHeader(MessageId id, MessageId parent, Author author,
|
||||
String contentType, String subject, long timestamp, boolean read,
|
||||
boolean starred, ContactId contactId, boolean incoming) {
|
||||
super(id, parent, contentType, subject, timestamp, read, starred);
|
||||
boolean starred, Rating rating, ContactId contactId,
|
||||
boolean incoming) {
|
||||
super(id, parent, author, contentType, subject, timestamp, read,
|
||||
starred, rating);
|
||||
this.contactId = contactId;
|
||||
this.incoming = incoming;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user