All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.api.messages.SignalServiceContent Maven / Gradle / Ivy

There is a newer version: 2.15.3
Show newest version
/*
 * Copyright (C) 2014-2016 Open Whisper Systems
 *
 * Licensed according to the LICENSE file in this repository.
 */

package org.whispersystems.signalservice.api.messages;

import org.whispersystems.libsignal.util.guava.Optional;
import org.whispersystems.signalservice.api.messages.calls.SignalServiceCallMessage;
import org.whispersystems.signalservice.api.messages.multidevice.SignalServiceSyncMessage;

public class SignalServiceContent {

  private final Optional    message;
  private final Optional    synchronizeMessage;
  private final Optional    callMessage;
  private final Optional readMessage;

  public SignalServiceContent() {
    this.message            = Optional.absent();
    this.synchronizeMessage = Optional.absent();
    this.callMessage        = Optional.absent();
    this.readMessage        = Optional.absent();
  }

  public SignalServiceContent(SignalServiceDataMessage message) {
    this.message            = Optional.fromNullable(message);
    this.synchronizeMessage = Optional.absent();
    this.callMessage        = Optional.absent();
    this.readMessage        = Optional.absent();
  }

  public SignalServiceContent(SignalServiceSyncMessage synchronizeMessage) {
    this.message            = Optional.absent();
    this.synchronizeMessage = Optional.fromNullable(synchronizeMessage);
    this.callMessage        = Optional.absent();
    this.readMessage        = Optional.absent();
  }

  public SignalServiceContent(SignalServiceCallMessage callMessage) {
    this.message            = Optional.absent();
    this.synchronizeMessage = Optional.absent();
    this.callMessage        = Optional.of(callMessage);
    this.readMessage        = Optional.absent();
  }

  public SignalServiceContent(SignalServiceReceiptMessage receiptMessage) {
    this.message            = Optional.absent();
    this.synchronizeMessage = Optional.absent();
    this.callMessage        = Optional.absent();
    this.readMessage        = Optional.of(receiptMessage);
  }

  public Optional getDataMessage() {
    return message;
  }

  public Optional getSyncMessage() {
    return synchronizeMessage;
  }

  public Optional getCallMessage() {
    return callMessage;
  }

  public Optional getReceiptMessage() {
    return readMessage;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy