mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-23 16:19:54 +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.contact.ContactId;
|
||||||
import org.briarproject.bramble.api.event.Event;
|
import org.briarproject.bramble.api.event.Event;
|
||||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
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.GroupId;
|
||||||
import org.briarproject.bramble.api.sync.MessageId;
|
import org.briarproject.bramble.api.sync.MessageId;
|
||||||
|
|
||||||
@@ -36,6 +37,13 @@ public class MessageSharedEvent extends Event {
|
|||||||
return groupId;
|
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() {
|
public Map<ContactId, Boolean> getGroupVisibility() {
|
||||||
return groupVisibility;
|
return groupVisibility;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -352,8 +352,11 @@ interface Database<T> {
|
|||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the IDs of all contacts to which the given group's visibility is
|
* Returns the IDs of all contacts for which the given group's visibility
|
||||||
* either {@link Visibility VISIBLE} or {@link Visibility SHARED}.
|
* 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/>
|
* <p/>
|
||||||
* Read-only.
|
* Read-only.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -385,6 +385,9 @@ class MailboxUploadWorker implements MailboxWorker, ConnectivityObserver,
|
|||||||
}
|
}
|
||||||
} else if (e instanceof MessageSharedEvent) {
|
} else if (e instanceof MessageSharedEvent) {
|
||||||
MessageSharedEvent m = (MessageSharedEvent) e;
|
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) {
|
if (m.getGroupVisibility().get(contactId) == TRUE) {
|
||||||
LOG.info("Message shared");
|
LOG.info("Message shared");
|
||||||
onDataToSend();
|
onDataToSend();
|
||||||
|
|||||||
@@ -235,6 +235,9 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
|||||||
if (c.getContactId().equals(contactId)) interrupt();
|
if (c.getContactId().equals(contactId)) interrupt();
|
||||||
} else if (e instanceof MessageSharedEvent) {
|
} else if (e instanceof MessageSharedEvent) {
|
||||||
MessageSharedEvent m = (MessageSharedEvent) e;
|
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) {
|
if (m.getGroupVisibility().get(contactId) == TRUE) {
|
||||||
generateOffer();
|
generateOffer();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user