org.whispersystems.signalservice.api.messages.multidevice.ViewOnceOpenMessage Java Examples

The following examples show how to use org.whispersystems.signalservice.api.messages.multidevice.ViewOnceOpenMessage. 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
Source File: SignalServiceMessageSender.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private byte[] createMultiDeviceViewOnceOpenContent(ViewOnceOpenMessage readMessage) {
  Content.Builder                  container       = Content.newBuilder();
  SyncMessage.Builder              builder         = createSyncMessageBuilder();
  SyncMessage.ViewOnceOpen.Builder viewOnceBuilder = SyncMessage.ViewOnceOpen.newBuilder().setTimestamp(readMessage.getTimestamp());

  if (readMessage.getSender().getUuid().isPresent()) {
    viewOnceBuilder.setSenderUuid(readMessage.getSender().getUuid().get().toString());
  }

  if (readMessage.getSender().getNumber().isPresent()) {
    viewOnceBuilder.setSenderE164(readMessage.getSender().getNumber().get());
  }

  builder.setViewOnceOpen(viewOnceBuilder.build());

  return container.setSyncMessage(builder).build().toByteArray();
}
 
Example #2
Source File: SignalServiceMessageSender.java    From libsignal-service-java with GNU General Public License v3.0 6 votes vote down vote up
private byte[] createMultiDeviceViewOnceOpenContent(ViewOnceOpenMessage readMessage) {
  Content.Builder                  container       = Content.newBuilder();
  SyncMessage.Builder              builder         = createSyncMessageBuilder();
  SyncMessage.ViewOnceOpen.Builder viewOnceBuilder = SyncMessage.ViewOnceOpen.newBuilder().setTimestamp(readMessage.getTimestamp());

  if (readMessage.getSender().getUuid().isPresent()) {
    viewOnceBuilder.setSenderUuid(readMessage.getSender().getUuid().get().toString());
  }

  if (readMessage.getSender().getNumber().isPresent()) {
    viewOnceBuilder.setSenderE164(readMessage.getSender().getNumber().get());
  }

  builder.setViewOnceOpen(viewOnceBuilder.build());

  return container.setSyncMessage(builder).build().toByteArray();
}
 
Example #3
Source File: MultiDeviceViewOnceOpenJob.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRun() throws IOException, UntrustedIdentityException {
  if (!TextSecurePreferences.isMultiDevice(context)) {
    Log.i(TAG, "Not multi device...");
    return;
  }

  SignalServiceMessageSender messageSender = ApplicationDependencies.getSignalServiceMessageSender();
  Recipient                  recipient     = Recipient.resolved(RecipientId.from(messageId.recipientId));
  ViewOnceOpenMessage        openMessage   = new ViewOnceOpenMessage(RecipientUtil.toSignalServiceAddress(context, recipient), messageId.timestamp);

  messageSender.sendMessage(SignalServiceSyncMessage.forViewOnceOpen(openMessage), UnidentifiedAccessUtil.getAccessForSync(context));
}
 
Example #4
Source File: PushProcessMessageJob.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
private void handleSynchronizeViewOnceOpenMessage(@NonNull ViewOnceOpenMessage openMessage, long envelopeTimestamp) {
  RecipientId   author    = Recipient.externalPush(context, openMessage.getSender()).getId();
  long          timestamp = openMessage.getTimestamp();
  MessageRecord record    = DatabaseFactory.getMmsSmsDatabase(context).getMessageFor(timestamp, author);

  if (record != null && record.isMms()) {
    DatabaseFactory.getAttachmentDatabase(context).deleteAttachmentFilesForViewOnceMessage(record.getId());
  }

  MessageNotifier messageNotifier = ApplicationDependencies.getMessageNotifier();
  messageNotifier.setLastDesktopActivityTimestamp(envelopeTimestamp);
  messageNotifier.cancelDelayedNotifications();
  messageNotifier.updateNotification(context);
}
 
Example #5
Source File: JsonViewOnceOpenMessage.java    From signald with GNU General Public License v3.0 4 votes vote down vote up
JsonViewOnceOpenMessage(ViewOnceOpenMessage message) {
    sender = message.getSender();
    timestamp = message.getTimestamp();
}