Bug 869841 - B2G MMS: Gaia cannot get request returned after calling .sendMMS(...). r=vicamo a=leo+

This commit is contained in:
Gene Lian 2013-05-08 18:40:41 +08:00
Родитель f042f8e0de
Коммит c4e74c492d
1 изменённых файлов: 30 добавлений и 6 удалений

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

@ -1077,7 +1077,8 @@ MmsService.prototype = {
},
/**
* A helper function to broadcast the mms sent system message and notify observers.
* A helper function to broadcast system message and notify observers that
* an MMS is sent.
*
* @params aDomMessage
* The nsIDOMMozMmsMessage object.
@ -1091,7 +1092,8 @@ MmsService.prototype = {
},
/**
* A helper function to broadcast the mms received system message and notify observers.
* A helper function to broadcast system message and notify observers that
* an MMS is received.
*
* @params aDomMessage
* The nsIDOMMozMmsMessage object.
@ -1100,7 +1102,7 @@ MmsService.prototype = {
// Broadcasting a 'sms-received' system message to open apps.
this.broadcastMmsSystemMessage("sms-received", aDomMessage);
// Notifying observers an MMS message is comming.
// Notifying observers an MMS message is received.
Services.obs.notifyObservers(aDomMessage, kSmsReceivedObserverTopic, null);
},
@ -1142,6 +1144,12 @@ MmsService.prototype = {
gMobileMessageDatabaseService.saveReceivedMessage(savableMessage,
(function (rv, domMessage) {
let success = Components.isSuccessCode(rv);
// Cite 6.2.1 "Transaction Flow" in OMA-TS-MMS_ENC-V1_3-20110913-A:
// The M-NotifyResp.ind response PDU SHALL provide a message retrieval
// status code. The status retrieved SHALL be used only if the MMS
// Client has successfully retrieved the MM prior to sending the
// NotifyResp.ind response PDU.
let transaction =
new NotifyResponseTransaction(transactionId,
success ? MMS.MMS_PDU_STATUS_RETRIEVED
@ -1219,7 +1227,10 @@ MmsService.prototype = {
// For RETRIEVAL_MODE_AUTOMATIC or RETRIEVAL_MODE_AUTOMATIC_HOME but not
// roaming, proceed to retrieve MMS.
this.retrieveMessage(url, this.retrieveMessageCallback.bind(this, wish, savableMessage));
this.retrieveMessage(url,
this.retrieveMessageCallback.bind(this,
wish,
savableMessage));
},
/**
@ -1389,7 +1400,11 @@ MmsService.prototype = {
if (DEBUG) debug("Send MMS successful. aParams.receivers = " +
JSON.stringify(aParams.receivers));
self.broadcastSentMessageEvent(domMessage);
// Notifying observers the MMS message is sent.
self.broadcastSentMessageEvent(aDomMessage);
// Return the request after sending the MMS message successfully.
aRequest.notifyMessageSent(aDomMessage);
});
};
@ -1490,9 +1505,18 @@ MmsService.prototype = {
aRequest.notifyGetMessageFailed(Ci.nsIMobileMessageCallback.INTERNAL_ERROR);
return;
}
// Notifying observers a new MMS message is retrieved.
aRequest.notifyMessageGot(domMessage);
this.broadcastReceivedMessageEvent(domMessage);
// Return the request after retrieving the MMS message successfully.
aRequest.notifyMessageGot(domMessage);
// Cite 6.3.1 "Transaction Flow" in OMA-TS-MMS_ENC-V1_3-20110913-A:
// If an acknowledgement is requested, the MMS Client SHALL respond
// with an M-Acknowledge.ind PDU to the MMS Proxy-Relay that supports
// the specific MMS Client. The M-Acknowledge.ind PDU confirms
// successful message retrieval to the MMS Proxy Relay.
let transaction = new AcknowledgeTransaction(transactionId, reportAllowed);
transaction.run();
}).bind(this));