webOS-ports/org.webosports.service.contacts.carddav — pull request #2 by Garfonso (2013-08-12 16:57:23+00:00)
Title: initial downsync with data conversion libs copied over from syncml connector

- uses mojoservice.transport.sync framework to handle all the nasty stuff (activity management for automatic sync, remote to local ID mapping, tracking local changes)
- includes minimalistic and pretty simple CardDav/CalDav library in CalDav.js. Not throughly tested for standard compliance
- downsync of vCard and iCal is working (but not 100% tested) on webOS 2.2.4 (emulator and phone)
- upsync is partly implemented, but currently deactivated
- for iCal <=> webos datatype conversion an old lib from SyncML connector is copied. This is pretty ugly code (I beautified the public api a bit, but did not dig deep. I'm a bit horrified of that...), but it works. It did a good job in the SyncML connector for a few years now and was tested with 6-7 different servers (including upsync). But it should be easy to replace, if we find something more suitable.
- for vCard <=> webos datatype conversion basically the webos internal conversion is used... but it is not meant to be used by ordinary applications (or I did not find out how. This is NOT documented), but only meant to read/write vcf files. So vCard.js exists to write and delete temporary vcf files. It also contains some hacks that prevent the conversion engine on 2.2.4 from crashing (and the contact linker!). Downsync should be fine. The photo part can only handle embedded photos, though, no photo URLs. Upsync contains a lot more hacks for eGroupware => this needs some more revision.
- keymanager.js is copied over from the SDK example. Is that ok from a license viewpoint?
- encodingStuff.js should be cleaned up sometime... does Base64 encoding/decoding (which is nice, using node.js buffers :)), but also quoted_printable (used in old vCard/iCal stuff) and qouting of dangerous chars.
- oncreateassistant.js/prologue.js prevents duplicate account creation. onCreate is called for every datatype (i.e. contact and calendar)... don't know why they do that. IMHO this is a bug on 2.2.4 in the account manager. Additionally stores url/name of server.

That's what came to my mind... I'm actually using this on my Veer (with webOs 2.2.4) for a day now. At least the phone did not die from it and my data seems to be in shape, too. :) It actually feels faster than the SyncML connector.