Fix parsing of IMAP folder names (#4830).
Merge remote-tracking branch 'drebs/bug/4830_handle-unicode-in-folder-names' into develop
defer costly operations
Move flags and other metadata to a separate doc.

This change will allow for quicker access times, and smaller
syncs since the fields that change more often will fall in a
pretty small document. For the big raw message, we only need
to sync once.

Also, implemented multipart interface for messages.
This will need additional migration helper in --repair-mailboxes.
inlineCallbacks all the things!
Split the near-2k loc file into more handy modules.

...aaaand not a single fuck was given that day!
First stage of the storage schema rewrite.

* Separates between flags, docs, body and attachment docs.

* Implement IMessageCopier interface: move and have fun!
  This little change is known to push forward our beloved architect
  emotional rollercoster.

* Message deduplication.

* It also fixes a hidden bug that was rendering the multipart mime
  interface useless
  (yes, the "True" parameter in the parsestr method).

* Does not handle well nested attachs, includes dirty workaround that
  flattens them.

* Includes chiiph's patch for rc2:

 * return deferred from addMessage
 * convert StringIO types to string
 * remove unneeded yields from the chain of deferreds in fetcher
add documentation to the decorator, fix errorback.

* it also fixes the traceback in the errorback, thanks to
  chiiph, who reads documentation instead of whinning :D

* other minor documentation corrections
fix tests after rewrite
tests infrastructure for multipart
move utility to its own
Second stage of the new year's storage rewrite.

* documents of only three types:
  * flags
  * headers
  * content
* add algorithm for walking the parsed message tree.
* treat special cases like a multipart with a single part.
* modify add_msg to use the walk routine
* modify twisted interfaces to use the new storage schema.
* tests for different multipart cases
* fix multipart detection typo in the fetch

This is a merge proposal for the 0.5.0-rc3.

known bugs
----------
Some things are still know not to work well at this point
(some cases of multipart messages do not display the bodies).

IMAP server also is left in a bad internal state after a logout/login.
handle all fetches as sequential

* this allows quick testing using telnet, and the use of other
  less sofisticated MUAs.
add a quick message fetching utility for tests
changes file updated
Merge remote-tracking branch 'refs/remotes/kali/feature/split_message_docs' into develop
add a flag to be able to close the session
Convert unicode to str when raising in IMAP server (#4830).
Merge remote-tracking branch 'refs/remotes/drebs/bug/4830_convert-unicode-to-str-when-raising-on-imap-server' into develop
Merge remote-tracking branch 'refs/remotes/kali/bug/4925_close_session' into develop