Commit Graph

25 Commits

Author SHA1 Message Date
Todd Kennedy a50fc99b0c Use Account instead of URI to create transports
There's no need to create a URI just to rip in appart again. Additionally, to
support additional changes (i.e. to use Mailbox instead of Folder in the
MessageController), we need to store the actual Account.

NOTE -- This change only affects IMAP and POP3. SMTP will come in a follow-on CL

Change-Id: I400036a17271c99272fd9c603547dcd713b50b9d
2011-04-20 08:31:24 -07:00
Marc Blank 31d9acbf06 Email split, part huit: Refactor constants, clean emailcommon
* There are three pieces to this CL (sorry):
  1) Move and/or rename some constants into emailcommon
  2) Move Utility to emailcommon, moving the few UI
     related utilities back into Email (FolderProperties
     and UiUtilities)
  3) Remove all references to resources from emailcommon
* The three pieces relate in that, between them, they allow
  the emailcommon static library to compile cleanly

Bug: 3442973

Change-Id: Ic5e3abaa2a1b36999e0b6653c6c2134ea1bd544f
2011-02-14 12:18:10 -08:00
Todd Kennedy 32311cce01 Implement IMAP prefix support
We support two different ways for an IMAP prefix to be specified:
  1. A text field on the IMAP configuration page. This is the most obvious to
     the end user. It is also an explicit, manual configuration.
  2. RFC2342 defines a NAMESPACE IMAP command to be able to query the prefix
     from the IMAP server. This is an automatic configuration without any
     user involvement (i.e. the UI will NOT change if a prefix is loaded in
     this way)

If the user goes to the trouble of specifying a prefix, we will always honour
it instead of the namespace returned by the IMAP server -- even if the user's
configuration is wrong.

bug 1592696

Change-Id: I6b94c7aaac538f6cd9dc4694b0f1634e8c956bc1
2011-02-11 14:17:48 -08:00
Marc Blank 2193962ca2 Email split, part quatre: Move along, nothing to see here
* No code was harmed, er, changed in the making of this CL
* All that's happened is that code that is needed by both Email and
  Exchange have been moved into emailcommon
* This required import changes to many files, which explains the
  length of the CL

Change-Id: I4e12455ba057a4a8054fdbd0b578c73afa411c8a
2011-02-10 16:28:37 -08:00
Andy Stadler 54ab7a27a3 Fix NPE in pop3 checkcapabilities
* This happens if an open fails immediately (error message in the
  initial banner) followed by a checkSettings.
* The fix is to harden checkSettings to force a clean connection
  every time.

Bug: 2170147
Change-Id: If7403bf517477d2b03b21d71caab511fe45e234c
2010-11-04 23:34:26 -07:00
Makoto Onuki 0a8030562a Fix flaky tests
Follow up to I3bf7d340.  Make sure temp directory is set before running tests.

Turned out Application.onCreate doesn't seem to be guaranteed to be run
before unit tests.

Without this, some tests may fail saying: "TempDirectory not set.
Application hasn't started??", if onCreate runs too late.

Change-Id: Ic5aee939a2c21f9579a643d0729dd0e9ba81022e
2010-05-17 14:07:34 -07:00
Makoto Onuki 9c9e757917 Add static method to get temp dir in Email.
I need to be able to get the temp dir from anywhere without Context
for the new IMAP parser.

Change-Id: I3bf7d34059399a8253c0760ebc392804ea434412
2010-05-13 18:27:34 -07:00
Andrew Stadler 645fc28301 Try TOP even on POP servers that fail to report CAPA
* Ignore the results of CAPA and always try TOP
* If TOP returns -ERR simply fall back to (bad old slow) RETR
* Unit tests for positive & failure cases

Bug: 2588432
Change-Id: Ife4b551217de1025e14efc46074f16ef4ae99c6f
2010-04-12 10:56:55 -07:00
Andrew Stadler e4a7cc440f Re-enable modernized version of "optional" SSL/TLS
* Add "Accept all certificates" modes to incoming/outgoing secure choices
* Change URI scheme slightly to make "trust" a flag, not part of the
    protocol.
* Change Stores to know about new URI scheme
* Slightly rework Transport API to make "trust" an independent flag
* Adapt HostAuth to handle new Uri scheme
* Remove the old ambiguous "optional" code, which was allowing
    some unsigned certificates, but was *also* allowing TLS to
    optionally start (though not SSL, despite the UI strings.)
* Add a few unit tests to EmailContent
* Add logging and a bunch of comments to TrustManagerFactory, and a bit
    of simple cleanup to make it more readable.
* Add missing conversion of SSLException->CertificateValidationException
    in TLS so we get the correct certificate errors from TLS too.
* Re-enable TLS for mac.com accounts (which had a certificate problem)

Fixes bug http://b/2119755, http://b/1374780, and probably a raft of
earlier and/or external bugs about certificate problems.

Change-Id: Iaf99a8da3eaadaa4cdeec224737838b5d6813e55
2009-09-29 15:28:43 -07:00
Andrew Stadler c41c47fa07 Enable message upload
* Create logic to detect upsyncable messages in Sent
* Note:  Drafts is now local only for IMAP - no sync, either way
* Rewrite MessageController.processPendingAppend for Provider world
* Write provider message -> legacy message converter
* Fixed bug in IMAP APPEND (it was not picking the right UID for the
    uploaded message.)
* Better handling of server internaldate
* Add constants for new X-Android-Body-Quoted-Part header
* Add EmailContent routines to get each of the 5 parts of the body
* Remove "Load more" from unsynced message lists
* Add toString to MimeHeader for debug support

Bug # 2097471

TODO (next CL): Upload attachments records too

Change-Id: I209182f5adc6b6696919f559e3cbbdd58b3eed3a
2009-09-25 14:54:32 -07:00
Andrew Stadler 092d35c98d Fix NumberFormatException in POP3 message sync
* Write unit test to replicate failure(s) in POP3 use of parseInt.  All
    calls to parseInt must be guarded by try/catch NumberFormatException.
* Fix the failures

Bug # 2115586
2009-09-16 12:20:38 -07:00
Takaoka G. Tadashi 4f23ebd3dc Fixed Pop3Store to be able to delete message in Inbox.
When delete policy is DELETE_POLICY_ON_DELETE, PENDING_COMMAND_TRASH
will be invoked. But in POP3 account, because of 1) Inbox is
OpenMode.READ_ONLY, 2) getMessage(uid) just after open() is not work
correctly, 3) remote Inbox folder is not closed after deleting message,
PENDING_COMMAND_TRASH does not work.  And also the fat that some POP3
server use UID with '-' prevents PENDING_COMMAND_TRASH to recognize
the message is remote message.

Internal Bug: 1651709
2009-06-26 10:36:27 +09:00
Andrew Stadler b011a812e0 Fix the java.lang.StringIndexOutOfBoundsException that occurs when an SMTP server closes the connection early or returns an empty line.
Fix the same error in the Pop3 UIDL parser.
2009-05-22 11:48:14 -07:00
Andy Stadler c9f151d4fe AI 148230: Allow stores to indicate if they support server-side copying of sent
mail into the "Sent" folder, thus eliminating the need to perform a 2nd
  upload into the server's Sent folder.  IMAP and POP3 do not support
  this (although IMAP could when it recognizes Gmail IMAP servers.)
  BUG=1807499

Automated import of CL 148230
2009-05-01 16:36:34 -07:00
Andy Stadler 5551f7feb2 AI 147714: New, lighter-weight version of CL 147620. Still touches as many files,
due to API change, but still has a smaller footprint.  Also fixes the
  bug in the original, which is that we actually needed to udpate the
  local trash folder, not the remote one.
  BUG=1807499

Automated import of CL 147714
2009-04-24 11:54:42 -07:00
Andy Stadler b633efa2b7 AI 147708: Automated g4 rollback of changelist 147620.
*** Reason for rollback ***
  We figured out a simpler solution affecting fewer files - we
  don't actually need the new remotestore API.
  *** Original change description ***
  Some stores require changing the UID of a message when it is
  copied to a new folder (I'm looking at you, EAS).  Add a callback
  to Folder.copyMessages() which allows the store to report back
  such changes.  Then, add a new api to record the new values:
  Folder.updateMessages().
  For now, the two APIs are linked by a common callsite in
  MessagingController, so the existing stores can use a minimal
  implementation - if they don't call the callback, nobody will
  call the update.
  BUG=1807499

Automated import of CL 147708
2009-04-24 11:13:36 -07:00
Andy Stadler 1df530294d AI 147620: Some stores require changing the UID of a message when it is
copied to a new folder (I'm looking at you, EAS).  Add a callback
  to Folder.copyMessages() which allows the store to report back
  such changes.  Then, add a new api to record the new values:
  Folder.updateMessages().
  For now, the two APIs are linked by a common callsite in
  MessagingController, so the existing stores can use a minimal
  implementation - if they don't call the callback, nobody will
  call the update.
  BUG=1807499

Automated import of CL 147620
2009-04-23 23:16:01 -07:00
Andy Stadler 1f48259d22 AI 146360: Provide an API by which the server (or store) can tag some
of the role-specific folders such as Drafts, Sent, or Trash.
  This allows us to properly target these folders even on
  systems where they have different names.  I capture the
  tagged names into the existing columns in the account data,
  where they are used elsewhere in the code (no changes
  necessary).
  Use default implementations on POP3 and IMAP for now -
  no change from original behavior.  The new code is
  primarily to support EAS (for now).
  BUG=1790798

Automated import of CL 146360
2009-04-15 12:58:19 -07:00
Andy Stadler c6039f7d17 AI 146134: Add persistence API for remote stores & folders to use while
syncing.  This provides a key-value store, per folder, that
  can be used by network Stores to record persistent data such
  as sync status, server keys, etc.
  Note that, by definition, this only applies to remote folders
  (e.g. IMAP, POP3). You'll see everywhere that LocalFolder is
  passed null, and this is correct - LocalFolder *is* persistent
  storage and does not need external help.
  Note to reviewers:  The core changes are Folder.java,
  LocalStore.java, and LocalStoreUnitTests.java, so please give
  them the bulk of your reviewer attention.  The other files
  are just following along with minor API changes.  Of those,
  the one worth close examination is MessagingController.java,
  which is the only place in the system where remote Folders
  are bonded with Local Folders and thus where this new API
  comes into play.
  Note to jham:  Can you please take a look at
  LocalStore.LocalFolder.setPersistentString() and recommend
  better SQL foo than my primitive test-then-update-or-insert
  logic, which is not transactional or threadsafe.
  BUG=1786939

Automated import of CL 146134
2009-04-14 10:15:07 -07:00
Andy Stadler cd7e5664f9 AI 146061: Add persistent storage that Store classes can access.
The current design for Store classes (e.g. IMAP) did not provide for
  any persistent storage.  This is the beginning of a mechanism to
  provide that.  It's quite simplisitic - each Store can read/write one
  persistent string - but that's enough for the first simple use case
  (saving some sync data for EAS).
  The core changes here - suggest reviewing first - are in Account.java,
  Store.java, and AccountUnitTests.java.  Everything else is just
  following the API change that was necessary.
  Note that, by definition, this only applies to remote stores (e.g.
  IMAP, POP3).  You'll see everywhere that LocalStore is passed null, and
  this is correct - LocalStore *is* persistent storage and does not need
  access (so far, at least).
  BUG=1786939

Automated import of CL 146061
2009-04-13 20:07:56 -07:00
Andy Stadler ae8ca3fbd1 Automated import from //branches/donutburger/...@143018,143018 2009-03-26 17:05:25 -07:00
The Android Open Source Project 3469902379 auto import from //branches/cupcake_rel/...@140373 2009-03-18 17:39:48 -07:00
The Android Open Source Project 96c5af40d6 auto import from //depot/cupcake/@135843 2009-03-03 19:32:22 -08:00
The Android Open Source Project 8c2158a5eb auto import from //depot/cupcake/@135843 2009-03-03 18:28:50 -08:00
The Android Open Source Project 687f9962d7 Code drop from //branches/cupcake/...@124589 2008-12-17 18:05:56 -08:00