mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Truncate all messages to valid length before sending.
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
package org.briarproject.api.sharing;
|
||||
|
||||
import static org.briarproject.api.sync.SyncConstants.MAX_MESSAGE_BODY_LENGTH;
|
||||
|
||||
public interface SharingConstants {
|
||||
|
||||
/** The length of a sharing session's random salt in bytes. */
|
||||
/**
|
||||
* The length of a sharing session's random salt in bytes.
|
||||
*/
|
||||
int SHARING_SALT_LENGTH = 32;
|
||||
|
||||
/**
|
||||
* The maximum length of the optional message from the inviter to the
|
||||
* invitee in UTF-8 bytes.
|
||||
*/
|
||||
int MAX_INVITATION_MESSAGE_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1204;
|
||||
|
||||
String CONTACT_ID = "contactId";
|
||||
String GROUP_ID = "groupId";
|
||||
String TO_BE_SHARED_BY_US = "toBeSharedByUs";
|
||||
|
||||
@@ -11,15 +11,17 @@ import java.util.Collection;
|
||||
|
||||
public interface SharingManager<S extends Shareable> extends MessageTracker {
|
||||
|
||||
/** Returns the unique ID of the group sharing client. */
|
||||
/**
|
||||
* Returns the unique ID of the group sharing client.
|
||||
*/
|
||||
ClientId getClientId();
|
||||
|
||||
/**
|
||||
* Sends an invitation to share the given shareable with the given contact
|
||||
* Sends an invitation to share the given group with the given contact
|
||||
* and sends an optional message along with it.
|
||||
*/
|
||||
void sendInvitation(GroupId groupId, ContactId contactId,
|
||||
String message) throws DbException;
|
||||
String message) throws DbException;
|
||||
|
||||
/**
|
||||
* Responds to a pending group invitation
|
||||
@@ -28,22 +30,29 @@ public interface SharingManager<S extends Shareable> extends MessageTracker {
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns all group sharing messages sent by the Contact
|
||||
* identified by contactId.
|
||||
* Returns all group sharing messages sent by the given contact.
|
||||
*/
|
||||
Collection<InvitationMessage> getInvitationMessages(
|
||||
ContactId contactId) throws DbException;
|
||||
|
||||
/** Returns all invitations to shareables. */
|
||||
/**
|
||||
* Returns all invitations to groups.
|
||||
*/
|
||||
Collection<InvitationItem> getInvitations() throws DbException;
|
||||
|
||||
/** Returns all contacts who are sharing the given group with us. */
|
||||
/**
|
||||
* Returns all contacts who are sharing the given group with us.
|
||||
*/
|
||||
Collection<Contact> getSharedBy(GroupId g) throws DbException;
|
||||
|
||||
/** Returns the IDs of all contacts with whom the given group is shared. */
|
||||
/**
|
||||
* Returns all contacts with whom the given group is shared.
|
||||
*/
|
||||
Collection<Contact> getSharedWith(GroupId g) throws DbException;
|
||||
|
||||
/** Returns true if the group not already shared and no invitation is open */
|
||||
/**
|
||||
* Returns true if the group not already shared and no invitation is open
|
||||
*/
|
||||
boolean canBeShared(GroupId g, Contact c) throws DbException;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user