mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 21:59:54 +01:00
Pass-through implementations of UI/DB interfaces.
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
package org.briarproject.messaging;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DatabaseComponent;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.messaging.MessagingManager;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.Message;
|
||||
import org.briarproject.api.sync.MessageHeader;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
class MessagingManagerImpl implements MessagingManager {
|
||||
|
||||
private final DatabaseComponent db;
|
||||
|
||||
@Inject
|
||||
MessagingManagerImpl(DatabaseComponent db) {
|
||||
this.db = db;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addGroup(Group g) throws DbException {
|
||||
return db.addGroup(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocalMessage(Message m) throws DbException {
|
||||
db.addLocalMessage(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group getGroup(GroupId g) throws DbException {
|
||||
return db.getGroup(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GroupId getInboxGroupId(ContactId c) throws DbException {
|
||||
return db.getInboxGroupId(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<MessageHeader> getInboxMessageHeaders(ContactId c)
|
||||
throws DbException {
|
||||
return db.getInboxMessageHeaders(c);
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getMessageBody(MessageId m) throws DbException {
|
||||
return db.getMessageBody(m);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInboxGroup(ContactId c, Group g) throws DbException {
|
||||
db.setInboxGroup(c, g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadFlag(MessageId m, boolean read) throws DbException {
|
||||
db.setReadFlag(m, read);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package org.briarproject.messaging;
|
||||
|
||||
import com.google.inject.AbstractModule;
|
||||
|
||||
import org.briarproject.api.messaging.MessagingManager;
|
||||
|
||||
public class MessagingModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(MessagingManager.class).to(MessagingManagerImpl.class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user