From b614a50859684fa6a22148ce437cf6c2025ee466 Mon Sep 17 00:00:00 2001 From: Gene Lian Date: Tue, 26 Mar 2013 14:01:10 +0800 Subject: [PATCH] Bug 854422 - B2G MMS: should call .NotifyResponseTransaction() with MMS_PDU_STATUS_RETRIEVED after an MMS is retrieved under the RETRIEVAL_MODE_AUTOMATIC mode (a follow-up for bug 845643). r=vicamo,ctai a=approval-mozilla-b2g18+ --- dom/mms/src/ril/MmsService.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/dom/mms/src/ril/MmsService.js b/dom/mms/src/ril/MmsService.js index 915df639bdef..9df11be34c58 100644 --- a/dom/mms/src/ril/MmsService.js +++ b/dom/mms/src/ril/MmsService.js @@ -1098,20 +1098,21 @@ MmsService.prototype = { // For RETRIEVAL_MODE_AUTOMATIC, proceed to retrieve MMS. this.retrieveMessage(url, (function responseNotify(mmsStatus, retrievedMessage) { + debug("retrievedMessage = " + JSON.stringify(retrievedMessage)); + // The absence of the field does not indicate any default // value. So we go check the same field in the retrieved // message instead. - if ((wish == null) && retrievedMessage) { + if (wish == null && retrievedMessage) { wish = retrievedMessage.headers["x-mms-delivery-report"]; } let reportAllowed = this.getReportAllowed(this.confSendDeliveryReport, wish); - // Should update the retrievedStatus in database. - debug("retrievedMessage = " + JSON.stringify(retrievedMessage)); - - // If the mmsStatus is still MMS_PDU_STATUS_DEFERRED after retry, - // we should not store it into database. + // If the mmsStatus isn't MMS_PDU_STATUS_RETRIEVED after retrieving, + // something must be wrong with MMSC, so stop updating the DB record. + // We could send a message to content to notify the user the MMS + // retrieving failed. The end user has to retrieve the MMS again. if (MMS.MMS_PDU_STATUS_RETRIEVED !== mmsStatus) { let transaction = new NotifyResponseTransaction(transactionId, @@ -1127,18 +1128,20 @@ MmsService.prototype = { gMobileMessageDatabaseService.saveReceivedMessage(savableMessage, (function (rv, domMessage) { let success = Components.isSuccessCode(rv); + let transaction = + new NotifyResponseTransaction(transactionId, + success ? MMS.MMS_PDU_STATUS_RETRIEVED + : MMS.MMS_PDU_STATUS_DEFERRED, + reportAllowed); + transaction.run(); + if (!success) { // At this point we could send a message to content to - // notify the user that storing an incoming MMS failed, most - // likely due to a full disk. + // notify the user that storing an incoming MMS failed, + // most likely due to a full disk. The end user has to + // retrieve the MMS again. debug("Could not store MMS " + domMessage.id + ", error code " + rv); - - let transaction = - new NotifyResponseTransaction(transactionId, - MMS.MMS_PDU_STATUS_DEFERRED, - reportAllowed); - transaction.run(); return; }