mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-18 23:18:26 +00:00
Send m-notifyresp-ind (NotifyRespInd) for retrieved MMS on Lollipop API
This commit is contained in:
parent
feee09cd28
commit
694a5de2c3
@ -26,10 +26,15 @@ import android.support.annotation.Nullable;
|
|||||||
import android.telephony.SmsManager;
|
import android.telephony.SmsManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.android.mms.InvalidHeaderValueException;
|
||||||
|
import com.google.android.mms.pdu_alt.NotifyRespInd;
|
||||||
|
import com.google.android.mms.pdu_alt.PduComposer;
|
||||||
|
import com.google.android.mms.pdu_alt.PduHeaders;
|
||||||
import com.google.android.mms.pdu_alt.PduParser;
|
import com.google.android.mms.pdu_alt.PduParser;
|
||||||
import com.google.android.mms.pdu_alt.RetrieveConf;
|
import com.google.android.mms.pdu_alt.RetrieveConf;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.providers.MmsBodyProvider;
|
import org.thoughtcrime.securesms.providers.MmsBodyProvider;
|
||||||
|
import org.thoughtcrime.securesms.transport.UndeliverableMessageException;
|
||||||
import org.thoughtcrime.securesms.util.Util;
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
@ -89,7 +94,9 @@ public class IncomingLollipopMmsConnection extends LollipopMmsConnection impleme
|
|||||||
|
|
||||||
Log.w(TAG, baos.size() + "-byte response: ");// + Hex.dump(baos.toByteArray()));
|
Log.w(TAG, baos.size() + "-byte response: ");// + Hex.dump(baos.toByteArray()));
|
||||||
|
|
||||||
return (RetrieveConf) new PduParser(baos.toByteArray()).parse();
|
RetrieveConf retrieved = (RetrieveConf) new PduParser(baos.toByteArray()).parse();
|
||||||
|
sendRetrievedAcknowledgement(transactionId, retrieved.getMmsVersion(), subscriptionId);
|
||||||
|
return retrieved;
|
||||||
} catch (IOException | TimeoutException e) {
|
} catch (IOException | TimeoutException e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
throw new MmsException(e);
|
throw new MmsException(e);
|
||||||
@ -97,4 +104,15 @@ public class IncomingLollipopMmsConnection extends LollipopMmsConnection impleme
|
|||||||
endTransaction();
|
endTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user