Commit Graph

22 Commits

Author SHA1 Message Date
Tobias Baum b6079d6460 UCDetector warnings: Made things private, deleted unused methods and fields 2014-09-22 21:52:59 +02:00
Tobias Baum 5513d5a99b Pulled down getSize from Part to Message which makes ImapBodyPart superfluous 2014-09-14 11:11:48 +02:00
Joe Steele 1ca1ef5c84 Content-type case-conversion changes.
Don't convert the content-type to lower case in
MimeMessage.getContentType.  The content-type may have optional parameters
that are case sensitive (boundary, name).

In removing the lower-case conversion from getContentType, a review was
made for inappropriate case-sensitive comparisons which use data obtained
with getContentType.  The only ones found were in isMimeType in both
Message and MimeBodyPart.

Case-sensitive instances of isMimeType were made case-insensitive.  Also,
isMimeType was moved from Message to MimeMessage for symmetry with
MimeBodyPart (MimeMessage & MimeBodyPart are similar and contain a good
bit of duplication such as this).

The unit test required fixing now that the case of the boundary text is
preserved.

References:

Commits 2c5186 and dc4002 added the toLowerCase to getContentType in
MimeMessage & MimeBodyPart (Issue 94).

Later, commit 50cd60 removed the toLowerCase addition from MimeBodyPart
(Issue 1289).
2013-09-03 19:54:18 -04:00
Joe Steele 63f68328ff Standardize line breaks within headers.
Fix the unit test to match.

All line endings in the unit test are now the same.

(Just for consistency.  Not a big deal, since such problems are fixed when
the messages are run through EOLConvertingOutputStream.)
2013-09-03 19:54:17 -04:00
Joe Steele 45e3d8459e Recursively convert attachments of type message/rfc822 to 7bit if necessary.
The preceding commit resulted in attachments of type message/rfc822 being
sent with 8bit encoding even when the SMTP server did not support
8BITMIME.  This commit assures that messages will be converted to 7bit
when necessary.

A new interface CompositeBody was created that extends Body, and classes
Message and Multipart were changed from implementing Body to
CompositeBody.  Additional classes BinaryTempFileMessageBody and
LocalAttachmentMessageBody were created (by extending BinaryTempFileBody
and LocalAttachmentBody, respectively), and they too implement
CompositeBody.

A CompositeBody is a Body containing a composite-type that can contain
subparts that may require recursive processing when converting from 8bit
to 7bit.  The Part to which a CompositeBody belongs is only permitted to
use 8bit or 7bit encoding for the CompositeBody.

Previously, a Message was created so that it was 7bit clean by default
(even though that meant base64 encoding all attachments, including
messages).  Then, if the SMTP server supported 8BITMIME,
Message.setEncoding("8bit") was called so that bodies of type TextBody
would been transmitted using 8bit encoding rather than quoted-printable.

Now, messages are created with 8bit encoding by default.  Then, if the
SMTP server does not support 8BITMIME, Message.setUsing7bitTransport is
called to recursively convert the message and its subparts to 7bit.  The
method setUsing7bitTransport was added to the interfaces Part and
CompositeBody.

setEncoding no longer iterates over parts in Multipart.  That task belongs
to setUsing7bitTransport, which may in turn call setEncoding on the parts.

MimeUtility.getEncodingforType was created as a helper function for
choosing a default encoding that should be used for a given MIME type when
an attachment is added to a message (either while composing or when
retrieving from LocalStore).

setEncoding was implemented in MimeBodyPart to assure that the encoding
set in the Part's headers was the same as set for the Part's Body.  (The
method already existed in MimeMessage, which has similarities with
MimeBodyPart.)

MimeMessage.parse(InputStream in, boolean recurse) was implemented so that
the parser could be told to recursively process nested messages read from
the InputStream, thus giving access to all subparts at any level that may
need to be converted from 8bit to 7bit.
2013-09-03 19:53:13 -04:00
Jesse Vincent 2a698f1ab9 ant astyle 2011-07-02 15:18:43 -04:00
cketti 222cd43c80 Some code cleanup. No functional changes. 2011-06-17 04:13:32 +02:00
Jesse Vincent 12d1097a24 Big, scary massive "ant astyle" to get us back to something
approximating AOSP coding standards.
2011-02-06 17:09:48 -05:00
Jesse Vincent f5eb6e03af astyle 2010-12-01 06:32:29 +00:00
Jesse Vincent c79ea226a5 Remove "throws" declarations that didn't actually get thrown. Remove a
couple of try blocks that only caught throws we didn't throw. IntelliJ
optimization.
2010-12-01 03:02:13 +00:00
Jesse Vincent 70a1eef943 astyle 2010-07-13 21:16:56 +00:00
Koji Arai 28d3967d0f Fixes issue 305
Support Content-Id header to show inline images.
2010-07-11 13:44:16 +00:00
cketti 50cd60787f Don't convert MIME content-type headers to lower case as this seems to cause problems.
Thanks to xingwang.xu for the analysis.

Fixes issue 1289
2010-03-25 14:39:07 +00:00
cketti c64c0a1c30 Replaced base64 as default encoding for text bodies with quoted-printable. Please use issue 1176 for discussion. 2010-02-05 14:26:09 +00:00
Daniel Applebaum ef1abffa26 Revert r1386 because it will break many folks email sending. 2010-01-31 19:11:51 +00:00
Daniel Applebaum a91e3e10e2 May have some beneficial impact on Issue 21 and Issue 799.
Just removes the base64 encoding on the text/plain body parts.  Does
not make the sent messages non-multipart.
2010-01-31 15:26:02 +00:00
Jesse Vincent f31b2702a4 Massive rename to K9, step 1.
Conflicts:

	src/com/android/email/Email.java
2009-12-15 02:50:53 +00:00
Jesse Vincent eedfc0a839 step 1 of rename 2008-12-16 23:07:33 +00:00
Jesse Vincent 5491dee81b Damn it. Weird symlink-in-checkout bug. There goes our commit history. Sorry, all.
Guess I should go back to svk
2008-11-01 21:32:06 +00:00
Jesse Vincent 12c6e53141 bin directory should never have been checked in 2008-11-01 21:23:45 +00:00
Jesse Vincent c00ec35921 Grand insane rename, step 3 2008-10-28 01:22:17 +00:00
Jesse Vincent 7051cf8cc0 move step 2 2008-10-28 01:19:57 +00:00