Closed Bug 761057 Opened 12 years ago Closed 12 years ago

B2G MMS: support sending M-Send.req PDUs

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17
blocking-basecamp -

People

(Reporter: vicamo, Assigned: vicamo)

References

Details

Attachments

(4 files, 7 obsolete files)

9.96 KB, patch
Details | Diff | Splinter Review
87.49 KB, patch
Details | Diff | Splinter Review
10.09 KB, patch
Details | Diff | Splinter Review
2.85 KB, patch
Details | Diff | Splinter Review
This is the protocol part of MMS outgoing messages support. It should open an API that accepts a pre-contructed message object, encode it into a M-Send.req PDU, send it out and process returning M-Send.conf message as well.
Assignee: nobody → vyang
blocking-basecamp: --- → ?
MMS is desired to be ready for basecamp, but does not actually block.
blocking-basecamp: ? → -
Depends on: 775038
Attached patch Part 2: send M-Send.req : WIP (obsolete) — Splinter Review
Attached patch [Debug] DO NOT SUBMIT (obsolete) — Splinter Review
Attachment #645708 - Flags: review?(philipp)
1. support email addressing model, see bug 761069
2. refactor MmsPduHelper.encodeHeader* and add test cases
3. decoded msg.content is an array, so refactor encoder to accept the same type
4. do not use magic pdu type numbers in test script
Attachment #643324 - Attachment is obsolete: true
Attachment #645715 - Flags: review?(philipp)
Attachment #645715 - Attachment description: Part 1: Add required encoders for M-Send.req/M-Send.conf PDU → Part 2: Add required encoders for M-Send.req/M-Send.conf PDU
Attached patch Part 3: send M-Send.req (obsolete) — Splinter Review
use msg.content rather than msg.contentStream
Attachment #643325 - Attachment is obsolete: true
Attachment #645716 - Flags: review?(philipp)
Attached patch [Debug] DO NOT SUBMIT : V2 (obsolete) — Splinter Review
updates for changes made in patch 2, 3
Attachment #643326 - Attachment is obsolete: true
Attachment #645708 - Flags: review?(philipp) → review+
Comment on attachment 645715 [details] [diff] [review]
Part 2: Add required encoders for M-Send.req/M-Send.conf PDU

Review of attachment 645715 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/mms/src/ril/MmsPduHelper.jsm
@@ +115,5 @@
> +      throw new WSP.CodeError("Address: invalid value");
> +    }
> +
> +
> +    let [type, addr] = [value.type, value.address];

Sadly I think this creates at least one array object which seems a bit excessive just to save one line of code.

@@ +117,5 @@
> +
> +
> +    let [type, addr] = [value.type, value.address];
> +    let str;
> +    if (type == "email") {

It seems like a `switch` statement would fit better here.

@@ +122,5 @@
> +      if (addr.indexOf("@") > 0) {
> +        str = addr;
> +      }
> +    } else if (type == "num") {
> +      if (addr.match(/^[\+*#]\d+$/)) {

Please define these RegExps globally. You can `const` them or make them lazy getters on the global scope, e.g.:

  function defineLazyRegExp(obj, name, pattern) {
    obj.__defineGetter__(name, function() {
      delete obj[name];
      return obj[name] = new RegExp(pattern);
    });
  }

  defineLazyRegExp(this, "MMS_ADDR_TYPE_NUM", "^[\+*#]\d+$");
  defineLazyRegExp(this, "MMS_ADDR_TYPE_ALPHANUM", "^\w+$");
  etc.
Attachment #645715 - Flags: review?(philipp) → review+
Comment on attachment 645716 [details] [diff] [review]
Part 3: send M-Send.req

Review of attachment 645716 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/mms/src/ril/MmsService.js
@@ +234,5 @@
> +    msg.headers["x-mms-message-type"] = MMS.MMS_PDU_TYPE_SEND_REQ;
> +    if (!msg.headers["x-mms-transaction-id"]) {
> +      // Create an unique transaction id
> +      let uuidgen = Cc["@mozilla.org/uuid-generator;1"]
> +                    .getService(Ci.nsIUUIDGenerator);

Please use a lazy getter for this in the top scope:

  XPCOMUtils.defineLazyServiceGetter(this, gUUIDGenerator, "@mozilla.org/uuid-generator;1", "nsIUUIDGenerator");
Attachment #645716 - Flags: review?(philipp) → review+
Update r=philikon only. Since these patches were previously reviewed+, won't set review flag here.
Attachment #645708 - Attachment is obsolete: true
Accommodate to comment #9. Thanks Philipp!
Attachment #645715 - Attachment is obsolete: true
Accommodate to comment #10. Thanks Philipp!
Attachment #645716 - Attachment is obsolete: true
add text/plain for easier debug
Attachment #645718 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: