diff --git a/src/com/fsck/k9/mail/Message.java b/src/com/fsck/k9/mail/Message.java index 69d65e763..1c1cf3014 100644 --- a/src/com/fsck/k9/mail/Message.java +++ b/src/com/fsck/k9/mail/Message.java @@ -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. diff --git a/src/com/fsck/k9/mail/Part.java b/src/com/fsck/k9/mail/Part.java index 731861b76..38c1ad9da 100644 --- a/src/com/fsck/k9/mail/Part.java +++ b/src/com/fsck/k9/mail/Part.java @@ -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; } diff --git a/src/com/fsck/k9/mail/internet/MimeBodyPart.java b/src/com/fsck/k9/mail/internet/MimeBodyPart.java index 60e3b4cca..1c031df17 100644 --- a/src/com/fsck/k9/mail/internet/MimeBodyPart.java +++ b/src/com/fsck/k9/mail/internet/MimeBodyPart.java @@ -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. */ diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index f2c002e05..c830ce1e8 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -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;