mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 09:52:25 +00:00
Send m-notifyresp-ind after retrieving MMS
This commit is contained in:
@@ -174,7 +174,7 @@ public class MmsCommunication {
|
||||
|
||||
protected static byte[] parseResponse(HttpEntity entity) throws IOException {
|
||||
if (entity == null || entity.getContentLength() == 0)
|
||||
throw new IOException("Null response");
|
||||
return null;
|
||||
|
||||
if (entity.getContentLength() < 0)
|
||||
throw new IOException("Unknown content length!");
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.net.URISyntaxException;
|
||||
public class MmsDownloadHelper extends MmsCommunication {
|
||||
|
||||
private static byte[] makeRequest(Context context, MmsConnectionParameters connectionParameters, String url)
|
||||
throws ClientProtocolException, IOException
|
||||
throws IOException
|
||||
{
|
||||
AndroidHttpClient client = null;
|
||||
|
||||
@@ -82,6 +82,10 @@ public class MmsDownloadHelper extends MmsCommunication {
|
||||
|
||||
byte[] pdu = makeRequest(context, connectionParameters, url);
|
||||
|
||||
if (pdu == null) {
|
||||
throw new IOException("Retrieved null PDU!");
|
||||
}
|
||||
|
||||
RetrieveConf retrieved = (RetrieveConf)new PduParser(pdu).parse();
|
||||
|
||||
if (retrieved == null) {
|
||||
|
||||
@@ -54,7 +54,6 @@ public class MmsSendHelper extends MmsCommunication {
|
||||
request.setEntity(entity);
|
||||
request.setParams(client.getParams());
|
||||
request.addHeader("Accept", "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic");
|
||||
// request.addHeader("x-wap-profile", "http://www.htcmms.com.tw/Android/Common/nexusone/ua-profile.xml");
|
||||
request.addHeader("x-wap-profile", "http://www.google.com/oha/rdf/ua-profile-kila.xml");
|
||||
HttpResponse response = client.execute(target, request);
|
||||
StatusLine status = response.getStatusLine();
|
||||
@@ -72,16 +71,35 @@ public class MmsSendHelper extends MmsCommunication {
|
||||
}
|
||||
}
|
||||
|
||||
public static void sendNotificationReceived(Context context, byte[] mms, String apn,
|
||||
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
||||
throws IOException
|
||||
{
|
||||
sendBytes(context, mms, apn, usingMmsRadio, useProxyIfAvailable);
|
||||
}
|
||||
|
||||
public static SendConf sendMms(Context context, byte[] mms, String apn,
|
||||
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
||||
throws IOException
|
||||
{
|
||||
byte[] response = sendBytes(context, mms, apn, usingMmsRadio, useProxyIfAvailable);
|
||||
|
||||
if (response == null) {
|
||||
throw new IOException("Got null response!");
|
||||
}
|
||||
|
||||
return (SendConf) new PduParser(response).parse();
|
||||
}
|
||||
|
||||
private static byte[] sendBytes(Context context, byte[] mms, String apn,
|
||||
boolean usingMmsRadio, boolean useProxyIfAvailable)
|
||||
throws IOException
|
||||
{
|
||||
Log.w("MmsSender", "Sending MMS of length: " + mms.length);
|
||||
try {
|
||||
MmsConnectionParameters parameters = getMmsConnectionParameters(context, apn, useProxyIfAvailable);
|
||||
checkRouteToHost(context, parameters, parameters.getMmsc(), usingMmsRadio);
|
||||
byte[] response = makePost(context, parameters, mms);
|
||||
return (SendConf) new PduParser(response).parse();
|
||||
return makePost(context, parameters, mms);
|
||||
} catch (ApnUnavailableException aue) {
|
||||
Log.w("MmsSender", aue);
|
||||
throw new IOException("Failed to get MMSC information...");
|
||||
|
||||
Reference in New Issue
Block a user