use of org.whispersystems.signalservice.api.messages.SignalServiceDataMessage in project Signal-Android by WhisperSystems.
the class PushTextSendJob method deliver.
private void deliver(SmsMessageRecord message) throws UntrustedIdentityException, InsecureFallbackApprovalException, RetryLaterException {
try {
SignalServiceAddress address = getPushAddress(message.getIndividualRecipient().getNumber());
SignalServiceMessageSender messageSender = messageSenderFactory.create();
SignalServiceDataMessage textSecureMessage = SignalServiceDataMessage.newBuilder().withTimestamp(message.getDateSent()).withBody(message.getBody().getBody()).withExpiration((int) (message.getExpiresIn() / 1000)).asEndSessionMessage(message.isEndSession()).build();
messageSender.sendMessage(address, textSecureMessage);
} catch (InvalidNumberException | UnregisteredUserException e) {
Log.w(TAG, e);
throw new InsecureFallbackApprovalException(e);
} catch (IOException e) {
Log.w(TAG, e);
throw new RetryLaterException(e);
}
}
Aggregations