B2G/gecko/dom/mobilemessage/src/ril/MmsService.js
/**
     * Count number of recipients(to, cc, bcc fields).
     *
     * @param recipients
     *        The recipients in MMS message object.
     * @return the number of recipients
     * @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
     */
Count number of recipients(to, cc, bcc fields).
@param recipients
The recipients in MMS message object.
Count number of recipients ( to cc bcc fields ) . @param recipients The recipients in MMS message object .
function countRecipients(recipients) {
      if (recipients && recipients.address) {
        return 1;
      }
      let totalRecipients = 0;
      if (!Array.isArray(recipients)) {
        return 0;
      }
      totalRecipients += recipients.length;
      for (let ix = 0; ix < recipients.length; ++ix) {
        if (recipients[ix].address.length > MMS.MMS_MAX_LENGTH_RECIPIENT) {
          throw new Error("MMS_MAX_LENGTH_RECIPIENT error");
        }
        if (recipients[ix].type === "email") {
          let found = recipients[ix].address.indexOf("<");
          let lenMailbox = recipients[ix].address.length - found;
          if(lenMailbox > MMS.MMS_MAX_LENGTH_MAILBOX_PORTION) {
            throw new Error("MMS_MAX_LENGTH_MAILBOX_PORTION error");
          }
        }
      }
      return totalRecipients;
    }
function countRecipients ( recipients ) { if ( recipients && recipients . address ) { return 1 ; } let totalRecipients = 0 ; if ( ! Array . isArray ( recipients ) ) { return 0 ; } totalRecipients += recipients . length ; for ( let ix = 0 ; ix < recipients . length ; ++ ix ) { if ( recipients [ ix ] . address . length > MMS . MMS_MAX_LENGTH_RECIPIENT ) { throw new Error ( "MMS_MAX_LENGTH_RECIPIENT error" ) ; } if ( recipients [ ix ] . type === "email" ) { let found = recipients [ ix ] . address . indexOf ( "<" ) ; let lenMailbox = recipients [ ix ] . address . length - found ; if ( lenMailbox > MMS . MMS_MAX_LENGTH_MAILBOX_PORTION ) { throw new Error ( "MMS_MAX_LENGTH_MAILBOX_PORTION error" ) ; } } } return totalRecipients ; }
Count number of recipients(to, cc, bcc fields).
Count number of recipients ( to cc bcc fields ) .