Commit 483106e0 authored by Torsten Grote's avatar Torsten Grote

[core] Add MessagingManager#getAttachment()

parent 934f14ef
......@@ -46,4 +46,9 @@ public interface MessagingManager extends ConversationClient {
*/
String getMessageText(MessageId m) throws DbException;
/**
* Returns the attachment with the given ID.
*/
Attachment getAttachment(MessageId m) throws DbException;
}
......@@ -24,20 +24,24 @@ import org.briarproject.bramble.api.versioning.ClientVersioningManager;
import org.briarproject.bramble.api.versioning.ClientVersioningManager.ClientVersioningHook;
import org.briarproject.briar.api.client.MessageTracker;
import org.briarproject.briar.api.conversation.ConversationMessageHeader;
import org.briarproject.briar.api.messaging.Attachment;
import org.briarproject.briar.api.messaging.MessagingManager;
import org.briarproject.briar.api.messaging.PrivateMessage;
import org.briarproject.briar.api.messaging.PrivateMessageHeader;
import org.briarproject.briar.api.messaging.event.PrivateMessageReceivedEvent;
import org.briarproject.briar.client.ConversationClientImpl;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
import java.util.Random;
import javax.annotation.concurrent.Immutable;
import javax.inject.Inject;
import static java.util.Collections.emptyList;
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_LENGTH;
import static org.briarproject.briar.client.MessageTrackerConstants.MSG_KEY_READ;
@Immutable
......@@ -221,4 +225,13 @@ class MessagingManagerImpl extends ConversationClientImpl
}
}
@Override
public Attachment getAttachment(MessageId m) {
// TODO add real implementation
// TODO return actual random/fake image before real implementation is done
byte[] b = new byte[MAX_MESSAGE_BODY_LENGTH];
new Random().nextBytes(b);
return new Attachment(ByteBuffer.wrap(b));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment