org.whispersystems.textsecure.api.messages.multidevice.TextSecureSyncMessage Maven / Gradle / Ivy
package org.whispersystems.textsecure.api.messages.multidevice;
import org.whispersystems.libaxolotl.util.guava.Optional;
import org.whispersystems.textsecure.api.messages.TextSecureAttachment;
import org.whispersystems.textsecure.api.messages.TextSecureGroup;
public class TextSecureSyncMessage {
private final Optional sent;
private final Optional contacts;
private final Optional groups;
private final Optional request;
private TextSecureSyncMessage(Optional sent,
Optional contacts,
Optional groups,
Optional request)
{
this.sent = sent;
this.contacts = contacts;
this.groups = groups;
this.request = request;
}
public static TextSecureSyncMessage forSentTranscript(SentTranscriptMessage sent) {
return new TextSecureSyncMessage(Optional.of(sent),
Optional.absent(),
Optional.absent(),
Optional.absent());
}
public static TextSecureSyncMessage forContacts(TextSecureAttachment contacts) {
return new TextSecureSyncMessage(Optional.absent(),
Optional.of(contacts),
Optional.absent(),
Optional.absent());
}
public static TextSecureSyncMessage forGroups(TextSecureAttachment groups) {
return new TextSecureSyncMessage(Optional.absent(),
Optional.absent(),
Optional.of(groups),
Optional.absent());
}
public static TextSecureSyncMessage forRequest(RequestMessage request) {
return new TextSecureSyncMessage(Optional.absent(),
Optional.absent(),
Optional.absent(),
Optional.of(request));
}
public static TextSecureSyncMessage empty() {
return new TextSecureSyncMessage(Optional.absent(),
Optional.absent(),
Optional.absent(),
Optional.absent());
}
public Optional getSent() {
return sent;
}
public Optional getGroups() {
return groups;
}
public Optional getContacts() {
return contacts;
}
public Optional getRequest() {
return request;
}
}