Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 334dc0b2 authored by takuo's avatar takuo
Browse files

Parse "multipart/vnd.wap.multipart.alternative" which is a part of multipart...

Parse "multipart/vnd.wap.multipart.alternative" which is a part of multipart body (nested multipart).

And take the first part of parsed as a parent part data.

Change-Id: I2752654f41d642524061802772e2a7eaa10a4e2d
parent 85ff3fe1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ public class ContentType {
    public static final String MMS_GENERIC       = "application/vnd.wap.mms-generic";
    public static final String MULTIPART_MIXED   = "application/vnd.wap.multipart.mixed";
    public static final String MULTIPART_RELATED = "application/vnd.wap.multipart.related";
    public static final String MULTIPART_ALTERNATIVE = "application/vnd.wap.multipart.alternative";

    public static final String TEXT_PLAIN        = "text/plain";
    public static final String TEXT_HTML         = "text/html";
+25 −17
Original line number Diff line number Diff line
@@ -778,7 +778,14 @@ public class PduParser {
            /* get part's data */
            if (dataLength > 0) {
                byte[] partData = new byte[dataLength];
                String partContentType = new String(part.getContentType());
                pduDataStream.read(partData, 0, dataLength);
                if (partContentType.equalsIgnoreCase(ContentType.MULTIPART_ALTERNATIVE)) {
                    // parse "multipart/vnd.wap.multipart.alternative".
                    PduBody childBody = parseParts(new ByteArrayInputStream(partData));
                    // take the first part of children.
                    part = childBody.getPart(0);
                } else {
                    // Check Content-Transfer-Encoding.
                    byte[] partDataEncoding = part.getContentTransferEncoding();
                    if (null != partDataEncoding) {
@@ -799,6 +806,7 @@ public class PduParser {
                    }
                    part.setData(partData);
                }
            }

            /* add this part to body */
            if (THE_FIRST_PART == checkPartPosition(part)) {