collection sync and discovery fixes

Among other stuff.

Yes, I guess this got a bit big again... but I tried to keep commits small. :)
Most important are the fixes to CalDav.js. Maybe this solves your issues with owncloud?
The collection stuff is necessary if remote folders change.

And then there are some smaller fixes for upsync.