quota - commit each quota as soon as possible

This is not only more efficient, and actually correct, but
it removes the window in which folders can be created and
not be counted correctly (except in the case of multiple
subroots, where things can happen between them)
quota: change api for init/free

Always use quota_init rather than setting just the root in an otherwise
non-initialised structure, and always free the structure at the end.

By sticking to this pattern, we don't assume anything about the internals
of struct quota - so can add new things which might need freeing.
quota: use init/free to avoid caching piles of extra leaky memory
Fix memleak in quota_write()
Rename annotatemore_init -> annotate_init
Rename annotatemore_done -> annotate_done
Move mailbox pattern applying out of annotate.c

Which is part of a cunning plan to eliminate the need for namespace* et
al in the annotate code entirely, and push it all back where it belongs
in imapd.c.
Annotate code deals entirely in internal mboxnames

and leaves the internal <-> external futzing to callers and callbacks,
all of which happens in imapd.c now.  This should enable use to remove
the namespace* et al entirely from annotate.c.
Remove namespace* from annotate.c

which leaves annotate_state_set_auth() with one less argument.
Unfortunately getting rid of the others will not be so easy.
Add ANNOTATION_SCOPE_UNKNOWN

instead of using the magic number -1.
Return errors from annotate_state_set_FOO

At the moment most of these cannot fail, but soon they will be the
primary way of reporting errors when opening databases.
Revamp annotation transaction model

- Remove annotatemore_begin(), transactions are now started
  automatically as a side effect of calling API functions which modify
  the database.

- Transactions can be started multiple times - updates accumulate until
  the txn is aborted or committed.

- Transactions are no longer "global" in the sense that they apply to
  all the annotation databases which might be open (the global DB and
  any per-message DBs).  Instead, the annotate_state_t object stores a
  pointer to the annotate_db_t that it's using.  This is set up as a
  side effect of calling any of the scope setting functions
  annotate_state_set_server() etc.

- Replace annotatemore_{abort,commit}() with new functions
  annotate_state_{abort,commit} which take an annotate_state_t* and
  abort or commit only that one DB.  They also free the state object, so
  annotate_state_free() is now static.  This pattern corresponds more
  closely with how the conversations code works.

- So for getting or setting per-server and per-mailbox annotations, the
  sequence of calls proceeds entirely using the state API:

  annotate_state_t *astate = annotate_state_new();
  r = annotate_state_set_server(astate);
  annotate_state_set_auth(astate, ...);
  annotate_state_store(astate, ...);
  ...
  annotate_state_commit(&astate);

- Per-message scoped annotations are treated differently; instead of the
  setter function managing a state*, the struct mailbox keeps one in a
  new field mailbox->annot_state.  That is created as a side effect of
  calling mailbox_get_annotate_state(mailbox, uid, &astate), and is
  committed when mailbox_commit() is called.

  This arrangement allows the same txn to be used to store multiple
  annotations to multiple messages, or expunge the annotations for
  multiple messages.  Sadly the lack of a mailbox_abort() or similar
  means we are forced to abort the mailbox's annotation txn manually at
  times.

- Dropping the last reference to an annotate_db_t while there are
  outstanding uncommitted updates now generates a whiny syslog message.

Conflicts:

	imap/annotate.c
	imap/imapd.c
	imap/mailbox.c
cunit: remove namespace from a_s_set_auth()
cunit: remove annotatemore_begin() tests

That function is now gone.
cunit: check a_s_set_server() et al return values
cunit: annotate API uses internal mailbox names

entirely now, instead of bizarre admixture of internal and external.
cunit: check a_s_set_server() et al return values (bis)
Be extra paranoid in annotate_state_set_scope

Previously it was possible to use the same state object to store a
per-message annotation, then change scope and use it again to store a
per-server annotation.

This worked because, although the data are stored in two different DBs,
the transaction model was global across DBs.   Now the transactional
model is one txn in one DB per state object, so we can't do that
anymore.

The actual imapd code never did this, but some of the unit tests did.
So, be slightly more paranoid and just assert that it's not happening.
Revamp annotation transaction model (bis)

Need to explicitly begin a txn before calling _annotate_rewrite().
Fix annotate_msg_copy() back up again

There's a subtle requirement here - that the destination mailbox must
have had mailbox_get_annotate_state() called on it, otherwise the data
copied will never get committed.  Also, we need to explicitly start a
txn.

Do that extra call in both the callers, and assert that it's true in
annotate_msg_copy().