Java Code Examples for org.whispersystems.signalservice.api.messages.SignalServiceAttachment

The following examples show how to use org.whispersystems.signalservice.api.messages.SignalServiceAttachment. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public static SignalServiceSyncMessage forRead(ReadMessage read) {
  List<ReadMessage> reads = new LinkedList<>();
  reads.add(read);

  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.of(reads),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 2
Source Project: mollyim-android   Source File: PushSendJob.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected SignalServiceAttachment getAttachmentFor(Attachment attachment) {
  try {
    if (attachment.getDataUri() == null || attachment.getSize() == 0) throw new IOException("Assertion failed, outgoing attachment has no data!");
    InputStream is = PartAuthority.getAttachmentStream(context, attachment.getDataUri());
    return SignalServiceAttachment.newStreamBuilder()
                                  .withStream(is)
                                  .withContentType(attachment.getContentType())
                                  .withLength(attachment.getSize())
                                  .withFileName(attachment.getFileName())
                                  .withVoiceNote(attachment.isVoiceNote())
                                  .withWidth(attachment.getWidth())
                                  .withHeight(attachment.getHeight())
                                  .withCaption(attachment.getCaption())
                                  .withListener((total, progress) -> EventBus.getDefault().postSticky(new PartProgressEvent(attachment, PartProgressEvent.Type.NETWORK, total, progress)))
                                  .build();
  } catch (IOException ioe) {
    Log.w(TAG, "Couldn't open attachment", ioe);
  }
  return null;
}
 
Example 3
Source Project: mollyim-android   Source File: PushSendJob.java    License: GNU General Public License v3.0 6 votes vote down vote up
protected Optional<SignalServiceDataMessage.Sticker> getStickerFor(OutgoingMediaMessage message) {
  Attachment stickerAttachment = Stream.of(message.getAttachments()).filter(Attachment::isSticker).findFirst().orElse(null);

  if (stickerAttachment == null) {
    return Optional.absent();
  }

  try {
    byte[]                  packId     = Hex.fromStringCondensed(stickerAttachment.getSticker().getPackId());
    byte[]                  packKey    = Hex.fromStringCondensed(stickerAttachment.getSticker().getPackKey());
    int                     stickerId  = stickerAttachment.getSticker().getStickerId();
    SignalServiceAttachment attachment = getAttachmentPointerFor(stickerAttachment);

    return Optional.of(new SignalServiceDataMessage.Sticker(packId, packKey, stickerId, attachment));
  } catch (IOException e) {
    Log.w(TAG, "Failed to decode sticker id/key", e);
    return Optional.absent();
  }
}
 
Example 4
private void sendUpdate(SignalServiceMessageSender messageSender, File contactsFile, boolean complete)
    throws IOException, UntrustedIdentityException, NetworkException
{
  if (contactsFile.length() > 0) {
    FileInputStream               contactsFileStream = new FileInputStream(contactsFile);
    SignalServiceAttachmentStream attachmentStream   = SignalServiceAttachment.newStreamBuilder()
                                                                              .withStream(contactsFileStream)
                                                                              .withContentType("application/octet-stream")
                                                                              .withLength(contactsFile.length())
                                                                              .build();

    try {
      messageSender.sendMessage(SignalServiceSyncMessage.forContacts(new ContactsMessage(attachmentStream, complete)),
                                UnidentifiedAccessUtil.getAccessForSync(context));
    } catch (IOException ioe) {
      throw new NetworkException(ioe);
    }
  }
}
 
Example 5
public static Optional<Attachment> forPointer(SignalServiceDataMessage.Quote.QuotedAttachment pointer) {
  SignalServiceAttachment thumbnail = pointer.getThumbnail();

  return Optional.of(new PointerAttachment(pointer.getContentType(),
                                           AttachmentDatabase.TRANSFER_PROGRESS_PENDING,
                                           thumbnail != null ? thumbnail.asPointer().getSize().or(0) : 0,
                                           pointer.getFileName(),
                                           thumbnail != null ? thumbnail.asPointer().getCdnNumber() : 0,
                                           thumbnail != null ? thumbnail.asPointer().getRemoteId().toString() : "0",
                                           thumbnail != null && thumbnail.asPointer().getKey() != null ? Base64.encodeBytes(thumbnail.asPointer().getKey()) : null,
                                           null,
                                           thumbnail != null ? thumbnail.asPointer().getDigest().orNull() : null,
                                           null,
                                           false,
                                           thumbnail != null ? thumbnail.asPointer().getWidth() : 0,
                                           thumbnail != null ? thumbnail.asPointer().getHeight() : 0,
                                           thumbnail != null ? thumbnail.asPointer().getUploadTimestamp() : 0,
                                           thumbnail != null ? thumbnail.asPointer().getCaption().orNull() : null,
                                           null,
                                           null));
}
 
Example 6
private SignalServiceSyncMessage(Optional<SentTranscriptMessage>   sent,
                                 Optional<ContactsMessage>         contacts,
                                 Optional<SignalServiceAttachment> groups,
                                 Optional<BlockedListMessage>      blockedList,
                                 Optional<RequestMessage>          request,
                                 Optional<List<ReadMessage>>       reads,
                                 Optional<VerifiedMessage>         verified,
                                 Optional<ConfigurationMessage>    configuration)
{
  this.sent          = sent;
  this.contacts      = contacts;
  this.groups        = groups;
  this.blockedList   = blockedList;
  this.request       = request;
  this.reads         = reads;
  this.verified      = verified;
  this.configuration = configuration;
}
 
Example 7
Source Project: signal-cli   Source File: Manager.java    License: GNU General Public License v3.0 6 votes vote down vote up
public long sendMessage(String messageText, List<String> attachments,
                        List<String> recipients)
        throws IOException, EncapsulatedExceptions, AttachmentInvalidException, InvalidNumberException {
    final SignalServiceDataMessage.Builder messageBuilder = SignalServiceDataMessage.newBuilder().withBody(messageText);
    if (attachments != null) {
        List<SignalServiceAttachment> attachmentStreams = Utils.getSignalServiceAttachments(attachments);

        // Upload attachments here, so we only upload once even for multiple recipients
        SignalServiceMessageSender messageSender = getMessageSender();
        List<SignalServiceAttachment> attachmentPointers = new ArrayList<>(attachmentStreams.size());
        for (SignalServiceAttachment attachment : attachmentStreams) {
            if (attachment.isStream()) {
                attachmentPointers.add(messageSender.uploadAttachment(attachment.asStream()));
            } else if (attachment.isPointer()) {
                attachmentPointers.add(attachment.asPointer());
            }
        }

        messageBuilder.withAttachments(attachmentPointers);
    }
    return sendMessageLegacy(messageBuilder, getSignalServiceAddresses(recipients));
}
 
Example 8
Source Project: signal-cli   Source File: JsonDataMessage.java    License: GNU General Public License v3.0 6 votes vote down vote up
JsonDataMessage(SignalServiceDataMessage dataMessage) {
    this.timestamp = dataMessage.getTimestamp();
    if (dataMessage.getGroupContext().isPresent() && dataMessage.getGroupContext().get().getGroupV1().isPresent()) {
        SignalServiceGroup groupInfo = dataMessage.getGroupContext().get().getGroupV1().get();
        this.groupInfo = new JsonGroupInfo(groupInfo);
    }
    if (dataMessage.getBody().isPresent()) {
        this.message = dataMessage.getBody().get();
    }
    this.expiresInSeconds = dataMessage.getExpiresInSeconds();
    if (dataMessage.getAttachments().isPresent()) {
        this.attachments = new ArrayList<>(dataMessage.getAttachments().get().size());
        for (SignalServiceAttachment attachment : dataMessage.getAttachments().get()) {
            this.attachments.add(new JsonAttachment(attachment));
        }
    } else {
        this.attachments = new ArrayList<>();
    }
}
 
Example 9
private List<Preview> createPreviews(DataMessage content) {
  if (content.getPreviewCount() <= 0) return null;

  List<Preview> results = new LinkedList<>();

  for (DataMessage.Preview preview : content.getPreviewList()) {
    SignalServiceAttachment attachment = null;

    if (preview.hasImage()) {
      attachment = createAttachmentPointer(preview.getImage());
    }

    results.add(new Preview(preview.getUrl(),
                            preview.getTitle(),
                            Optional.fromNullable(attachment)));
  }

  return results;
}
 
Example 10
public static List<Attachment> forPointers(@NonNull MasterSecretUnion masterSecret, Optional<List<SignalServiceAttachment>> pointers) {
  List<Attachment> results = new LinkedList<>();

  if (pointers.isPresent()) {
    for (SignalServiceAttachment pointer : pointers.get()) {
      if (pointer.isPointer()) {
        String encryptedKey = MediaKey.getEncrypted(masterSecret, pointer.asPointer().getKey());
        results.add(new PointerAttachment(pointer.getContentType(),
                                          AttachmentDatabase.TRANSFER_PROGRESS_PENDING,
                                          pointer.asPointer().getSize().or(0),
                                          pointer.asPointer().getFileName().orNull(),
                                          String.valueOf(pointer.asPointer().getId()),
                                          encryptedKey, pointer.asPointer().getRelay().orNull(),
                                          pointer.asPointer().getDigest().orNull(),
                                          pointer.asPointer().getUrl().orNull(),
                                          pointer.asPointer().getVoiceNote()));
      }
    }
  }

  return results;
}
 
Example 11
private List<AttachmentPointer> createAttachmentPointers(Optional<List<SignalServiceAttachment>> attachments) throws IOException {
  List<AttachmentPointer> pointers = new LinkedList<>();

  if (!attachments.isPresent() || attachments.get().isEmpty()) {
    Log.w(TAG, "No attachments present...");
    return pointers;
  }

  for (SignalServiceAttachment attachment : attachments.get()) {
    if (attachment.isStream()) {
      Log.w(TAG, "Found attachment, creating pointer...");
      pointers.add(createAttachmentPointer(attachment.asStream()));
    } else if (attachment.isPointer()) {
      Log.w(TAG, "Including existing attachment pointer...");
      pointers.add(createAttachmentPointer(attachment.asPointer()));
    }
  }

  return pointers;
}
 
Example 12
private SignalServiceSyncMessage(Optional<SentTranscriptMessage>             sent,
                                 Optional<ContactsMessage>                   contacts,
                                 Optional<SignalServiceAttachment>           groups,
                                 Optional<BlockedListMessage>                blockedList,
                                 Optional<RequestMessage>                    request,
                                 Optional<List<ReadMessage>>                 reads,
                                 Optional<ViewOnceOpenMessage>               viewOnceOpen,
                                 Optional<VerifiedMessage>                   verified,
                                 Optional<ConfigurationMessage>              configuration,
                                 Optional<List<StickerPackOperationMessage>> stickerPackOperations,
                                 Optional<FetchType>                         fetchType)
{
  this.sent                  = sent;
  this.contacts              = contacts;
  this.groups                = groups;
  this.blockedList           = blockedList;
  this.request               = request;
  this.reads                 = reads;
  this.viewOnceOpen          = viewOnceOpen;
  this.verified              = verified;
  this.configuration         = configuration;
  this.stickerPackOperations = stickerPackOperations;
  this.fetchType             = fetchType;
}
 
Example 13
public static SignalServiceSyncMessage forRead(ReadMessage read) {
  List<ReadMessage> reads = new LinkedList<>();
  reads.add(read);

  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.of(reads),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent());
}
 
Example 14
public static SignalServiceSyncMessage forStickerPackOperations(List<StickerPackOperationMessage> stickerPackOperations) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.of(stickerPackOperations),
                                      Optional.<FetchType>absent());
}
 
Example 15
private SignalServiceSyncMessage(Optional<SentTranscriptMessage>             sent,
                                 Optional<ContactsMessage>                   contacts,
                                 Optional<SignalServiceAttachment>           groups,
                                 Optional<BlockedListMessage>                blockedList,
                                 Optional<RequestMessage>                    request,
                                 Optional<List<ReadMessage>>                 reads,
                                 Optional<ViewOnceOpenMessage>               viewOnceOpen,
                                 Optional<VerifiedMessage>                   verified,
                                 Optional<ConfigurationMessage>              configuration,
                                 Optional<List<StickerPackOperationMessage>> stickerPackOperations,
                                 Optional<FetchType>                         fetchType,
                                 Optional<KeysMessage>                       keys,
                                 Optional<MessageRequestResponseMessage>     messageRequestResponse)
{
  this.sent                   = sent;
  this.contacts               = contacts;
  this.groups                 = groups;
  this.blockedList            = blockedList;
  this.request                = request;
  this.reads                  = reads;
  this.viewOnceOpen           = viewOnceOpen;
  this.verified               = verified;
  this.configuration          = configuration;
  this.stickerPackOperations  = stickerPackOperations;
  this.fetchType              = fetchType;
  this.keys                   = keys;
  this.messageRequestResponse = messageRequestResponse;
}
 
Example 16
public static SignalServiceSyncMessage forSentTranscript(SentTranscriptMessage sent) {
  return new SignalServiceSyncMessage(Optional.of(sent),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 17
public static SignalServiceSyncMessage forContacts(ContactsMessage contacts) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.of(contacts),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 18
public static SignalServiceSyncMessage forGroups(SignalServiceAttachment groups) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.of(groups),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 19
public static SignalServiceSyncMessage forRequest(RequestMessage request) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.of(request),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 20
public static SignalServiceSyncMessage forRead(List<ReadMessage> reads) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.of(reads),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 21
public static SignalServiceSyncMessage forViewOnceOpen(ViewOnceOpenMessage timerRead) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.of(timerRead),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 22
public static SignalServiceSyncMessage forVerified(VerifiedMessage verifiedMessage) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.of(verifiedMessage),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 23
public static SignalServiceSyncMessage forBlocked(BlockedListMessage blocked) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.of(blocked),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 24
public static SignalServiceSyncMessage forConfiguration(ConfigurationMessage configuration) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.of(configuration),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 25
public static SignalServiceSyncMessage forStickerPackOperations(List<StickerPackOperationMessage> stickerPackOperations) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.of(stickerPackOperations),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 26
public static SignalServiceSyncMessage forConfiguration(ConfigurationMessage configuration) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
                                      Optional.<ContactsMessage>absent(),
                                      Optional.<SignalServiceAttachment>absent(),
                                      Optional.<BlockedListMessage>absent(),
                                      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.of(configuration),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent());
}
 
Example 27
static private List<String> getAttachments(SignalServiceDataMessage message, Manager m) {
    List<String> attachments = new ArrayList<>();
    if (message.getAttachments().isPresent()) {
        for (SignalServiceAttachment attachment : message.getAttachments().get()) {
            if (attachment.isPointer()) {
                attachments.add(m.getAttachmentFile(attachment.asPointer().getRemoteId()).getAbsolutePath());
            }
        }
    }
    return attachments;
}
 
Example 28
public static SignalServiceSyncMessage forMessageRequestResponse(MessageRequestResponseMessage messageRequestResponse) {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
      Optional.<ContactsMessage>absent(),
      Optional.<SignalServiceAttachment>absent(),
      Optional.<BlockedListMessage>absent(),
      Optional.<RequestMessage>absent(),
      Optional.<List<ReadMessage>>absent(),
      Optional.<ViewOnceOpenMessage>absent(),
      Optional.<VerifiedMessage>absent(),
      Optional.<ConfigurationMessage>absent(),
      Optional.<List<StickerPackOperationMessage>>absent(),
      Optional.<FetchType>absent(),
      Optional.<KeysMessage>absent(),
      Optional.of(messageRequestResponse));
}
 
Example 29
public static SignalServiceSyncMessage empty() {
  return new SignalServiceSyncMessage(Optional.<SentTranscriptMessage>absent(),
      Optional.<ContactsMessage>absent(),
      Optional.<SignalServiceAttachment>absent(),
      Optional.<BlockedListMessage>absent(),
      Optional.<RequestMessage>absent(),
                                      Optional.<List<ReadMessage>>absent(),
                                      Optional.<ViewOnceOpenMessage>absent(),
                                      Optional.<VerifiedMessage>absent(),
                                      Optional.<ConfigurationMessage>absent(),
                                      Optional.<List<StickerPackOperationMessage>>absent(),
                                      Optional.<FetchType>absent(),
                                      Optional.<KeysMessage>absent(),
                                      Optional.<MessageRequestResponseMessage>absent());
}
 
Example 30
Source Project: signal-cli   Source File: Utils.java    License: GNU General Public License v3.0 5 votes vote down vote up
static List<SignalServiceAttachment> getSignalServiceAttachments(List<String> attachments) throws AttachmentInvalidException {
    List<SignalServiceAttachment> signalServiceAttachments = null;
    if (attachments != null) {
        signalServiceAttachments = new ArrayList<>(attachments.size());
        for (String attachment : attachments) {
            try {
                signalServiceAttachments.add(createAttachment(new File(attachment)));
            } catch (IOException e) {
                throw new AttachmentInvalidException(attachment, e);
            }
        }
    }
    return signalServiceAttachments;
}