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

Commit 5513d5a9 authored by Tobias Baum's avatar Tobias Baum
Browse files

Pulled down getSize from Part to Message which makes ImapBodyPart superfluous

parent d467dca3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ public abstract class Message implements Part, CompositeBody {
        }
        return false;
    }
    
    @Override
    public boolean equals(Object o) {
        if (o == null || !(o instanceof Message)) {
@@ -144,6 +145,8 @@ public abstract class Message implements Part, CompositeBody {
    public abstract String getPreview();
    public abstract boolean hasAttachments();

    public abstract int getSize();

    /*
     * calculateContentPreview
     * Takes a plain text message body as a string.
+1 −2
Original line number Diff line number Diff line
@@ -21,8 +21,6 @@ public interface Part {

    public String[] getHeader(String name) throws MessagingException;

    public int getSize();

    public boolean isMimeType(String mimeType) throws MessagingException;

    public String getMimeType() throws MessagingException;
@@ -42,5 +40,6 @@ public interface Part {
     * @throws MessagingException
     *
     */
    //TODO perhaps it would be clearer to use a flag "force7bit" in writeTo
    public abstract void setUsing7bitTransport() throws MessagingException;
}
+1 −6
Original line number Diff line number Diff line
@@ -20,9 +20,8 @@ import org.apache.james.mime4j.util.MimeUtil;
 * Message.
 */
public class MimeBodyPart extends BodyPart {
    protected MimeHeader mHeader = new MimeHeader();
    protected final MimeHeader mHeader = new MimeHeader();
    protected Body mBody;
    protected int mSize;

    public MimeBodyPart() throws MessagingException {
        this(null);
@@ -125,10 +124,6 @@ public class MimeBodyPart extends BodyPart {
        return getMimeType().equalsIgnoreCase(mimeType);
    }

    public int getSize() {
        return mSize;
    }

    /**
     * Write the MimeMessage out in MIME format.
     */
+1 −20
Original line number Diff line number Diff line
@@ -1834,7 +1834,7 @@ public class ImapStore extends Store {
                         * For each part in the message we're going to add a new BodyPart and parse
                         * into it.
                         */
                        ImapBodyPart bp = new ImapBodyPart();
                        MimeBodyPart bp = new MimeBodyPart();
                        if (id.equalsIgnoreCase("TEXT")) {
                            parseBodyStructure(bs.getList(i), bp, Integer.toString(i + 1));
                        } else {
@@ -1970,10 +1970,6 @@ public class ImapStore extends Store {

                if (part instanceof ImapMessage) {
                    ((ImapMessage) part).setSize(size);
                } else if (part instanceof ImapBodyPart) {
                    ((ImapBodyPart) part).setSize(size);
                } else {
                    throw new MessagingException("Unknown part type " + part.toString());
                }
                part.setHeader(MimeHeader.HEADER_ANDROID_ATTACHMENT_STORE_DATA, id);
            }
@@ -2931,11 +2927,6 @@ public class ImapStore extends Store {
            this.mSize = size;
        }

        @Override
        public void parse(InputStream in) throws IOException, MessagingException {
            super.parse(in);
        }

        public void setFlagInternal(Flag flag, boolean set) throws MessagingException {
            super.setFlag(flag, set);
        }
@@ -2953,16 +2944,6 @@ public class ImapStore extends Store {
        }
    }

    static class ImapBodyPart extends MimeBodyPart {
        public ImapBodyPart() throws MessagingException {
            super();
        }

        public void setSize(int size) {
            this.mSize = size;
        }
    }

    static class ImapException extends MessagingException {
        private static final long serialVersionUID = 3725007182205882394L;
        String mAlertText;