Commit Graph

426 Commits

Author SHA1 Message Date
Jesse Vincent 14055691a3 Merge branch 'mail-on-sd'
* mail-on-sd: (40 commits)
  Added more comments to explain how the locking mecanism works for LocalStore
  Fixed wrong method being called during experimental provider initialization (since provider isn't enabled, that didn't harm)
  Add more comments about how the various StorageProviders work and how they're enabled
  find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs
  French localization for storage related settings
  Remove unused SD card strings (replaced with storage indirection)
  Merge mail-on-sd branch from trunk
  Reset mail service on storage mount (even if no account uses the storage, to be improved)
  find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs
  Migraion -> Migration
  move the Storage location preference into preferences rather than the wizard.
  Made LocalStore log less verbose Added @Override compile checks
  Added ACTION_SHUTDOWN broadcast receiver to properly initiate shutdown sequence (not yet implemented) and cancel any scheduled Intent
  Be more consistent about which SQLiteDatabase variable is used (from instance variable to argument variable) to make code more refactoring-friendly (class is already big, code extraction should be easier if not referencing the instance variable).
  Added transaction timing logging
  Factorised storage lock/transaction handling code for regular operations.
  Use DB transactions to batch modifications (makes code more robust / could improve performances)
  Merge mail-on-sd branch from trunk
  Update issue 888 Added DB close on unmount / DB open on mount
  Update issue 888 Back to account list when underlying storage not available/unmounting in MessageView / MessageList
  ...
2010-11-13 21:40:56 +00:00
Jesse Vincent a8de2d0000 astyle 2010-11-13 01:47:08 +00:00
Jesse Vincent af5f78928c Add a "fetch all messages" visible limit 2010-11-12 23:41:43 +00:00
Jesse Vincent 478bd876ee There's no reason the getSubject accessor should throw a
MessagingException on LocalMessage
2010-11-12 22:27:32 +00:00
Jesse Vincent b2e5d7afc5 extract our our folder-count updating code from the flag setting code 2010-11-12 21:38:11 +00:00
Jesse Vincent eb908b67a3 try to clean up our message count update logic in flagging 2010-11-12 21:38:06 +00:00
Jesse Vincent 2d8a8998b0 factor out a "destroy" method for local messages 2010-11-12 21:38:02 +00:00
Jesse Vincent 33fd42e766 If we DELETE a message from the database, don't then try to UPDATE it 2010-11-12 21:37:54 +00:00
Jesse Vincent 69675bc935 Now that we can show bigger previews, actually generate a bigger preview 2010-11-05 04:23:09 +00:00
Jesse Vincent a78776a9ee Only look at the first 8k of a message when calculating message previews 2010-11-05 04:23:04 +00:00
Jesse Vincent bfc24a58a0 Improvements to message preview heuristics 2010-11-05 03:55:24 +00:00
Jesse Vincent d0e85ce43a astyle 2010-11-05 02:59:21 +00:00
Marcus Wolschon 4aba667a4e fix for "http:/"-links in plaintext -emails. (add http:// is a link has no schema) 2010-11-04 13:35:39 +00:00
cketti 5b88a99de0 Got rid of some compiler warnings. 2010-11-04 03:11:34 +00:00
Fiouz be6ab18091 Update issue 2537
Try to gracefully handle account DB corruption by deleting file on open exception
2010-10-28 19:16:55 +00:00
Marcus Wolschon b723769e65 translated "unable to connect". 2010-10-28 14:37:48 +00:00
Jesse Vincent c216f42eb3 Exchange authenticaton and setup overhaul from Kris Wong 2010-10-24 01:03:29 +00:00
Jesse Vincent 07adaaee4d Applied WebDavStore_cleanup.diff to remove dead code in the WebDav store from Kris Wong <wongk@seapine.com> 2010-10-24 01:02:46 +00:00
Jesse Vincent 983d7ad48f The "viewport" hinting we used to try to better fit messages by default
made android zooming incredibly unreliable. Now it's only somewhat
unreliable.
2010-10-23 18:50:10 +00:00
Jesse Vincent 4ea6c1603b We've been seeing a lot of FCs on htmlifcation of large messages due to
running out of memory during our heavy HTMLification. Try to be a bit
lighter on the poor RAM if a plain text message is big.
2010-10-23 17:33:08 +00:00
Jesse Vincent 524dfb348a Updated MIME Type list with http://www.stdicon.com/mimetypes 2010-10-23 16:28:18 +00:00
Jesse Vincent 105df4c61a It turns out that not every android release has a good extension to
mimetype mapping. restore our previous hardcoded mime database as a
fallback
2010-10-23 16:28:07 +00:00
Jesse Vincent e8756af4f1 astyle 2010-10-21 20:49:20 +00:00
Jesse Vincent d02ddda19b When doing a message search, break it into "first 10" and "more" -
because a long SQL query takes more time before starting to return
results, K-9 was increasingly slow on large folders.

Doing two searches may take marginally more time but starts getting
results back to the UI much faster.
2010-10-21 20:48:28 +00:00
Jesse Vincent 496677dad4 Calculate preview for html-only messages
Fixes 2465
2010-10-16 08:27:47 +00:00
Jesse Vincent 5fc78b4219 astyle 2010-10-11 00:08:54 +00:00
Jesse Vincent 28388b235e move "saveAllHeaders" to the account preferences screen. 2010-10-11 00:08:39 +00:00
cketti da7210d1db Refactoring: Some variable, method, and id renaming. 2010-10-09 00:38:52 +00:00
cketti 7028a4c167 Fixes issue 2144
- Removed the contact names cache (memory leak)
- Changed Contacts.searchByAddress() to Contacts.getNameForAddress(). Cursor is now immediately closed.
- Only try to resolve contact names when "Global settings" -> "Show contact name" is checked
- Never resolve contact names if number of recipients exceeds a threshold
2010-10-09 00:24:43 +00:00
Jesse Vincent 8c1eda3149 An attempt at cleaning up after the 3.00x and earlier bug that caused
K-9 to leave old headers hanging around in the database
2010-10-08 06:33:04 +00:00
cketti 9b5436d23b Removed (redundant) debug logging from the IMAP parser code. 2010-10-06 01:50:02 +00:00
Jesse Vincent 6061c42ea9 find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs 2010-10-05 06:04:28 +00:00
Jesse Vincent 524350a960 Replace our (incomplete) custom MIME type list with a call to webkit. 2010-10-05 06:03:24 +00:00
Fiouz 8bb6eb146b Optimizations:
- Don't instantiate an empty Address array just to throw it away (less gabarge collection)
- Use a StringBuilder rather than a StringBuffer (faster as it isn't synchronized)
2010-10-03 08:28:56 +00:00
Fiouz ef1d958092 Optimization: don't invoke Cursor.getXXX(int) more than necessary 2010-10-02 18:45:51 +00:00
Koji Arai 2a39cd5206 Fixes issue 2282
Added an option whether the registered name color is change or not
Avoid "Connection error" when MessageView is opened. The contacts.getName() might return null.
2010-09-26 14:39:52 +00:00
Jesse Vincent b6124fb397 deleteHeaders deleted message headers by id when it should have been
deleting by message_id.  I believe this was our last serious leak in
our flash storage

deleting message headers was....just wrong. we've fixed other similar
bugs inherited from android 1.0 before.
2010-09-22 02:46:20 +00:00
Fiouz e16a79d08c Javadoc comment 2010-09-12 06:11:08 +00:00
cketti 8cf2655dd8 Reverted r2332 and r2333 because the cause of the problem reported in issue 2078 seems to be different than initially thought. 2010-09-09 23:52:06 +00:00
cketti a85ea2ee53 - Reworked the previous patch with suggestions by jessev to be as runtime/memory efficient as possible without being useless.
- Output debug message when invalid responses are encountered.
2010-09-03 15:32:25 +00:00
cketti b9b15295cd Added yet another work-around for an IMAP server implementation with a creative interpretation of the specification. Sanity check results returned for a SEARCH command.
Fixes issue 2078
2010-09-03 13:58:09 +00:00
cketti 525d9a2ef9 Don't choke on malformed UIDL responses (POP3).
Fixes issue 2252
2010-09-02 23:59:20 +00:00
Koji Arai 842a5ee123 Update issue 2144
Use setSpan() instead of Html.fromHtml()
Should clear cached name of contacts at MessageView#onClickSender().
2010-09-01 01:35:20 +00:00
Jesse Vincent a83fd2d548 Kill an insanely chatty log message 2010-08-31 05:01:26 +00:00
Jesse Vincent 7030967fa7 astyle 2010-08-31 03:58:33 +00:00
Koji Arai b1074329e4 On the MessageList and the MessageView, prefer to use the display name registered in the Contacts rather than raw addresses.
Update issue 2144
2010-08-30 14:37:34 +00:00
Jesse Vincent 7d2804549e Remove redundant "return" statements from the end of void methods (with
help from intellij)
2010-08-29 23:39:45 +00:00
Jesse Vincent 4f0bce1569 Simplify many, many boolean conditions with help from IntelliJ 2010-08-29 23:39:26 +00:00
cketti 3d27cf220a Removed some code/string duplication. 2010-08-29 18:46:51 +00:00
Jesse Vincent 89dcc3646b Database version bump to clear bogus cached attachments 2010-08-29 16:58:04 +00:00
Jesse Vincent 6031862bad Before we delete messages earlier than the earliest acceptable date, make sure we also delete their attachments. 2010-08-29 16:57:57 +00:00
Jesse Vincent fe62812ff2 Delete the attachments from disk before we delete them from the database, so we know what to delete. 2010-08-29 16:57:49 +00:00
Jesse Vincent 994ed6653c simplify some of our flagging logic and remove duplication using ternary operators 2010-08-29 16:57:40 +00:00
Jesse Vincent 6d38c1c71a Comments to better explain what's really going on on delete of messages 2010-08-29 16:57:31 +00:00
Jesse Vincent a5b7aa97dd typo fix 2010-08-29 16:57:24 +00:00
Jesse Vincent e0447e32cc astyle 2010-08-29 16:57:13 +00:00
Jesse Vincent 7300aca2b8 Remove a call to deleteHeaders since headers are deleted implicitly by
an SQLite trigger.

Call our new variant of deleteAttachments() to avoid an extra lookup
2010-08-29 16:57:02 +00:00
Jesse Vincent 31613e15c7 extract the method for "delete a message" from the "Set flags" method 2010-08-29 16:56:54 +00:00
Jesse Vincent 54a4c84afa Split out deleteAttachment to avoid an extra SQL call if we can. 2010-08-29 16:56:45 +00:00
Marcus Wolschon 726b472330 set context before using it 2010-08-18 14:13:37 +00:00
Jesse Vincent ff5024eaec astyle 2010-08-18 02:48:55 +00:00
Jesse Vincent 8832933a60 It turns out that if you're only fetching the bodystructure, the mime4j
parser can't parse the message.
2010-08-17 04:21:22 +00:00
cketti ba95150a31 Use IP address for SMTP EHLO if hostname contains invalid characters, e.g. underscore.
Fixes issue 2143
2010-08-15 19:26:44 +00:00
Koji Arai 7964c34dbd Fixes issue 2145
Cannot show the emoji icon on Android 1.6 at least. Replaced all "< img" to "<img".
2010-08-15 14:52:59 +00:00
Jesse Vincent 73c3872dd0 Improve our display of inline images in HTML mail to not also offer
themselves up for download.

To do so, we need to start storing the original content-id and
content-disposition for attachments - this includes a database upgrade.

Based on a patch from @achen.code
2010-08-15 02:37:06 +00:00
cketti 0eb342ef5a Code cleanup (Removed unused imports, added @Override annotations) 2010-08-13 14:06:13 +00:00
Jesse Vincent a0238904b6 Update our emoji implementation to support docomo, softbank and kddi
(with the exception of 3 kddi glyphs that overlap with softbank).

As of this commit, emoji sent by iPhone users are visible in K-9
2010-08-12 02:22:35 +00:00
Jesse Vincent d123aa2a39 Add a hook for hinting charset conversions to Java, since Android's java
doesn't know about all conversions.
2010-08-12 02:22:25 +00:00
Jesse Vincent ece68bae5d Off-by-one error in the recent IMAP fetch work :/ 2010-08-12 02:21:56 +00:00
Jesse Vincent 0229d8a1fe Implement windowing for IMAP UID FETCH
Our previous implementation of UID FETCH didn't ever take into account
maximum command line lengths. When fetching, say 800 messages from a
GMail IMAP server, we could easily overflow the max line length leading
to a fetch that didn't get all the messages we wanted to and was
truncated before the description of which fields we want. That caused
K-9 to fetch complete messages, exhaust memory and ultimately fail,
even when we were just trying to get message lengths.

An equivalent fix needs to be made to seach by UID.
2010-08-11 03:36:40 +00:00
Fiouz dfb8f9e0f2 Memory management optimisation: help garbage collection by avoiding repeated instantiations of immutable arrays (empty arrays of String, Message, Flag, Address) 2010-08-07 15:10:07 +00:00
Fiouz 44cef83e0b Use of constants for immutable empty arrays (prevent useless memory allocation) 2010-08-02 11:55:31 +00:00
Jesse Vincent cd6b64d88f Experimental changes to tell WebView that the HTML versions of messages
we generate from ascii are "mobile-optimized"
2010-08-02 01:27:50 +00:00
Jesse Vincent d78e7a0d69 Switch from the incomplete (but compatible with java 1.3) mime4j charset
alias resolver to the core java nio version with a better charset
database;

rather than falling back to not showing the user a failing message, fall
back to showing the user the message as ascii -- it makes it possible
to get _something_ out of an unknown-charset message, rather than just a
"ha ha. no." error.
2010-08-02 01:27:46 +00:00
Jesse Vincent 7fc921c0b7 astyle 2010-08-02 01:27:40 +00:00
Jesse Vincent a4381696f9 Support Emoji for DoCoMo.
Emoji icons are derived from http://start.typepad.jp/typecast/
2010-08-02 01:24:40 +00:00
Jesse Vincent d8a73b195d Factor out the decision about whether a part is "viewable" for purposes
of fetching ; remove broken "inline" check from the same.
2010-07-30 00:58:33 +00:00
cketti 0c67f1f4cf Only ask for POP3 capabilities before authorization if TLS should be used. Always ask after authorization. 2010-07-30 00:58:22 +00:00
cketti 91e55f6fa1 Don't log POP3 passwords by default. 2010-07-30 00:53:46 +00:00
Jesse Vincent d8a757faaf Try to avoid a bunch of reallocations as we grow the temporary output stream by defining its size if we can get it 2010-07-29 22:17:35 +00:00
Jesse Vincent 134c0b23dd Backport a bit of memory efficiency I'm not sure I believe from AOSP 2010-07-29 22:17:32 +00:00
Jesse Vincent 0bb115ca42 Actually catch an OOM in getTextFromPart
Backport an update to getTextFromPart from AOSP as of 290348 - dealing with OOM as we import large messages
2010-07-29 22:17:29 +00:00
Jesse Vincent c6aa505ffe improve the method docs on getTextFromPart
Backport an update to getTextFromPart from AOSP as of 290348 - dealing with OOM as we import large messages
2010-07-29 22:17:26 +00:00
Jesse Vincent 2ca76e3db0 Fix for Issue 1956
A race condition made the outgoing certificate being compared to the old
incoming mHost,
throwing an exception with an untrusted certificate dialogue to accept
or decline.
2010-07-27 18:59:41 +00:00
Jesse Vincent 766a115155 Remove URLs from message previews. Suggested by Kevin Falcone 2010-07-24 02:09:12 +00:00
Jesse Vincent 7464a1527a Convert for loops to "enhanced" syntax per SDK performance guidelines
(Automatic with Eclipse)
2010-07-19 01:52:18 +00:00
Jesse Vincent f492ee9d0b back out the rest of my localDate changes for now due to user
complaints.
2010-07-15 03:47:45 +00:00
Thialfihar 014b6c19c3 svn:eol-style=LF for src and XML resources
Fixes issue 1982
2010-07-13 21:49:28 +00:00
Jesse Vincent 70a1eef943 astyle 2010-07-13 21:16:56 +00:00
Jesse Vincent a85c83f696 Revert "When deciding whether a message is older than a certain date, we should"
This reverts commit 98cab91631692b55ba72231126f612d6b4d4d662.

As Dan rightly suspected, it made pop3 sad :/
2010-07-13 21:16:49 +00:00
Jesse Vincent 8ab165ef31 Allow per-protocol configuration of which wire protocols are
debug-logged
2010-07-13 21:16:42 +00:00
cketti 665efc1448 Work-around to be able to read messages with "charset=0". QUALCOMM Windows Eudora seems to send headers like this.
Fixes issue 1952
2010-07-12 19:45:59 +00:00
Jesse Vincent 5a43acff2a Rather than accidentally reusing a public API function name with a
different signature, give the private command to pull a count
from the remote imap store its own name
2010-07-11 15:41:20 +00:00
Jesse Vincent 20e47991c3 astyle 2010-07-11 15:39:26 +00:00
Koji Arai 28d3967d0f Fixes issue 305
Support Content-Id header to show inline images.
2010-07-11 13:44:16 +00:00
Jesse Vincent c359b2c6bf Comment out redundant logging of IMAP commands
Each IMAP command was logged 3 times in normal operation. It seriously
clouds the logs and makes it much harder to read and debug ongoing
connections
2010-07-11 12:31:47 +00:00
Jesse Vincent 7a543b45b1 Remove duplicate code between two message counting routines in ImapStore 2010-07-11 12:31:34 +00:00
Jesse Vincent 9321a045d9 When counting remote unseen/flagged messages, don't window to only the
most recent 300 messages - Since we display this # to the user, the
"last 300" heuristic ends up confusing and _wrong_ on a regular basis.
2010-07-11 12:31:22 +00:00
Jesse Vincent ae339f1ac8 Add a per-account setting to choose how much of each message to download automatically. 2010-07-11 11:59:14 +00:00
cketti e59987fdcb Display an error message (instead of "null") if a message couldn't be decoded because of a missing charset.
See issue 1480 for a test case.
2010-07-11 01:28:08 +00:00
Jesse Vincent 4024cca2aa Add a comment about the custom IMAP command Yahoo! needs to work right. 2010-07-10 16:41:22 +00:00
Jesse Vincent 61b25c8760 only store an internalDate if we actually get it from the server; If we
don't have an internaldate, use the sentdate for sorting comparisons.
2010-07-10 16:40:34 +00:00
Jesse Vincent 52ff331771 When deciding whether a message is older than a certain date, we should
be prefering the date we can ~trust "Internal" to the date asserted by
the sender.
2010-07-10 16:40:13 +00:00
Jesse Vincent ee63564138 "ReceivedDate" was an unused concept. Its value was never set. 2010-07-10 16:40:00 +00:00
Jesse Vincent a826f33eb3 find src/com/fsck/ -name \*.java|xargs astyle --style=ansi
--mode=java --indent-switches --indent=spaces=4 --convert-tabs
--unpad=paren
2010-07-06 10:29:26 +00:00
Daniel Applebaum cdbcb188ec Fixes Issue 1664
Correct thread safety on some member variables when doing null checks.

Explicitly check for mMessageCount == -1 and stop=true in idling loop.

However, the original error message "Message count = -1 for folder"
will still arise in some circumstances and is a valid error to
report.
2010-07-03 15:22:54 +00:00
Koji Arai dab0c9a97f Fixes Issue 1914
Show To, Cc and From headers on the part of additional headers without fetching all headers.
2010-07-02 14:57:55 +00:00
cketti 4a6b99b647 Fixed some warnings 2010-06-20 14:19:01 +00:00
Daniel Applebaum 8cb7f8f317 Fixes Issue 1763
Patch from jca02266 to use locale independent date formatter.
2010-06-11 12:56:01 +00:00
cketti 2aac012282 Folder.fetchPart() is called when it shouldn't be. Disabled the exception for now. See issue 1733 2010-06-09 19:44:35 +00:00
Daniel Applebaum 80ed18c469 Fixes Issue 422
Committing this change to properly credit 'mpredosin' with the patch
committed at r1783 "Convert to hierarchical traveral from deep
traversal."
2010-06-08 11:33:47 +00:00
Daniel Applebaum 07f9abe162 Fixes Issue 422
Convert to hierarchical traveral from deep traversal.
2010-06-08 01:01:20 +00:00
Jesse Vincent 421ecac997 Strip PGP headers from message preview 2010-06-06 22:28:29 +00:00
Jesse Vincent 4bfebe42f1 Allow users to choose whether they want plaintext messages to be
fixed-width when uprezzed to HTML.
2010-06-06 21:33:33 +00:00
Jesse Vincent 0624f119df Gr. typo to my "word character" regex 2010-06-06 21:33:15 +00:00
Jesse Vincent 222808b51d Bump up preview length from 160 to 250 to make better use of larger
displays
2010-06-06 21:33:05 +00:00
Jesse Vincent 18cf923072 Only strip : lines containing word characters. This should improve the
preview when someone sends mail starting with a time. (12:01)
2010-06-06 21:32:57 +00:00
cketti 576078e778 Prefix IPv6-addresses with "IPV6:" in EHLO command.
Fixes issue 1708
2010-06-03 01:00:24 +00:00
Daniel Applebaum 6d6a9d0ffd Fixes Issue 1707
Eliminate extraneous spaces

Also, abort IMAP IDLE connection attempt if mConnection is null before
IDLEing.  Otherwise, we cannot set the idle timeout.
2010-06-02 14:25:04 +00:00
cketti 64c7df60ab Don't log sensitive information in SMTP commands when "Log sensitive
information" is unchecked. Applied patch by fiouzy with some small modifications.

Fixes issue 1387
2010-06-02 13:14:30 +00:00
Daniel Applebaum b35f807820 Fixes Issue 227
Provide for controlling the maximum age of syncrhonized messages.
Efficient with IMAP, much less efficient with other Stores.
2010-05-30 21:20:47 +00:00
Daniel Applebaum dedfd026be Fixes Issue 254
Provide for only showing folders that are subscribed on the server
(IMAP only)

Also:
Change default for Notification behavior to the old way.  Make going
to the search for unread messages off by default.

Fix up some hiding of labels, etc. on the incoming server settings.

Check for message suppression in search results.
2010-05-30 16:56:50 +00:00
Jesse Vincent 1a66072910 find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren 2010-05-30 04:17:00 +00:00
Jesse Vincent 49c4a4f97c refactor search code to allow us to search on specific fields. 2010-05-29 21:56:17 +00:00
Daniel Applebaum 291f6d18a2 Fixes Issue 1643
Fixes Issue 1664

Issue 1643: Some servers respond with an untagged EXISTS to every
NOOP.  This change parses through all untagged responses in a loop
until no more are being generated, avoiding calling internalOpen each
time.

Issue 1664: I have never personally seen this error, and the log looks
like a thread safety problem.  mMessageCount is being set in one
thread (the IDLE thread) but not properly visible in another thread
(the check mail thread).  mMessageCount and other ImapFolder private
variables are now volatile in hopes of correcting this problem.
2010-05-26 03:24:33 +00:00
Daniel Applebaum 5e3e204a4c Fixes Issue 1643
Enhance K-9 Mail to be more tolerant of non-compliant IMAP servers.
Do not require a space following the + in command continuation
requests.  The rest of the token parser will swalow the space if it is
actually there but we don't really need it.
2010-05-22 20:52:01 +00:00
Daniel Applebaum 24b178773f Make sure prefix is fetched before any call to getCombinedPrefix. 2010-05-22 17:34:16 +00:00
cketti 5627117ddf Use 997 as maximum line length for References header. See http://code.google.com/p/k9mail/source/detail?r=1714 for details. 2010-05-21 16:37:45 +00:00
cketti c5486469c2 - Add menu item to show additional headers in the message view
- Add option to save all headers locally (incoming server settings)

Applied patch provided by timmlinder with small modifications.

Fixes issue 43
2010-05-21 15:34:29 +00:00
cketti c29722a56c Make sure the References header doesn't exceed 998 characters and the value won't get Q-encoded. Thanks to fiouzy for providing the patch.
Fixes issue 1559
2010-05-21 12:20:32 +00:00
Daniel Applebaum 6afb8c8506 Make sure to compare capabilities using upper case. 2010-05-20 11:55:42 +00:00
Daniel Applebaum 59f22d8e7e Save capabilities in upper case so we handle them case-insensitively,
too.  Make sure all CAPABILITY-detection constants are written in
upper case.
2010-05-20 04:19:15 +00:00
Daniel Applebaum d873ecbe7a From cketti's reminder: check untagged response with equalsIgnoreCase.
Also, reset mCombinedPrefix when the delimeter is discovered.
2010-05-20 04:13:49 +00:00
Daniel Applebaum af55c6f48b We don't need to log the content of the map each time we add to it. 2010-05-20 03:38:16 +00:00
Daniel Applebaum 44da2e1fe6 After discussion with cketti, reinstate using LIST to find the path
delimeter, but only if the server does not support NAMESPACE.  Since
we've encountered non-compliant servers that freak out at the LIST
command, enclose in a try/catch structure so that failures do not
totally prevent IMAP communication.
2010-05-20 02:33:44 +00:00
cketti 6e3183f54f Moved classes Regex and DomainNameChecker from android (package) namespace to K-9 namespace. This way we're protected from modifications to these classes in future Android versions. 2010-05-19 19:16:36 +00:00
cketti 58b8479612 Code refactoring:
- Created "controller" and "mail.filter" package
- Moved a lot of classes to new/other packages
- Removed unused classes: NoSuchProviderException, MessageDateComparator
2010-05-19 18:17:06 +00:00
cketti 22ce159fe6 Merge imap-parser branch.
Fixes issue 1547.
2010-05-19 13:31:48 +00:00
Daniel Applebaum 9cf42ef913 Provide for tracking all WakeLock usage.
Simplify WakeLocks use by pushing.

Correct fault in IMAP IDLE WakeLock usage.  The ThreadLocal in
MessagingControllerPushReceiver meant that the WakeLock acquired when
the DONE was sent was not being released when entering back into IDLE
state.

Consolidate the account notification so that all Activities use the
methods in MessagingController.
2010-05-17 00:30:32 +00:00
Jesse Vincent ecebdf18cd find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren 2010-05-15 19:46:16 +00:00
Daniel Applebaum b51bce6ebf Fixes Issue 1551
Fixes Issue 1577

Issue 1551: 
Some IMAP servers send untagged EXPUNGEs to IDLEing
clients without ever haven't sent an untagged FETCH.  The untagged
EXPUNGEs are harder to deal with because they don't have a UID.  So,
if the user has elected to have the IDLE connection start with a poll,
we can maintain a map of message sequence numbers to UIDs that we can
use to figure out which message to delete.  To mitigate the risk of
the map falling out of date, we do a UID SEARCH UID before removing
the local copy of the message, just to make sure the message is really
gone from the server.  If we detect an error, do another poll to
resync the map.

Issue 1577:
Restore the removal of notifications for an account when the account's
unread message count goes to 0.
2010-05-15 19:35:07 +00:00
Daniel Applebaum 8b92bc3836 Fixes Issue 1474
Fixes Issue 1562

Issue 1474:
Provide new facility to totally wipe all data for an account but leave
settings intact.  This is useful because sometimes storage is so full
that SQLite cannot perform the usual VACUUM or message deletion.

Add confirmation dialogs to destructive Clear and Recreate operations.

Remove destructive Clear from FolderList so as not to have to
duplicate the confirmation dialogs.

Issue 1562:
Suppress notifications when new messages arrive in Trash, Sent or
Drafts special folders.
2010-05-12 04:17:52 +00:00
Jesse Vincent ba021597c4 astyle 2010-05-12 02:51:59 +00:00
cketti 37b42f58a6 Fix error handling code in DB upgrade. 2010-05-10 00:14:26 +00:00
Daniel Applebaum 6aeac22dad Fixes Issue 300
Fixes Issue 772
Fixes Issue 852

Issue 300: Handle incoming IMAP tokens in a case-insensitive manner

Issue 772: Add Yahoo workaround

Issue 852: Add configurable IMAP IDLE refresh frequency in Incoming
server settings

Also:
Add configuration option for whether push system executes a poll on
each connect.

Move the configuration for the maximum number of push folders to the
Incoming server Settings.
2010-05-09 15:27:41 +00:00
cketti 683f31e32e Code cleanup: Fixed some warnings 2010-05-03 13:46:55 +00:00
Jesse Vincent c31b224de3 enable dan's new "resync accounts on reconnect" code for push 2010-05-03 00:20:27 +00:00
Daniel Applebaum 989e89f5b0 Fixes Issue 1048
Zero out unread and flagged counts on all folders in an account being
cleared.
2010-05-02 05:37:48 +00:00
Daniel Applebaum ee1b4b70e2 Fixes Issue 1412
Keep search results in sync with newly arrived or deleted messages.
Intentionally does not remove messages from search results due to
flag (flagged/starred or read/unread) state changes, because that
would be awkward while manipulating messages in search results.
2010-05-01 20:06:52 +00:00
cketti c6fee3efb9 Quoted strings can contain '"' in escaped form. readStringUntil() fails to unescape and will will return prematurely when the string contains an escaped '"' character.
Fixes issue 512.
2010-04-30 13:51:19 +00:00
Jesse Vincent 8af7f4a7b6 find src/com/fsck/ -name \*.java|xargs astyle --style=ansi --mode=java --indent-switches --indent=spaces=4 --convert-tabs --unpad=paren 2010-04-29 04:59:14 +00:00
Daniel Applebaum 0459be3bb8 Fixes Issue 868
When connected to a server that does not automatically send an
untagged UIDNEXT with the responses to SELECT, explicitly SEARCH for
the currently highest UID in the folder on the server and then add 1
to it to get the UIDNEXT.
2010-04-27 04:06:26 +00:00
Daniel Applebaum 78a101547c Provide for doing a full poll/sync of a folder whenever the IMAP IDLE
connection is established.  Turned off for now, but just get rid of
the false && on line 2641 in order to enable it.
2010-04-27 03:02:17 +00:00
Jesse Vincent 55d70c3bf7 rather than fetching 10 messages on push reconnect, fetch a full
compelment of displayable messages. This should help eliminate "Gaps"
when reconnecting push connections after going offline.
2010-04-26 16:20:43 +00:00
Daniel Applebaum 6cfcfb953f Aggressively get rid of obsolete Flag X_NO_SEEN_INFO. It was
interfering with "unread" searches on POP3 accounts.

Flags really should be normalized in the database to eliminate the use
of LIKE while searching by Flags.
2010-04-25 06:17:15 +00:00
Daniel Applebaum 41c5dc5986 Fixes Issue 1448
Fixes ClassCastException.

Also:
Envelope and star in Accounts Activity are now both "hot".  Tapping
the main part of the search opens the full search; tapping the
envelope opens the search only for unread messages; tapping the star
opens the search but only for starred messages.

The envelope and star are a bit small to reliably tap.  Both options
should be available via long-press, also.

Methodology will be extended to real accounts, as well.
2010-04-22 02:20:35 +00:00
cketti 57acdb7033 Create 'folders' table with 'flagged_count' field when installing K-9 Mail. Previously it was only added when updating the application. 2010-04-17 21:27:06 +00:00
Daniel Applebaum 664c4d6a78 Fixes Issue 1394
Computing the account size is pretty slow for big accounts, and making
this functionality optional should be considered.

Also, displays the number of flagged messages ("stars") in each
account in the Accounts list and each folder in the FolderList.  Needs
better presentation of the flagged message counts, but this works as a
proof-of-concept and gets the data structures built.
2010-04-16 14:33:54 +00:00
cketti 110a6eb1c7 Removed unnecessary null pointer check. 2010-04-16 12:48:03 +00:00
cketti 57cc4cd735 Code cleanup. Fixed lots of warnings reported by Eclipse.
- Removed unused imports
- Removed unused variables/code
- Parametrized raw types
- Added @Override annotations
- Added hashCode() when equals() was overriden
2010-04-16 12:20:10 +00:00
Daniel Applebaum 86f3b28f79 Fixes Issue 1413
Look for + as acknowledgement that we're in IDLE mode, not "idling"
string.  

Also, to help with battery life:
1) Give up trying to IDLE after 10 failures.
2) Increase retry delays
2010-04-15 03:17:25 +00:00
Daniel Applebaum 9a8126d89c Addresses Issue 1348 and Issue 95
Not done, yet, but available for developers to use.

Definite things to be done in the short term:
1) Allow user to hide canned searches in Accounts Activity
2) Make newly arrived mail immediately appear in search results.

Possible improvements:
3) User-definable searches
4) Make newly deleted mail immediately disappear search results.
5) Make message with flag changes immediately appear/disappear from
   search results.
6) Show search result size in Accounts Activity.
2010-04-06 02:54:48 +00:00
Daniel Applebaum d08c9d6ce2 Fixes Issue 957
Fixes Issue 868

May not be perfect, either, but may help in some situations with
getting all emails to arrive via push.
2010-04-06 02:39:57 +00:00
cketti 648bec3efc Include support for another bad date format in the IMAP response parser.
Fixes issue 1295
2010-03-25 15:21:05 +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 d595033fa8 Work-around for a buggy POP3 server software that places "+OK" in front of every line of the unique-id listing (UIDL response).
Fixes issue 1237
2010-03-25 13:42:48 +00:00
cketti 938317e700 Get rid of the "Did not get proper search result" message. This helps with buggy IMAP servers that don't return an untagged SEARCH response if nothing was found. Other untagged responses are simply ignored.
Fixes Issue 907
2010-03-25 01:24:21 +00:00
Daniel Applebaum fa73f71e95 Fixes Issue 790
Tolerate malformed UIDL response.  Thanks to @bengnc for thorough
analysis in Issue 790.
2010-03-18 03:43:39 +00:00
Daniel Applebaum 76f33ba5ff Fixes Issue 1330
Flush the output stream so that small messages have bodies.  (And
presumably so that the entirety of big messages are sent.)
2010-03-18 03:23:45 +00:00
Daniel Applebaum ec9f395498 Fixes Issue 1090
Don't try to fetch content while reporting errors.

Generate unique URL for each upload.
2010-03-18 02:50:05 +00:00
Daniel Applebaum f0808fb3e0 Fixes Issue 1291
Provides for the user to elect to have certain folders displayed first
in the FolderList.  Folders so elected are displayed in alphabetical
order first, then folders not so elected are displayed alphabetical
order.

No special handling is done for Inbox any more, except that it is in
"top group" by default, to preserve current behavior until the user
changes the settings.
2010-03-07 17:02:21 +00:00
Daniel Applebaum ecc10e572f Fixes Issue 1224
Implement DEFLATE compression for IMAP communication, enabled by
default.  User can disable compression for Wi-Fi, Mobile, or Other
networks, if it causes problems or if uncompressed communication is
faster, which is possible on Wi-Fi and wired networks, especially.

"Other" is to allow for the Android platform to introduce new
networking types without having to immediately change K-9 Mail.
However, as those arise, new network types should be added as explicit
types in K-9 Mail.
2010-03-07 00:30:40 +00:00
Daniel Applebaum c0e4220b82 Fixes Issue 1116
Fixes Issue 1278
Fixes Issue 119
Fixes Issue 1077
Fixes Issue 1238

Worked performed by danapple0 and cketti in
https://k9mail.googlecode.com/svn/k9mail/branches/issue1116

Add support for most batch ops (except move and copy) in search
results.  Add support for batch move and copy on real folders.

Increase efficiency of bulk IMAP moves and copies by doing as multiple
UID operations.

Eliminated serialization of Account objects.

Provide up-references in useful places to make all future code cleaner
and more efficient.

Fixed a bunch of draft handling

Merged from issue1116 branch, except for Account.java, which was
copied wholesale.  Account.java was manually merged in issue1116
branch at r1489

svn merge -r 1459:1489 https://k9mail.googlecode.com/svn/k9mail/branches/issue1116 .
cp ../issue1116/src/com/fsck/k9/Account.java src/com/fsck/k9/Account.java
2010-03-04 04:00:30 +00:00
cketti 6fb59467b7 Changed SmtpTransport.writeLine() to only use one OutputStream.write() call. Apparently some servers got the "be liberal in what you accept from others" part of the robustness principle wrong. When we used multiple calls in writeLine() (command + CR + LF) a separate TCP packet was send each time. It appears that those broken servers accepted the DATA command after DATA + CR and interpreted the LF as part of the actual data. This caused our headers to become part of the body because that LF was interpreted as the empty line that separates headers and body.
As a side effect of this fix sending mail could be slightly faster now due to less packets being sent.

Big thanks to Kevin Newland of Michigan Technological University for organizing a test account.

Fixes issue 799
2010-03-02 02:48:52 +00:00
Daniel Applebaum 97c7bf1d65 Hopeful (but untested code) to get updated capabilities after
successful CRAM-MD5 authentication.
2010-02-27 17:48:00 +00:00
Daniel Applebaum f6e7d5d4c0 Fixes Issue 1252
Handle CAPABILITY response in following cases:
1) When sent as part of the banner, no longer sends explicit
CAPABILITY command

2) When sent as an UNTAGGED response to LOGIN, updates stored
   capabilities.

3) When sent as part of the TAGGED response to LOGIN, updates stored
   capabilities.

Due to odd implementation of the CRAM-MD5 authentication, the
capability updates will not happen as part of the CRAM-MD5
authentication.
2010-02-27 17:34:38 +00:00
cketti ec3d9eb9ea Removed code from ImapStore.internalOpen() that tried to get the path delimeter before SELECTing a mailbox. This shouldn't be a problem since the delimeter
a) is already known if the server supports the NAMESPACE capability.
b) is included in the prefix anyway (=also known if namespace was set manually).
c) isn't needed when selecting a mailbox because we currently don't support folder hierarchy. So the delimeter is included in the folder name.

Fixes issue 1217
2010-02-20 01:07:38 +00:00
Jesse Vincent f9d39e4814 Back out Attachments-on-SD support (it's on a feature branch now, while
Bao-Long makes it extra-awesome)

This commit should revert:
r1445
r1437
r1436
r1449
r1442
r1441
r1419
r1414
r1413
2010-02-18 03:28:31 +00:00
cketti 51b92aaf80 Fixes issue 1225 2010-02-14 15:51:09 +00:00
cketti 6d84f199c5 Enforce maximum line length for 8-bit encoded messages transmitted via SMTP (998 characters + CRLF).
Fixes issue 1176
2010-02-13 23:45:45 +00:00
Bao-Long Nguyen-Trong e435d9d616 Fixed issue 1205: Attachment storage location setting now takes effect immediatly. LocalStore is also better at handling when attachment are stored in a mix of internal and external storage (migration state after a setting change) 2010-02-13 19:07:10 +00:00
Daniel Applebaum 2c3da067c3 Fixes Issue 1219
At cketti's suggestion, change the methodology for counting
server-side unread messages on an IMAP server from STATUS (UNSEEN) to
SEARCH UNSEEN NOT DELETED.  STATUS (UNSEEN) does not ignore DELETED
but unexpunged messages and leads to incorrect results.

http://www.mail-archive.com/c-client@u.washington.edu/msg00929.html
http://www.mail-archive.com/c-client@u.washington.edu/msg00931.html

This variant only checks for unread messages in the last 300 messages
in the folder, so will be wrong if there are unread messages earlier
in the folder.  However, it'll be more often correct than the old
version for the marjority of users.

Also, change the opening of folders for IMAP IDLE purposes to
read-only using EXAMINE instead of SELECT.
2010-02-13 17:02:27 +00:00
Bao-Long Nguyen-Trong 6fe2dad5cc Added some defensive code to prevent crashes caused by the LocalStore getting in a bad state due to issue 1205 (still being worked on). This fixes issue 1214. 2010-02-11 21:16:37 +00:00
cketti 2bd4f9632b Better handling of IMAP FETCH responses.
Fixes issue 1068
2010-02-10 13:52:25 +00:00
Bao-Long Nguyen-Trong 131280c3f2 Still init LocalStore.mExternalAttachmentsDir even if sd card is not ready so that the object does not end up in a bad state 2010-02-07 05:58:04 +00:00
Bao-Long Nguyen-Trong 8403a265d9 We still need to be able to instanciate the LocalStore when the sd card is not mounted. So we do no throw an exception then. Exception will be thrown when we try to do attachment related things 2010-02-06 15:44:21 +00:00
Bao-Long Nguyen-Trong 55dac7ee4e Added option to have attachments store on sd card
(this is still a rough implementation)
2010-02-06 15:22:59 +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
cketti 14ee970b18 Fixed EOLConvertingOutputStream.
write('\r');flush();write('\n'); would lead to "\r\n\r\n" instead of simply "\r\n";
2010-02-05 02:36:52 +00:00
cketti 0422cae33e Implemented data stuffing. 2010-02-05 02:32:32 +00:00
cketti 45036ae5c8 Use 8bit transfer encoding for the text body if SMTP server advertises 8BITMIME. In all other cases base64 is still used (including saved copies in IMAP "Sent" folder).
Feel free to revert this if anything breaks.
2010-02-04 23:37:50 +00:00
cketti 6480e78b97 r1396 caused trouble for some clients due to a missing "MIME-Version" header. This should fix the problem. 2010-02-04 17:28:35 +00:00
cketti c6d29cb10e Fixes issue 21 (All messages are turned into multipart messages) 2010-02-03 19:56:20 +00:00
cketti 8049e90b8c Changed IMAP command "UID SEARCH (HEADER MESSAGE-ID %s)" to "UID SEARCH HEADER MESSAGE-ID %s"
Fixes issue 1031.
2010-02-03 17:25:15 +00:00
Jesse Vincent 74aac85048 Use a real hostname rather than localhost.localdomain.
Fixes Issue 45

Patch by cketti
2010-02-02 02:06:35 +00:00
Jesse Vincent a58095aae1 URLEncode username and password for accounts, so as to not fall apart on
nice simple characters like ':' in passwords.

Patch by cketti

Fixes Issue 1155.
2010-02-02 02:06:29 +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 ff390b388a Bullet-proofing for database upgrades and better fallback for failures 2010-01-24 20:41:04 +00:00
Jesse Vincent 2c406a58b0 When disconnecting from an SMTP server, send a quit command to be a
better internet citizen. Fixes Issue 1044.
2010-01-19 02:20:24 +00:00