Bug 1097421 - Upgrade email.js libraries to move to upstream startTLS

This is primarily a move to the upgrade startTLS functionality.  This included
a fix to the SMTP implementation where a server could avoid TLS-initiation by
not implementing EHLO.  (https://github.com/whiteout-io/smtpclient/pull/20).
This goal was bug 1060558.

An additional fix we had made locally but not upstreamed (but have now
upstreamed) and that has improved test coverage on our end (see test_mine) is
a problem relating to newlines.  See
https://github.com/whiteout-io/browserbox/issues/35.

Other (new) fixes folded in here:
- Namespace NIL delimiter: https://github.com/whiteout-io/browserbox/pull/36
- trailing whitespace in bodystructure list:
  https://github.com/whiteout-io/imap-handler/pull/8

Fixes we had made locally and upstreamed but not taken via the release process:
- NIL delimiters for LIST https://github.com/whiteout-io/browserbox/pull/27 and
  LSUB https://github.com/whiteout-io/browserbox/pull/29 (discovered while
  investigating bug 1091295 and bug 1084216)
checkpoint; including probe refactoring for UIDNEXT changes
Bug 1093467 - Servers that don't support UIDNEXT
Bug 1100694 - [email/IMAP] Handle missing timezone for INTERNALDATE date-time, as generated by netc.fr / net-c.com
Bug 1101982 - If IMAP and SMTP fail, use IMAP's error.

Without this patch if SMTP rejects first, we'll use SMTP's error code
even though we meant to use incoming's.  This is consistent with us
reporting the incoming server as the one having the problem.
Bug 1101982 - Return 'bad-user-or-pass' for SMTP gmail app-specific pw failure

We removed specific error support for gmail's account-specific password
error since we always want to be using OAuth2 anyways.  However, we should
return something better than 'unknown' as a result.  (And in retrospect
maybe we shouldn't have removed our existing error handling.)
Bug 1097421 - Take more upstream browserbox changes

This also includes some of our fixes having been accepted upstream.

We have some more changes going upstream, so we want to take these too to
keep in sync.

The most notable change here is that browserbox no longer issues a wasted
CAPABILITY if we're going to issue STARTTLS anyways.  Accordingly there have
been test updates for that.
Bug 1089132 - Fix x-unknown charset explosion in mimefuncs

Upstreaming as https://github.com/whiteout-io/mimefuncs/pull/8
Bug 1089132 - Do not quote dates in SEARCH

Yandex does not like its dates wrapped in double-quotes.  Either way is
legal.

Upstreaming as https://github.com/whiteout-io/browserbox/pull/42
Bug 1096025 - Make sent messages marked as read.

For IMAP we had a regression when we moved to email.js.  The imap.js impl we
were previously using would prepend the backslash for us.  browserbox does not,
which makes more sense, but we forgot to update our code.  This is now
corrected and checks have been added to test_compose to verify this.  (The
tests fail without the change.)

It also turned out that our POP3 implementation was not setting the messages as
read, so I've done that.

We also had the same problem for ActiveSync, but that was due to the server not
marking the message as read when saving to the sent folder.  (AKA it wouldn't
have been a problem in the real world).  I've updated this in mail-fakeservers
in the 0.0.33 release.
Bug 1096058 - Implement createFolder for email.js and add tests

When we moved to email.js, createFolder was completely broken.
I've done the following:

- Implemented a createMailbox function in browserbox:
  https://github.com/whiteout-io/browserbox/pull/43

- Cleaned up our createFolder job.  This is reasonably straightforward.  The
  big change is we no longer perform a "LIST" after the fact to see what name
  transforms might have happened.  I added a comment explaining this change.
  It's probably important to note that the original choice of doing that I
  think was primarily a cop-out on my part from trying to understand the folder
  naming rules and having had the goal of createFolder being a comprehensive
  feature we'd surface to users.

- Fixed a testing infrastructure oversight.  expect_runOp had explicit support
  to expect a specific error result for runOp_end.  Unfortunately due to an
  asymmetry with other log types (ex: event) and the "error" argument having
  a value of false, we were not actually checking the value!  For the purposes
  of minimalism, I updated the log definitions rather than log.js.  This
  required minimal changes to test_disaster_recovery.js and to js/jobmixins.js
  for downloadBodyReps to make sure the error code was explicitly null rather
  than undefined.

- I cleaned up comments as I went.

- mail-fakeservers enhancements that get pulled in please see the commit comment
  there: https://github.com/mozilla-b2g/mail-fakeservers/pull/28

Testing-wise, we have the following coverage:

- The unit tests I added to browserbox above.  They're pretty simple, but get
  us coverage of utf-7 encoding/decoding verification which we don't test
  in here.

- Added a unit test for the path-generating logic that has pretty good coverage
  (I feel).

- Added a fakeserver-using test that makes sure we create the folders and also
  tests both of the expected exceptional cases: "the folder totally already
  exists and it's known locally, dude", and "the server ALREADYEXISTS on the
  server".  Not explicitly tested is that if the server just outright fails
  that we generate the correct error.  However, I manually verified we do this
  during the process of development because of doing this TDD-style.
Provide information to the IMAP ID (RFC 2971) extension

This makes us generate a line like so when we connect to a server that
advertises the ID CAPABILITY:
W2 ID ("vendor" "Mozilla" "name" "GaiaMail" "version" "0.2" "support-url" "http://mzl.la/file-gaia-email-bug")

See http://tools.ietf.org/html/rfc2971#section-3.3 for context.
Merge pull request #353 from asutherland/emailjs-upgrade-tls

Bug 1097421 - [email] Upgrade email.js omnibus bug. r=jrburke