mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 853329 - B2G MMS: other Android phones cannot read attachments sent from FFOS. r=vicamo
This commit is contained in:
parent
fd920eef31
commit
3426febdbc
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user