diff --git a/src/com/fsck/k9/mail/Body.java b/src/com/fsck/k9/mail/Body.java index 7b18a75a7..93960892c 100644 --- a/src/com/fsck/k9/mail/Body.java +++ b/src/com/fsck/k9/mail/Body.java @@ -8,7 +8,21 @@ import java.io.OutputStream; import com.fsck.k9.mail.store.UnavailableStorageException; public interface Body { + /** + * Returns the raw data of the body, without transfer encoding etc applied. + * TODO perhaps it would be better to have an intermediate "simple part" class where this method could reside + * because it makes no sense for multiparts + */ public InputStream getInputStream() throws MessagingException; + + /** + * Sets the content transfer encoding (7bit, 8bit, quoted-printable or base64). + */ public void setEncoding(String encoding) throws UnavailableStorageException, MessagingException; + + /** + * Writes the body's data to the given {@link OutputStream}. + * The written data is transfer encoded (e.g. transformed to Base64 when needed). + */ public void writeTo(OutputStream out) throws IOException, MessagingException; } diff --git a/src/com/fsck/k9/mail/BodyPart.java b/src/com/fsck/k9/mail/BodyPart.java index 163fe7ba6..1118304ba 100644 --- a/src/com/fsck/k9/mail/BodyPart.java +++ b/src/com/fsck/k9/mail/BodyPart.java @@ -14,5 +14,6 @@ public abstract class BodyPart implements Part { public abstract void setEncoding(String encoding) throws MessagingException; + @Override public abstract void setUsing7bitTransport() throws MessagingException; } diff --git a/src/com/fsck/k9/mail/MessagingException.java b/src/com/fsck/k9/mail/MessagingException.java index b5f563a1b..d33014603 100644 --- a/src/com/fsck/k9/mail/MessagingException.java +++ b/src/com/fsck/k9/mail/MessagingException.java @@ -28,9 +28,9 @@ public class MessagingException extends Exception { return permanentFailure; } + //TODO setters in Exception are bad style, remove (it's nearly unused anyway) public void setPermanentFailure(boolean permanentFailure) { this.permanentFailure = permanentFailure; } - } diff --git a/src/com/fsck/k9/mail/transport/SmtpTransport.java b/src/com/fsck/k9/mail/transport/SmtpTransport.java index 0b2ef25d8..8c6d178b4 100644 --- a/src/com/fsck/k9/mail/transport/SmtpTransport.java +++ b/src/com/fsck/k9/mail/transport/SmtpTransport.java @@ -511,6 +511,7 @@ public class SmtpTransport extends Transport { if (mLargestAcceptableMessage > 0 && ((LocalMessage)message).hasAttachments()) { if (message.calculateSize() > mLargestAcceptableMessage) { MessagingException me = new MessagingException("Message too large for server"); + //TODO this looks rather suspicious... shouldn't it be true? me.setPermanentFailure(possibleSend); throw me; } @@ -545,14 +546,13 @@ public class SmtpTransport extends Transport { possibleSend = false; } + //TODO this looks rather suspicious... why is possibleSend used, and why are 5xx NOT permanent (in contrast to the log text) me.setPermanentFailure(possibleSend); throw me; } finally { close(); } - - } @Override