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

The following examples show how to use org.whispersystems.signalservice.api.messages.multidevice.RequestMessage. 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: PushProcessMessageJob.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
private void handleSynchronizeRequestMessage(@NonNull RequestMessage message)
{
  if (message.isContactsRequest()) {
    ApplicationDependencies.getJobManager().add(new MultiDeviceContactUpdateJob(true));
  }

  if (message.isGroupsRequest()) {
    ApplicationDependencies.getJobManager().add(new MultiDeviceGroupUpdateJob());
  }

  if (message.isBlockedListRequest()) {
    ApplicationDependencies.getJobManager().add(new MultiDeviceBlockedUpdateJob());
  }

  if (message.isConfigurationRequest()) {
    ApplicationDependencies.getJobManager().add(new MultiDeviceConfigurationUpdateJob(TextSecurePreferences.isReadReceiptsEnabled(context),
                                                                                      TextSecurePreferences.isTypingIndicatorsEnabled(context),
                                                                                      TextSecurePreferences.isShowUnidentifiedDeliveryIndicatorsEnabled(context),
                                                                                      TextSecurePreferences.isLinkPreviewsEnabled(context)));
    ApplicationDependencies.getJobManager().add(new MultiDeviceStickerPackSyncJob());
  }

  if (message.isKeysRequest()) {
    ApplicationDependencies.getJobManager().add(new MultiDeviceKeysUpdateJob());
  }
}
 
Example #2
Source File: Manager.java    From signal-cli with GNU General Public License v3.0 5 votes vote down vote up
void requestSyncGroups() throws IOException {
    SignalServiceProtos.SyncMessage.Request r = SignalServiceProtos.SyncMessage.Request.newBuilder().setType(SignalServiceProtos.SyncMessage.Request.Type.GROUPS).build();
    SignalServiceSyncMessage message = SignalServiceSyncMessage.forRequest(new RequestMessage(r));
    try {
        sendSyncMessage(message);
    } catch (UntrustedIdentityException e) {
        e.printStackTrace();
    }
}
 
Example #3
Source File: Manager.java    From signal-cli with GNU General Public License v3.0 5 votes vote down vote up
void requestSyncContacts() throws IOException {
    SignalServiceProtos.SyncMessage.Request r = SignalServiceProtos.SyncMessage.Request.newBuilder().setType(SignalServiceProtos.SyncMessage.Request.Type.CONTACTS).build();
    SignalServiceSyncMessage message = SignalServiceSyncMessage.forRequest(new RequestMessage(r));
    try {
        sendSyncMessage(message);
    } catch (UntrustedIdentityException e) {
        e.printStackTrace();
    }
}
 
Example #4
Source File: Manager.java    From signal-cli with GNU General Public License v3.0 5 votes vote down vote up
void requestSyncBlocked() throws IOException {
    SignalServiceProtos.SyncMessage.Request r = SignalServiceProtos.SyncMessage.Request.newBuilder().setType(SignalServiceProtos.SyncMessage.Request.Type.BLOCKED).build();
    SignalServiceSyncMessage message = SignalServiceSyncMessage.forRequest(new RequestMessage(r));
    try {
        sendSyncMessage(message);
    } catch (UntrustedIdentityException e) {
        e.printStackTrace();
    }
}
 
Example #5
Source File: Manager.java    From signal-cli with GNU General Public License v3.0 5 votes vote down vote up
void requestSyncConfiguration() throws IOException {
    SignalServiceProtos.SyncMessage.Request r = SignalServiceProtos.SyncMessage.Request.newBuilder().setType(SignalServiceProtos.SyncMessage.Request.Type.CONFIGURATION).build();
    SignalServiceSyncMessage message = SignalServiceSyncMessage.forRequest(new RequestMessage(r));
    try {
        sendSyncMessage(message);
    } catch (UntrustedIdentityException e) {
        e.printStackTrace();
    }
}
 
Example #6
Source File: SignalServiceCipher.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
private SignalServiceSyncMessage createSynchronizeMessage(SignalServiceProtos.Envelope envelope, SyncMessage content) throws InvalidMessageException {
  if (content.hasSent()) {
    SyncMessage.Sent sentContent = content.getSent();
    return SignalServiceSyncMessage.forSentTranscript(new SentTranscriptMessage(sentContent.getDestination(),
                                                                                sentContent.getTimestamp(),
                                                                                createSignalServiceMessage(envelope, sentContent.getMessage()),
                                                                                sentContent.getExpirationStartTimestamp()));
  }

  if (content.hasRequest()) {
    return SignalServiceSyncMessage.forRequest(new RequestMessage(content.getRequest()));
  }

  if (content.getReadList().size() > 0) {
    List<ReadMessage> readMessages = new LinkedList<>();

    for (SyncMessage.Read read : content.getReadList()) {
      readMessages.add(new ReadMessage(read.getSender(), read.getTimestamp()));
    }

    return SignalServiceSyncMessage.forRead(readMessages);
  }

  if (content.hasVerified()) {
    try {
      Verified    verified    = content.getVerified();
      String      destination = verified.getDestination();
      IdentityKey identityKey = new IdentityKey(verified.getIdentityKey().toByteArray(), 0);

      VerifiedState verifiedState;

      if (verified.getState() == Verified.State.DEFAULT) {
        verifiedState = VerifiedState.DEFAULT;
      } else if (verified.getState() == Verified.State.VERIFIED) {
        verifiedState = VerifiedState.VERIFIED;
      } else if (verified.getState() == Verified.State.UNVERIFIED) {
        verifiedState = VerifiedState.UNVERIFIED;
      } else {
        throw new InvalidMessageException("Unknown state: " + verified.getState().getNumber());
      }

      return SignalServiceSyncMessage.forVerified(new VerifiedMessage(destination, identityKey, verifiedState, System.currentTimeMillis()));
    } catch (InvalidKeyException e) {
      throw new InvalidMessageException(e);
    }
  }

  return SignalServiceSyncMessage.empty();
}
 
Example #7
Source File: PushDecryptJob.java    From bcm-android with GNU General Public License v3.0 4 votes vote down vote up
private void handleSynchronizeRequestMessage(@NonNull RequestMessage message) {
    ALog.i(TAG, "handleSynchronizeRequestMessage");
}