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

The following examples show how to use org.whispersystems.signalservice.api.messages.multidevice.ConfigurationMessage. 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[] createMultiDeviceConfigurationContent(ConfigurationMessage configuration) {
  Content.Builder                   container            = Content.newBuilder();
  SyncMessage.Builder               syncMessage          = createSyncMessageBuilder();
  SyncMessage.Configuration.Builder configurationMessage = SyncMessage.Configuration.newBuilder();

  if (configuration.getReadReceipts().isPresent()) {
    configurationMessage.setReadReceipts(configuration.getReadReceipts().get());
  }

  if (configuration.getUnidentifiedDeliveryIndicators().isPresent()) {
    configurationMessage.setUnidentifiedDeliveryIndicators(configuration.getUnidentifiedDeliveryIndicators().get());
  }

  if (configuration.getTypingIndicators().isPresent()) {
    configurationMessage.setTypingIndicators(configuration.getTypingIndicators().get());
  }

  if (configuration.getLinkPreviews().isPresent()) {
    configurationMessage.setLinkPreviews(configuration.getLinkPreviews().get());
  }

  configurationMessage.setProvisioningVersion(ProvisioningProtos.ProvisioningVersion.CURRENT_VALUE);

  return container.setSyncMessage(syncMessage.setConfiguration(configurationMessage)).build().toByteArray();
}
 
Example #2
Source File: PushProcessMessageJob.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private void handleSynchronizeConfigurationMessage(@NonNull ConfigurationMessage configurationMessage) {
  if (configurationMessage.getReadReceipts().isPresent()) {
    TextSecurePreferences.setReadReceiptsEnabled(context, configurationMessage.getReadReceipts().get());
  }

  if (configurationMessage.getUnidentifiedDeliveryIndicators().isPresent()) {
    TextSecurePreferences.setShowUnidentifiedDeliveryIndicatorsEnabled(context, configurationMessage.getReadReceipts().get());
  }

  if (configurationMessage.getTypingIndicators().isPresent()) {
    TextSecurePreferences.setTypingIndicatorsEnabled(context, configurationMessage.getTypingIndicators().get());
  }

  if (configurationMessage.getLinkPreviews().isPresent()) {
    TextSecurePreferences.setLinkPreviewsEnabled(context, configurationMessage.getReadReceipts().get());
  }
}
 
Example #3
Source File: JsonConfigurationMessage.java    From signald with GNU General Public License v3.0 6 votes vote down vote up
JsonConfigurationMessage(ConfigurationMessage verifiedMessage) {
  if(verifiedMessage.getReadReceipts().isPresent()) {
    readReceipts = verifiedMessage.getReadReceipts().get();
  }

  if(verifiedMessage.getUnidentifiedDeliveryIndicators().isPresent()) {
    unidentifiedDeliveryIndicators = verifiedMessage.getUnidentifiedDeliveryIndicators().get();
  }

  if(verifiedMessage.getTypingIndicators().isPresent()) {
    typingIndicators = verifiedMessage.getTypingIndicators().get();
  }

  if(verifiedMessage.getLinkPreviews().isPresent()) {
    linkPreviews = verifiedMessage.getLinkPreviews().get();
  }
}
 
Example #4
Source File: SignalServiceMessageSender.java    From libsignal-service-java with GNU General Public License v3.0 6 votes vote down vote up
private byte[] createMultiDeviceConfigurationContent(ConfigurationMessage configuration) {
  Content.Builder                   container            = Content.newBuilder();
  SyncMessage.Builder               syncMessage          = createSyncMessageBuilder();
  SyncMessage.Configuration.Builder configurationMessage = SyncMessage.Configuration.newBuilder();

  if (configuration.getReadReceipts().isPresent()) {
    configurationMessage.setReadReceipts(configuration.getReadReceipts().get());
  }

  if (configuration.getUnidentifiedDeliveryIndicators().isPresent()) {
    configurationMessage.setUnidentifiedDeliveryIndicators(configuration.getUnidentifiedDeliveryIndicators().get());
  }

  if (configuration.getTypingIndicators().isPresent()) {
    configurationMessage.setTypingIndicators(configuration.getTypingIndicators().get());
  }

  if (configuration.getLinkPreviews().isPresent()) {
    configurationMessage.setLinkPreviews(configuration.getLinkPreviews().get());
  }

  configurationMessage.setProvisioningVersion(ProvisioningProtos.ProvisioningVersion.CURRENT_VALUE);

  return container.setSyncMessage(syncMessage.setConfiguration(configurationMessage)).build().toByteArray();
}
 
Example #5
Source File: MultiDeviceConfigurationUpdateJob.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, aborting...");
    return;
  }

  SignalServiceMessageSender messageSender = ApplicationDependencies.getSignalServiceMessageSender();
  messageSender.sendMessage(SignalServiceSyncMessage.forConfiguration(new ConfigurationMessage(Optional.of(readReceiptsEnabled),
                                                                                               Optional.of(unidentifiedDeliveryIndicatorsEnabled),
                                                                                               Optional.of(typingIndicatorsEnabled),
                                                                                               Optional.of(linkPreviewsEnabled))),
                            UnidentifiedAccessUtil.getAccessForSync(context));
}