mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Add comments for group visibility.
This commit is contained in:
@@ -3,6 +3,7 @@ package org.briarproject.bramble.api.sync.event;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
import org.briarproject.bramble.api.event.Event;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.Group.Visibility;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
|
||||
@@ -36,6 +37,13 @@ public class MessageSharedEvent extends Event {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the IDs of all contacts for which the visibility of the
|
||||
* message's group is either {@link Visibility#SHARED shared} or
|
||||
* {@link Visibility#VISIBLE visible}. The value in the map is true if the
|
||||
* group is {@link Visibility#SHARED shared} or false if the group is
|
||||
* {@link Visibility#VISIBLE visible}.
|
||||
*/
|
||||
public Map<ContactId, Boolean> getGroupVisibility() {
|
||||
return groupVisibility;
|
||||
}
|
||||
|
||||
@@ -352,8 +352,11 @@ interface Database<T> {
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the IDs of all contacts to which the given group's visibility is
|
||||
* either {@link Visibility VISIBLE} or {@link Visibility SHARED}.
|
||||
* Returns the IDs of all contacts for which the given group's visibility
|
||||
* is either {@link Visibility#SHARED shared} or
|
||||
* {@link Visibility#VISIBLE visible}. The value in the map is true if the
|
||||
* group is {@link Visibility#SHARED shared} or false if the group is
|
||||
* {@link Visibility#VISIBLE visible}.
|
||||
* <p/>
|
||||
* Read-only.
|
||||
*/
|
||||
|
||||
@@ -385,6 +385,9 @@ class MailboxUploadWorker implements MailboxWorker, ConnectivityObserver,
|
||||
}
|
||||
} else if (e instanceof MessageSharedEvent) {
|
||||
MessageSharedEvent m = (MessageSharedEvent) e;
|
||||
// If the contact is present in the map (ie the value is not null)
|
||||
// and the value is true, the message's group is shared with the
|
||||
// contact and therefore the message may now be sendable
|
||||
if (m.getGroupVisibility().get(contactId) == TRUE) {
|
||||
LOG.info("Message shared");
|
||||
onDataToSend();
|
||||
|
||||
@@ -235,6 +235,9 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
if (c.getContactId().equals(contactId)) interrupt();
|
||||
} else if (e instanceof MessageSharedEvent) {
|
||||
MessageSharedEvent m = (MessageSharedEvent) e;
|
||||
// If the contact is present in the map (ie the value is not null)
|
||||
// and the value is true, the message's group is shared with the
|
||||
// contact and therefore the message may now be sendable
|
||||
if (m.getGroupVisibility().get(contactId) == TRUE) {
|
||||
generateOffer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user