Bug 853329 - B2G MMS: other Android phones cannot read attachments sent from FFOS. r=vicamo

This commit is contained in:
Gene Lian 2013-03-21 16:19:20 +08:00
parent f70fb08d9a
commit bef21a7253
2 changed files with 32 additions and 17 deletions

View File

@ -1135,6 +1135,24 @@ MmsService.prototype = {
debug("handleDeliveryIndication: got delivery report for " + messageId);
},
/**
* A utility function to convert the MmsParameters dictionary object
* to a database-savable message.
*
* @param aParams
* The MmsParameters dictionay object.
*
* Notes:
*
* OMA-TS-MMS-CONF-V1_3-20110913-A section 10.2.2 "Message Content Encoding":
*
* A name for multipart object SHALL be encoded using name-parameter for Content-Type
* header in WSP multipart headers. In decoding, name-parameter of Content-Type SHALL
* be used if available. If name-parameter of Content-Type is not available, filename
* parameter of Content-Disposition header SHALL be used if available. If neither
* name-parameter of Content-Type header nor filename parameter of Content-Disposition
* header is available, Content-Location header SHALL be used if available.
*/
createSavableFromParams: function createSavableFromParams(aParams) {
debug("createSavableFromParams: aParams: " + JSON.stringify(aParams));
let message = {};
@ -1181,13 +1199,17 @@ MmsService.prototype = {
for (let i = 0; i < attachments.length; i++) {
let attachment = attachments[i];
let content = attachment.content;
let location = attachment.location;
let part = {
"headers": {
"content-type": {
"media": content.type
"media": content.type,
"params": {
"name": location
}
},
"content-length": content.size,
"content-location": attachment.location,
"content-location": location,
"content-id": attachment.id
},
"content": content

View File

@ -575,6 +575,9 @@ MobileMessageDatabaseService.prototype = {
aMessageRecord.read);
} else if (aMessageRecord.type == "mms") {
let headers = aMessageRecord["headers"];
if (DEBUG) {
debug("MMS: headers: " + JSON.stringify(headers));
}
let subject = headers["subject"];
if (subject == undefined) {
@ -587,11 +590,15 @@ MobileMessageDatabaseService.prototype = {
if (parts) {
for (let i = 0; i < parts.length; i++) {
let part = parts[i];
if (DEBUG) {
debug("MMS: part[" + i + "]: " + JSON.stringify(part));
}
let partHeaders = part["headers"];
let partContent = part["content"];
// Don't need to make the SMIL part if it's present.
if (partHeaders["content-type"]["media"] == "application/smil") {
smil = part.content;
smil = partContent;
continue;
}
attachments.push({
@ -601,20 +608,6 @@ MobileMessageDatabaseService.prototype = {
});
}
}
if (DEBUG) {
debug("createDomMessageFromRecord: createMmsMessage: " + JSON.stringify({
id: aMessageRecord.id,
delivery: aMessageRecord.delivery,
deliveryStatus: aMessageRecord.deliveryStatus,
sender: aMessageRecord.sender,
receivers: aMessageRecord.receivers,
timestamp: aMessageRecord.timestamp,
read: aMessageRecord.read,
subject: subject,
smil: smil,
attachments: attachments
}));
}
return gMobileMessageService.createMmsMessage(aMessageRecord.id,
aMessageRecord.delivery,
aMessageRecord.deliveryStatus,