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+

This commit is contained in:
Gene Lian 2013-03-26 14:01:10 +08:00
Родитель e8b2f06a0f
Коммит b614a50859
1 изменённых файлов: 17 добавлений и 14 удалений

Просмотреть файл

@ -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);
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.
debug("Could not store MMS " + domMessage.id +
", error code " + rv);
let transaction =
new NotifyResponseTransaction(transactionId,
MMS.MMS_PDU_STATUS_DEFERRED,
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. The end user has to
// retrieve the MMS again.
debug("Could not store MMS " + domMessage.id +
", error code " + rv);
return;
}