1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-23 18:02:15 -05:00

Pulled down getSize from Part to Message which makes ImapBodyPart superfluous

This commit is contained in:
Tobias Baum 2014-09-14 11:11:48 +02:00
parent d467dca32c
commit 5513d5a99b
4 changed files with 6 additions and 28 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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.
*/

View File

@ -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;