Must converUserName to the auth name to access the state data.

Bug: 12186
BFN
Keep security related changes at top, add missing period.
Bug: 12188  Be more consistent with address book selection.

Really need to clean up default addressbook stuff in general, but
this avoids issues with syncing in the meantime.
Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>
BFN
Work around broken HTC clients (again) that send empty tags for array values.

Bug: 12187
Signed-off-by: Michael J Rubinsky <mrubinsk@horde.org>
Need to check for the message vanishing while building it too.

Prevents the an error if someone deletes a message on the server
during an initial sync after the uids are polled but before they are
sent to the device.
BFN
Update history instead of appending to it (=bloating)
Store Kolab_Storage_Factory in class (we need it later on)
Compute proper history prefix for Kolab objects

The IDs in the history database are always
formatted like this: "APPNAME:SHARE_ID:OBJECT_UID".

Kolab must compute the same prefix for objects
synced in from foreign clients. Otherwise client code
using the listBy() or getChanges() API (=ActiveSync)
would miss those objects.
Only consider known 'action' values for finding the latest history entry
Re-issue 'add' action for an object if the last action was 'delete'

In the Kolab world, objects can vanish
and re-appear using the same object uid.
(a foreign client is sending an update over a slow link,
 we see the delete first and minutes later the APPEND/add request)
Only issue a 'delete' action if all copies of an object are gone

Otherwise we just deleted a duplicated object or updated the original one.
(An update results in an ADDED + DELETED folder action)
Improve IMAP folder UIDVALIDITY change detection. Fixes #11807.

We stored the whole list of IMAP UIDs of a folder next
to every object. This turned out to be a major memory
and CPU time hog (see #11807).

Instead we detect a change of UIDVALIDITY at the
IMAP folder cache level (where it belongs) and pass
the information about a reset situation to the
history 'query' as additional parameter.
Full sync for the history database: Mark vanished entries as deleted
Update history instead of appending to it
Tie Kolab_Storage to Horde_History if enabled

Otherwise Kolab_Storage_Factory::createHistory()
will use the in-memory only Horde_History_Mock object.
Fix Kolab <-> Horde_History sync marker: The 'sync' timestamp must be per folder

Otherwise one folder overwrites the sync marker of other folders.

We need to keep our own timestamp since the sync of a folder cache
might be successful but the history sync could fail (timeout etc).
Adapt Kolab Horde_History unit test to new id prefixes