Search in sources :

Example 1 with PduComposer

use of ws.com.google.android.mms.pdu.PduComposer in project Signal-Android by WhisperSystems.

the class IncomingLegacyMmsConnection method sendRetrievedAcknowledgement.

private void sendRetrievedAcknowledgement(byte[] transactionId, boolean usingRadio, boolean useProxy) throws ApnUnavailableException {
    try {
        NotifyRespInd notifyResponse = new NotifyRespInd(PduHeaders.CURRENT_MMS_VERSION, transactionId, PduHeaders.STATUS_RETRIEVED);
        OutgoingLegacyMmsConnection connection = new OutgoingLegacyMmsConnection(context);
        connection.sendNotificationReceived(new PduComposer(context, notifyResponse).make(), usingRadio, useProxy);
    } catch (InvalidHeaderValueException | IOException e) {
        Log.w(TAG, e);
    }
}
Also used : NotifyRespInd(ws.com.google.android.mms.pdu.NotifyRespInd) InvalidHeaderValueException(ws.com.google.android.mms.InvalidHeaderValueException) IOException(java.io.IOException) PduComposer(ws.com.google.android.mms.pdu.PduComposer)

Example 2 with PduComposer

use of ws.com.google.android.mms.pdu.PduComposer in project Signal-Android by WhisperSystems.

the class MmsSendJob method getPduBytes.

private byte[] getPduBytes(SendReq message) throws IOException, UndeliverableMessageException, InsecureFallbackApprovalException {
    String number = TelephonyUtil.getManager(context).getLine1Number();
    message.setBody(SmilUtil.getSmilBody(message.getBody()));
    if (!TextUtils.isEmpty(number)) {
        message.setFrom(new EncodedStringValue(number));
    }
    byte[] pduBytes = new PduComposer(context, message).make();
    if (pduBytes == null) {
        throw new UndeliverableMessageException("PDU composition failed, null payload");
    }
    return pduBytes;
}
Also used : EncodedStringValue(ws.com.google.android.mms.pdu.EncodedStringValue) UndeliverableMessageException(org.thoughtcrime.securesms.transport.UndeliverableMessageException) PduComposer(ws.com.google.android.mms.pdu.PduComposer)

Aggregations

PduComposer (ws.com.google.android.mms.pdu.PduComposer)2 IOException (java.io.IOException)1 UndeliverableMessageException (org.thoughtcrime.securesms.transport.UndeliverableMessageException)1 InvalidHeaderValueException (ws.com.google.android.mms.InvalidHeaderValueException)1 EncodedStringValue (ws.com.google.android.mms.pdu.EncodedStringValue)1 NotifyRespInd (ws.com.google.android.mms.pdu.NotifyRespInd)1