Search in sources :

Example 1 with InvalidHeaderValueException

use of com.google.android.mms.InvalidHeaderValueException in project qksms by moezbhatti.

the class MmsMessageSender method sendReadRec.

public static void sendReadRec(Context context, String to, String messageId, int status) {
    EncodedStringValue[] sender = new EncodedStringValue[1];
    sender[0] = new EncodedStringValue(to);
    try {
        final ReadRecInd readRec = new ReadRecInd(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()), messageId.getBytes(), PduHeaders.CURRENT_MMS_VERSION, status, sender);
        readRec.setDate(System.currentTimeMillis() / 1000);
        boolean group;
        try {
            group = com.moez.QKSMS.mmssms.Transaction.settings.getGroup();
        } catch (Exception e) {
            group = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("pref_key_compose_group", true);
        }
        PduPersister.getPduPersister(context).persist(readRec, Uri.parse("content://mms/outbox"), true, group, null);
        Intent service = new Intent(TransactionService.HANDLE_PENDING_TRANSACTIONS_ACTION, null, context, TransactionService.class);
        context.startService(service);
    } catch (InvalidHeaderValueException e) {
        Log.e(TAG, "Invalide header value", e);
    } catch (MmsException e) {
        Log.e(TAG, "Persist message failed", e);
    }
}
Also used : EncodedStringValue(com.google.android.mms.pdu_alt.EncodedStringValue) MmsException(com.google.android.mms.MmsException) ReadRecInd(com.google.android.mms.pdu_alt.ReadRecInd) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException) Intent(android.content.Intent) MmsException(com.google.android.mms.MmsException) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException)

Example 2 with InvalidHeaderValueException

use of com.google.android.mms.InvalidHeaderValueException in project Signal-Android by signalapp.

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(com.google.android.mms.pdu_alt.NotifyRespInd) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException) IOException(java.io.IOException) PduComposer(com.google.android.mms.pdu_alt.PduComposer)

Example 3 with InvalidHeaderValueException

use of com.google.android.mms.InvalidHeaderValueException in project android-aosp-mms by slvn.

the class MmsMessageSender method sendReadRec.

public static void sendReadRec(Context context, String to, String messageId, int status) {
    EncodedStringValue[] sender = new EncodedStringValue[1];
    sender[0] = new EncodedStringValue(to);
    try {
        final ReadRecInd readRec = new ReadRecInd(new EncodedStringValue(PduHeaders.FROM_INSERT_ADDRESS_TOKEN_STR.getBytes()), messageId.getBytes(), PduHeaders.CURRENT_MMS_VERSION, status, sender);
        readRec.setDate(System.currentTimeMillis() / 1000);
        PduPersister.getPduPersister(context).persist(readRec, Mms.Outbox.CONTENT_URI, true, MessagingPreferenceActivity.getIsGroupMmsEnabled(context), null);
        context.startService(new Intent(context, TransactionService.class));
    } catch (InvalidHeaderValueException e) {
        Log.e(TAG, "Invalide header value", e);
    } catch (MmsException e) {
        Log.e(TAG, "Persist message failed", e);
    }
}
Also used : EncodedStringValue(com.google.android.mms.pdu.EncodedStringValue) MmsException(com.google.android.mms.MmsException) ReadRecInd(com.google.android.mms.pdu.ReadRecInd) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException) Intent(android.content.Intent)

Example 4 with InvalidHeaderValueException

use of com.google.android.mms.InvalidHeaderValueException 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(com.google.android.mms.pdu_alt.NotifyRespInd) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException) IOException(java.io.IOException) PduComposer(com.google.android.mms.pdu_alt.PduComposer)

Example 5 with InvalidHeaderValueException

use of com.google.android.mms.InvalidHeaderValueException in project Signal-Android by signalapp.

the class IncomingLollipopMmsConnection method sendRetrievedAcknowledgement.

private void sendRetrievedAcknowledgement(byte[] transactionId, int mmsVersion, int subscriptionId) {
    try {
        NotifyRespInd retrieveResponse = new NotifyRespInd(mmsVersion, transactionId, PduHeaders.STATUS_RETRIEVED);
        new OutgoingLollipopMmsConnection(getContext()).send(new PduComposer(getContext(), retrieveResponse).make(), subscriptionId);
    } catch (UndeliverableMessageException e) {
        Log.w(TAG, e);
    } catch (InvalidHeaderValueException e) {
        Log.w(TAG, e);
    }
}
Also used : NotifyRespInd(com.google.android.mms.pdu_alt.NotifyRespInd) UndeliverableMessageException(org.thoughtcrime.securesms.transport.UndeliverableMessageException) InvalidHeaderValueException(com.google.android.mms.InvalidHeaderValueException) PduComposer(com.google.android.mms.pdu_alt.PduComposer)

Aggregations

InvalidHeaderValueException (com.google.android.mms.InvalidHeaderValueException)9 EncodedStringValue (com.google.android.mms.pdu_alt.EncodedStringValue)4 NotifyRespInd (com.google.android.mms.pdu_alt.NotifyRespInd)4 PduComposer (com.google.android.mms.pdu_alt.PduComposer)4 IOException (java.io.IOException)4 PduBody (com.google.android.mms.pdu_alt.PduBody)3 PduPart (com.google.android.mms.pdu_alt.PduPart)3 SendReq (com.google.android.mms.pdu_alt.SendReq)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 UndeliverableMessageException (org.thoughtcrime.securesms.transport.UndeliverableMessageException)3 Intent (android.content.Intent)2 MmsException (com.google.android.mms.MmsException)2 Attachment (org.thoughtcrime.securesms.attachments.Attachment)2 MediaConstraints (org.thoughtcrime.securesms.mms.MediaConstraints)2 Recipient (org.thoughtcrime.securesms.recipients.Recipient)2 MMSPart (com.google.android.mms.MMSPart)1 EncodedStringValue (com.google.android.mms.pdu.EncodedStringValue)1 ReadRecInd (com.google.android.mms.pdu.ReadRecInd)1 ReadRecInd (com.google.android.mms.pdu_alt.ReadRecInd)1 SecureRandom (java.security.SecureRandom)1