Well, the integration of vCards containing multiple vCard entries turns out to be rather difficult.
If only one contact in such a vCard is changed, the entire vCard file has to be rewritten (load, change contact, write back). The current sync process can’t handle this without major modifications. It uses the files for both comparision and synchronisation in separated functions, passing only the differences, UIDs and paths.
One solution would be to do the comparison with a copy of the files in memory:
- Read file(s) into a temporary addressbook variable
- Compare temporary addressbook to addressbook, register differences
- Let user decide what to do
- Change addressbook items, write back temporary addressbook to file(s)
Of course, it is not very efficient to write all files when only one contact differs. But perhaps I can add some ifs and lists to prevent unnecessary I/O…