Road to ThunderSync 2: A New Sync Process?

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:

  1. Read file(s) into a temporary addressbook variable
  2. Compare temporary addressbook to addressbook, register differences
  3. Let user decide what to do
  4. 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…