1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00
Commit Graph

152 Commits

Author SHA1 Message Date
Joe Steele
1d1db50a9f Don't always base64 encode in BinaryTempFileBody.writeTo
Issue 5734 exemplifies the problem:  receive a message with an attachment
of type message/rfc822 that doesn't use base64 encoding for the body of
the attached message.  K-9 Mail incorrectly stores the attached message
locally with its original headers but using base64 encoding for the body.
A discrepancy thus exists between what the headers say about the encoding
of the body versus the actual encoding used.  This is obvious when
attempting to view the attachment (either by using a compatible message
viewer available on the device or by saving the attachment to a file and
viewing the file contents).

The process: When a message with an attached sub-message is received,
Message.parse puts the attachment in a new MimeMessage with the
attachment's body in a BinaryTempFileBody.  LocalFolder.saveAttachment
then calls Message.writeTo (which later calls BinaryTempFileBody.writeTo)
to place the entire attachment (headers and body) in a new file that will
become a LocalAttachmentBody.  Until now,  BinaryTempFileBody.writeTo
could only save the message body using base64 encoding.

This commit implements BinaryTempFileBody.setEncoding and assures that the
body is written out with the same encoding that was found in its  headers.
2013-09-03 19:51:26 -04:00
Joe Steele
769ad843dd Revert "Fix for StrictMode error."
This reverts commit bbdec62e37.

Aside from being the incorrect solution for fixing the problem
described in pull request 211, the patch generates 'Dead code'
warnings inside the if(){} statements on lines 46 and 47.

The correct fix for the problem was already implemented in commit
5678786c97.

Although the logcat in the pull request was generated after the fix,
line numbers in the log indicate that it was based on an outdated
version of MimeUtility.java from before the fix.
2013-06-03 11:59:58 -04:00
cketti
9ea46cf03b Merge branch 'Issue_4019_pinch_zoom'
Conflicts:
	src/com/fsck/k9/view/MessageWebView.java
2013-03-19 21:09:23 +01:00
cketti
0319ee4a5d Move KOI8-U -> KOI8-R fixup to charset fall-back table 2013-03-10 09:55:25 +01:00
cketti
4b42d0e062 Code cleanup 2013-03-10 09:39:03 +01:00
eagan
c5802ed8ef Java5 style 'for' 2013-03-10 09:25:28 +01:00
eagan
a5f4ddae91 Enhancement for charset fallback.
Fallback rule is defined in CHARSET_FALLBACK_MAP.
Multi-level fallback is supported.
2013-03-10 09:25:13 +01:00
cketti
337487e2ae Merge pull request #211 from colund/master
Close stream in case of an exception
2013-03-10 00:11:53 -08:00
Joe Steele
6a844a2553 Remove unused code in HtmlConverter.
HtmlConverter.getHtmlHeader() and getHtmlFooter() are
no longer used.  Remove them and other related code.
2013-03-01 14:30:42 -05:00
Joe Steele
e2c5229e85 Change when <html> tags are applied to messages.
Previously, <html>, <head>, & <body> tags were
attached to messages before they were stored locally.
But now that the <head> element also needs to include
a <meta> element (for proper MessageWebView display),
it seems unecesary to store all these tags with each
message.

Now the tags are no longer stored with the messages.  Instead,
MessageWebView applies the tags before displaying the message.

This also eliminates the need to upgrade an older
message database where all the old messages would have
otherwise needed to be wrapped with the new tags.
2013-03-01 12:59:59 -05:00
Danny Baumann
275700e482 Fix a number of build warnings.
This gets rid of about 50 warnings. Deprecation warnings still remain,
though.
2013-02-04 11:18:49 +01:00
Andrew Chen
5ac3d1d5c2 Use existing LocalMessage for the JB notifications.
LocalMessage already has a content preview in it; reuse that.
Remove unneeded MimeMessage#getPreview() method now that we don't need
to generate a preview anymore.
2013-01-07 23:20:35 -08:00
Danny Baumann
6f7ec3e401 Incorporate review comments. 2013-01-05 13:21:17 +01:00
luyang
bbdec62e37 Fix for StrictMode error.
When the device lost connectivity, a StrictMode error could be thrown since
the stream was never closed.
2012-11-28 19:55:42 +01:00
cketti
ec76dca57f Remove unused stuff 2012-10-24 01:37:33 +02:00
Jesse Vincent
0c34a21ff0 Add a fromMe method on messages 2012-10-03 21:56:28 -04:00
Rob Bayer
fdb1267cb1 Add remote IMAP search support.
* rbayer/IMAPsearch: (21 commits)
  More cleanup
  Code Cleanup getRemoteSearchFullText -> isRemoteSearchFullText line wraps for preference items
  Refactor to allow fetching of extra search results beyond original request.  Most code moved out of ImapStore and ImapFolder and into MessagingController.searchRemoteMessagesSynchronous.  Should make it easier to add remoteSearch for other server types.
  Prevent delete of search results while search results open
  remove duplicated code block
  Don't hide Crypto when IMAPsearch disabled
  Code Style Cleanup: Tabs -> 4 spaces Remove trailing whitespace from blank lines
  tabs -> spaces (my bad...)
  Fix opening of folders to be Read-Write when necessary, even if they were previously opened Read-Only.
  add missing file
  Working IMAP search, with passable UI.
  UI improvements
  Simple help info when enabling Remote Search
  Dependency for preferences
  Basic IMAP search working
2012-09-13 09:10:37 -07:00
cketti
3253466f14 More magic to work around BinaryTempFileBodyInputStream 2012-09-09 01:15:26 +02:00
cketti
5678786c97 Properly closing InputStreams to avoid StrictMode warnings 2012-09-05 05:57:52 +02:00
Bernhard Redl
89f6c2f6d0 upgraded Mime4J 0.7-SNAPSHOT -> 0.7.2 (fixes MimeMultipart parser bug) 2012-08-15 01:47:57 +02:00
András Veres-Szentkirályi
57f364ca69 combined nested if statements in MimeHeader.hasToBeEncoded 2012-07-06 14:35:01 +02:00
cketti
602ce7be99 Trim the first value in getHeaderParameters()
Previously a value like 'text/html ; charset="windows-1251"' for the
Content-Type header would not be decoded correctly.

Fixes issue 4348
2012-06-18 04:46:46 +02:00
cketti
116e9598da Create an HTML version of text/plain-only drafts in the database
Without this, text/plain-only messages with K-9 Mail's "identity header"
are displayed as "No text" (when moved out of the Drafts folder).
2012-06-01 16:15:07 +02:00
ashley willis
9e1fa63139 fixed MimeHeader.hasToBeEncoded() to include TAB.
bug encounted when replying to a message such as:
From: "bar,	foo" <foobar@example.com>
the field was originally folded on the tab, but the CRLF was already stripped before this error.
2012-04-30 13:58:02 -05:00
Jesse Vincent
85da3d8667 workaround to detect the charset from HTML mail without charset parameter on the header.
Conflicts:

	src/com/fsck/k9/mail/internet/MimeUtility.java
2012-04-08 12:38:45 -04:00
Koji Arai
10c37942a6 Added two domains handle docomo emoji 2012-03-17 23:24:12 +09:00
Koji Arai
f9fb74241a avoid NPE. address may be null when the parser is failed. 2012-03-17 23:23:27 +09:00
cketti
f9a35aeaee Replace CRLF with LF when loading drafts
This is necessary because we save the offset and length of the user-
supplied text in the identity header. These values are then later used
to split the draft in user text and quoted message.
When calculating these values we operate on a string with LF line
endings. Ideally we want to do the reverse operation on the same
string, but when saving the message to the server LF is converted to
CRLF to create RFC-conforming messages.

This is only a hack and will probably be the cause of more trouble in
the future. A better solution would be to make the identity header more
robust or get rid of it entirely.
2012-03-17 04:15:30 +01:00
cketti
3fa8081e88 Fixed MimeUtility.extractTextual() when loading messages from the server 2012-03-17 03:19:09 +01:00
cketti
dbf38dae65 Fixed the change of the previous commit 2012-03-17 00:30:40 +01:00
cketti
a48adafbbc Don't use null for 'text' and 'html' in ViewableContainer 2012-03-16 22:56:09 +01:00
cketti
f181e923ca Don't modify draft messages when storing them in the database 2012-03-15 21:21:00 +01:00
cketti
aeb0220e56 Fixed MimeUtility.getHeaderParameter() to not crash on unexpected input 2012-03-12 17:45:34 +01:00
cketti
2cb31a2fac Added button to show unnamed and inline attachments 2012-02-27 21:45:46 +01:00
cketti
b9803ece19 Fixed divider before text part with filename 2012-02-18 00:05:56 +01:00
cketti
8ce78408c2 Fixed HTML generation in MimeUtility.extractTextAndAttachments() 2012-02-17 19:42:35 +01:00
cketti
cf9631d481 Changed the way we decide what message parts to display 2012-02-13 23:11:59 +01:00
cketti
71174417ce Clone Message object to avoid ConcurrentModificationExceptions
Fixes issue 3953
2012-01-04 03:57:53 +01:00
edpeur
daeedc2222 Close resources properly 2011-12-31 17:38:41 +00:00
Andrew Gaul
e93510b4b3 Avoid string concatenation in Writer.write 2011-11-27 13:57:11 -08:00
cketti
20eab9c812 Rewrite application/x-zip-compressed to application/zip 2011-11-21 11:49:03 +01:00
cketti
4f060642ee Merge branch 'imap_parser' 2011-11-16 04:52:05 +01:00
Jesse Vincent
a8ef6594ec Preserve header order (with the exception of duplicate headers like
"received" they all show up where the first one did
2011-11-15 00:00:42 -05:00
cketti
70dc27c481 Make MimeUtility.getMimeTypeForViewing() return lower case MIME types
MIME type matching in Android is case-sensitive. So we convert the MIME
types we read from the email to lower case.
2011-11-06 02:05:47 +01:00
cketti
88a2dd6289 Merge branch 'issue549'
Conflicts:
	src/com/fsck/k9/Account.java
	src/com/fsck/k9/mail/store/WebDavStore.java
2011-11-05 18:47:55 +01:00
Andrew Chen
57e0abbf8f Merge pull request #84 from andrewgaul/api7
Use LinkedList instead of Deque.
2011-11-03 07:41:09 -07:00
Andrew Gaul
98d0b61890 API 7 fixes 2011-11-02 20:47:48 -07:00
Andrew Gaul
647ae0a31c Prefer Collection.isEmpty over size 2011-11-02 20:03:07 -07:00
Andrew Chen
f884e967c9 Use MimeHeader.* constants when referring to content headers. Minor whitespace changes. 2011-11-02 08:34:06 -07:00
Andrew Chen
ea05f3b5d0 Merge branch 'legacy-collections' of https://github.com/andrewgaul/k-9 into andrewgaul
* 'legacy-collections' of https://github.com/andrewgaul/k-9:
  Prefer unsynchronized Collection types
2011-11-01 13:26:54 -07:00