Commit Graph

31 Commits

Author SHA1 Message Date
Daniel Applebaum 651642faeb Automatically re-synchronize the IMAP protocol. Previously, losses of
synchronization could happen if an Exception was thrown while parsing
an untagged response without using executeSimpleCommand.  For
instance, while doing a fetch.  Once synchronization was lost, later
commands would fail in surprising ways.  One manifestation of such
failures was spontaneously emptying of folders when search results
were not returned properly.  The new code makes sure to only accept OK
responses with the tag of the command, and discards the untagged
responses from previous command.
2009-05-05 00:42:05 +00:00
Daniel Applebaum f0f07c36de Issue 63
Issue 201
Issue 224
Issue 342

Handle untagged EXISTS messages at any time.  Should increase
synchronization speed and accuracy.

Handle IMAP servers that send a NIL where a literal is normally.
Avoids failure to sync when folder contains certain messages.

Throw Exception if folder message count is less than 0, avoiding
accidentally emptying a folder.
2009-04-21 04:22:02 +00:00
Daniel Applebaum 47f5230bed Issue 248
Issue 192

Do not remove markers for deleted messages, even if the corresponding
remote message is not returned by the remote store.  The remote
message may not be returned simply because the query did not encompass
it on this run.  If the account's delete policy is set to "Do not
delete from server", or the delete hasn't succeeded before a folder
refresh, a message for which the deleted marker has been removed can
errorneously reappear.

This will lead to the local store eventually having a large number of
deleted message markers.  In the long term, we'll need a way to manage
and possibly automatically remove them.
2009-04-17 03:22:45 +00:00
Daniel Applebaum 5711abdee5 Issue 234 Issue 366 Issue 329
Hardening of POP3 and SMTP communication:

SMTP: Decrement failure counter when no possible message send
occurred.  This way, K-9 will only stop attempting to send messages
for which a possible successful send occurred, but K-9 could not
detect.  Any message that is known to have completely failed to send
will be reattempted indefinitely.

POP3: Some reworking of Exception handling.  Also, if it is not
possible to get a "message number" for the UID of the message that is
being deleted, conclude that the message has already been deleted on
the server.  Mark this as a permanent error, so that it gets removed
from the pending actions queue.

MessagingController: Look for the permanentFailure flag on the
MessagingException, and if a pending action raised a permanent
failure, remove the pending action from the queue so that it will not
be re-attempted nor block later requests.
2009-04-11 02:11:17 +00:00
Daniel Applebaum bf98b5c2af Issue 366
Significant hardening of the email sending process.

A given message in the Outbox is only attempted to be sent 5 times.
Once the threshold is reached, the message is flagged.  asses through
the Outbox skip flagged messages.  The message can be tried again by
manually unflagging.  When any messages are flagged during a pass
through the Outbox, K-9 raises a notification with a fast flashing red
LED, alerting the user to the failure to send.  A note is also placed
in the K9mail-errors.

The read timeout on SMTP connections has been changed to 300000ms (5
minutes)

The send attempt counter is kept in memory, not stored with the
message, so a phone or application restart will clear the counters,
but not the flagged state.  As the intent of this revision is to avoid
runaway message sending, this is deemed to be acceptable for now.

The moving of messages from the Outbox to the Sent folder has been
changed to an atomic move.

Extra error checking has been added to the SMTP communication code.

The flashing LED may be excessive.
2009-04-09 17:48:05 +00:00
Daniel Applebaum 8ca1830afb Add "Check mail" menu items:
Accounts: Option menu->Check mail = check mail in all
   folders of all accounts
Accounts: Context (long-press on account) menu->Check mail = check mail
   in all folders of this account

Folder/Message List: Option menu->Check mail = check mail in all
   folders of this account
Folder/Message List: Contet (long-press on folder) menu->Check mail = check mail in this
   folder*

*All "Check mail" options, except for the long-press on an individual
folder, respect the normal synchronization class settings.

Eliminate all Refresh menu items.

Add progress indicators to Accounts activity.  Indeterminite progress
indicator while email checking is in progress.  Determinite progress
indicator while fetching unread counts.
2009-04-01 03:25:16 +00:00
Daniel Applebaum 45227e2708 Delete now uses LocalFolder.moveMessages
Copy now copied body (but attachments might not work right).

Move is now reliable (needed to open the destination folder), and
leaves a placeHolder message behind in the source folder so that
messages are not resynced.
2009-03-07 07:20:15 +00:00
Daniel Applebaum 6d5b158787 Restore ability to delete server-side messages for POP3 and WebDAV 2009-03-05 13:43:05 +00:00
Daniel Applebaum 15e5cb4eaf Provides the ability to move and copy messages between folders. Issue
3.

Each remote Store (IMAP, POP3, WebDAV) can provide indications to the
higher level classes as to whether copy and move are implemented.
Currently, copy and move are only provided by ImapStore.java.  When
the facilities are not available, the user interface suppresses the
menu options.

The available destination folders can be configured using folder
classes.

Copy results in null message bodies in the destination copy of the
message until the next sync.  This is a problem that occurred with
deletes previously, and is likely a fault with the copyMessages method
of LocalStore.java.

Utilizes a modified version of the ChooseFolder.java Activity that
debuachedsloth contributed in a patch attached to Issue 285 on 16 Feb
2008.
2009-03-05 07:32:45 +00:00
Daniel Applebaum 0e9d1f195e Issue 319
Do not reset all folder settings when a database upgrade occurs. (Or
any other event that wipes all of the local folders.
2009-02-24 05:03:28 +00:00
Matthew Brace 7e492a0505 Prevent needlessly downloading every message > 5K the first time it's opened (affected POP3 and WebDav) 2009-02-12 22:59:02 +00:00
Daniel Applebaum 3e4843e756 Issue 131
Provide two options for each Account:
Compact (which VACUUMs the accounts and prunes recreatable
attachments)

Clear all data (danger!) (which wipes all messages and attachments in
the account, except placeholder deleted messages)

Displays a Toast when the Compact or Clear is queued, and another
Toast with the shrinkage results.

(Also, a small change to increase probability of seeing messages after
a sync, by setting the needsRefresh on all folders when a sync is done.)
2009-02-10 03:18:42 +00:00
Daniel Applebaum 7a5b4d27e1 Changed terminology from Thread to Sort. Added sorting on sender,
flag, unread and attachments.

Really, really, needs better icons.
2009-02-07 19:41:33 +00:00
Daniel Applebaum 465172f1c7 Fix threading in Accounts main screen. Move all UI updates to UI
thread.  

Push unread message counting into the background.

Should increase startup performance and reduce black-screens-of-death
that some Market "commentators" report.

Also, updates the per-account unread message count when email account
is finished synchronizing.
2009-02-06 04:28:29 +00:00
Daniel Applebaum 8fd9c4e77c Get rid of suppression logging 2009-02-04 04:56:11 +00:00
Daniel Applebaum 3dfabbbd0c Provide folder threading support. When threading is on, messages in
folders are sorted first by subject, then by date.  Subject sorting is
case insensitive and disregards leading re:, fw: and fwd: prefixes.

Threading can be toggled via the T hotkey or the option menu.

The icons could use improvement.

Threading state is maintained during a run of K-9, among all
accounts.
2009-02-01 00:08:14 +00:00
Daniel Applebaum fe2dfb76d0 Refactor suppression of deleted messages into MessagingController.
Re-enable instant deletes in MessageView

Deleted message suppression should be generalized into a flag cache,
serving Seen, Flagged, and Answered flags, as well.

Copy message to Trash still needs work, so that no duplicates are ever
visible and server-sync is more clean.  This will be especially
important, as the same code will be needed for the future "message
copy/move" facility.
2009-01-29 13:35:43 +00:00
Daniel Applebaum 1bd3f31b95 Attempt to fix Issue 192; making deleted messages stay deleted. 2009-01-27 03:13:54 +00:00
Daniel Applebaum e1da49109f Flag "Sent" messages as Seen Issue 91
"Instant" Empty trash
2009-01-24 18:52:58 +00:00
Daniel Applebaum 0706b7de45 Patch from debauchedsloth for issue 190 that makes the ongoing
notifications duing email send/receive optional.
2009-01-18 16:42:55 +00:00
Daniel Applebaum 172adeee22 Add ability to Flag/Unflag messages. Flagged messages are shown with
a red/bold subject.  Can be done in the FolderMessageList using the
hotkey G (toggle) or by long-pressing the message to bring up the
message context menu.  Can be done while viewing an individual message
by using the hotkey G (toggle).  To-do: add a Flag/Unflag option to a
menu in the individual message view.

Add sending the Answered flag to the IMAP server when replying to a
message.  This is currently done as soon as the reply is started.
Perhaps it would be better to wait until the reply is sent, but that
would require keeping additional state with the draft.  Messages to
which the user has replied are indicated with a white arrow next to
the subject.

To-do: In the MessageView, provide visual indication of Flagged and
Answered states.
2009-01-13 05:52:37 +00:00
Daniel Applebaum 65bbc7e68a Improved synchronization timing and WakeLock algorithm. This new
approach should guarantee that the syncing never stalls just because a
single attempt exceeds the (currently 10 minute) WakeLock timeout.  At
the sync frequency, K-9 will wakeup again and refresh the WakeLock for
another go at syncing.  This should make synchronization much more
reliable in the face of slow or unavailable connections, in particular
ones which hit the socket read timeouts.

Also, fixed the audible notifications so that the ringtone selected
is always for one of the accounts with new unread mail.

Developers now have the option to turn on a fast-flashing LED during
synchronization in order to observe whether synchronization is
happening while the handset is apparently asleep.  I think this option
would be aggravating to non-developer users.  See
Email.NOTIFICATION_LED_WHILE_SYNCING


Issue 175
Issue 170
2009-01-11 23:43:32 +00:00
Daniel Applebaum 95c47fcddc Restore ability for FolderMessageList "Refresh" to get a new list of
folders

Automatically clean up deleted messages in Outbox (make deleted
messages destroyed); don't try to send deleted messages, destroy
messages in outbox when deleting.  (Yep, the first and third items are
redundant, but will automatically clean up damaged outboxes)
2009-01-09 05:39:43 +00:00
Daniel Applebaum 2eaa99bb3a Do not delete remote messages during sync. Trust the delete routines
to send the proper delete requests (delete, mark read, nothing).
Otherwise, this code will delete on the server any message deleted on
the handset, no matter option the user selects.
2009-01-07 06:36:46 +00:00
Daniel Applebaum 3a3dc2da43 Instant deletes from FolderMessageList. Faster deletes from
MessageView

Deleting a message in Trash deletes it for real (permanently)

All message operations are allowed on messages in the Outbox.  Special
handling for deleting, so that the message is copied to Trash, then
copied asynchronously to the remote Trash.

Add some more items to the hotkey help
2009-01-07 06:02:04 +00:00
Daniel Applebaum 828ceba503 Set to use new folder display and sync class defaults.
Accounts are now set:
Folder display mode = All except 2nd Class
Folder sync mode = Only 1st Class

Only the Inbox is set for:
Folder sync class = 1st Class
All other folders have class set to None for sync and display

Also restored an optimization on opening local folders that I
removed.  It is now optimistic, and in the normal case does not have
to make an explicit existence check
2009-01-03 01:47:24 +00:00
Daniel Applebaum 4cc1ea489a Restored automatic creation of a local folder on open. Why was this
removed in K9?  I can't find the history of LocalStore.java to find
the answer.  Eliminated now redundant creation of Outbox and Drafts
folders.
2008-12-31 16:05:03 +00:00
Daniel Applebaum 334d64141f Complete merge of DAmail functionality into K9mail. Following
features are added to K9mail:

1) Show unread message count on each folder
2) Sum unread count of all shown folders in an account to the account display
3) Periodically check selected folders for new mail, not just Inbox
4) Don't refresh folder when opened (unless folder is empty)
5) Show date and time of last sync for each folder
6) Fix timer for automatic periodic sync (use wakelock to assure completion)
7) Optimize local folder queries (speeds up account and folder lists)
8) Show Loading... message in status bar indicating which folder is being synced
9) Eliminate redundant sync of new messages (performance enhancement)
10) Improve notification text for multiple accounts
11) Do not automatically sync folders more often than the account-specific period
12) Use user-configured date and time formats
13) Select which folders are shown, using configurable Classes
14) Select which folders are synced, using configurable Classes
15) Added context (long press) menu to folders, to provide for Refresh
and Folder Settings
16) Status light flashes purple when there are unread messages
17) Folder list more quickly eliminates display of deleted and out-of-Class folders.
18) Delete works 
19) Mark all messages as read (in the folder context menu)
20) Notifications only for new unread messages
21) One minute synchronization frequency
22) Deleting an unread message decrements unread counter
23) Notifications work for POP3 accounts
24) Message deletes work for POP3 accounts
25) Explicit errors show in folder list
26) Stack traces saved to folder K9mail-errors
27) Clear pending actions (danger, for emergencies only!)
28) Delete policy in Account settings
29) DNS cache in InetAddress disabled
30) Trapped some crash-causing error conditions
31) Eliminate duplicate copies to Sent folder
32) Prevent crashes due to message listener concurrency
33) Empty Trash
34) Nuclear "Mark all messages as read" (marks all messages as read in
server-side folder, irrespective of which messages have been downloaded)
35) Forward (alternate) to allow forwarding email through other programs
36) Accept text/plain Intents to allow other programs to send email through K9mail
37) Displays Outbox sending status
38) Manual retry of outbox sending when "Refresh"ing Outbox
39) Folder error status is persisted
40) Ability to log to arbitrary file

Fixes K9 issues 11, 23, 24, 65, 69, 71, 79, 81, 82, 83, 87, 101, 104,
107, 120, 148, 154
2008-12-31 03:49:09 +00:00
Bao-Long Nguyen-Trong 56d1ede846 . Added silent 'on going' notification when checking email 2008-12-19 22:30:55 +00:00
Jesse Vincent 28e8827827 Even more progressive rename/unfork work 2008-12-16 23:34:01 +00:00
Jesse Vincent ac55d3034b oops 2008-12-16 23:09:23 +00:00