B2G/gecko/dom/mobilemessage/src/ril/MmsService.js
/**
     * Check maximum values of MMS parameters.
     *
     * @param msg
     *        The MMS message object.
     * @return true if the lengths are less than the maximum values of MMS
     *         parameters.
     * @see OMA-TS-MMS_CONF-V1_3-20110511-C section 10.2.5
     */
Check maximum values of MMS parameters.
@param msg
The MMS message object.
@return true if the lengths are less than the maximum values of MMS
parameters.
Check maximum values of MMS parameters . @param msg The MMS message object . @return true if the lengths are less than the maximum values of MMS parameters .
function checkMaxValuesParameters(msg) {
      let subject = msg.headers["subject"];
      if (subject && subject.length > MMS.MMS_MAX_LENGTH_SUBJECT) {
        return false;
      }
      let totalRecipients = 0;
      try {
        totalRecipients += this.countRecipients(msg.headers["to"]);
        totalRecipients += this.countRecipients(msg.headers["cc"]);
        totalRecipients += this.countRecipients(msg.headers["bcc"]);
      } catch (ex) {
        if (DEBUG) debug("Exception caught : " + ex);
        return false;
      }
      if (totalRecipients < 1 ||
          totalRecipients > MMS.MMS_MAX_TOTAL_RECIPIENTS) {
        return false;
      }
      if (!Array.isArray(msg.parts)) {
        return true;
      }
      for (let i = 0; i < msg.parts.length; i++) {
        if (msg.parts[i].headers["content-type"] &&
          msg.parts[i].headers["content-type"].params) {
          let name = msg.parts[i].headers["content-type"].params["name"];
          if (name && name.length > MMS.MMS_MAX_LENGTH_NAME_CONTENT_TYPE) {
            return false;
          }
        }
      }
      return true;
    }
function checkMaxValuesParameters ( msg ) { let subject = msg . headers [ "subject" ] ; if ( subject && subject . length > MMS . MMS_MAX_LENGTH_SUBJECT ) { return false ; } let totalRecipients = 0 ; try { totalRecipients += this . countRecipients ( msg . headers [ "to" ] ) ; totalRecipients += this . countRecipients ( msg . headers [ "cc" ] ) ; totalRecipients += this . countRecipients ( msg . headers [ "bcc" ] ) ; } catch ( ex ) { if ( DEBUG ) debug ( "Exception caught : " + ex ) ; return false ; } if ( totalRecipients < 1 || totalRecipients > MMS . MMS_MAX_TOTAL_RECIPIENTS ) { return false ; } if ( ! Array . isArray ( msg . parts ) ) { return true ; } for ( let i = 0 ; i < msg . parts . length ; i ++ ) { if ( msg . parts [ i ] . headers [ "content-type" ] && msg . parts [ i ] . headers [ "content-type" ] . params ) { let name = msg . parts [ i ] . headers [ "content-type" ] . params [ "name" ] ; if ( name && name . length > MMS . MMS_MAX_LENGTH_NAME_CONTENT_TYPE ) { return false ; } } } return true ; }
Check maximum values of MMS parameters.
Check maximum values of MMS parameters .