On lør, 2012-09-22 at 21:54 +0200, Patrick Ohly wrote:
There is an open feature request about Google contacts with some hints
regarding the implementation:
https://bugs.freedesktop.org/show_bug.cgi?id=52679

I'll update the bug report with a mention of my Github code. It doesn't currently include any SyncEvolution-aimed code, but it shows how to access Google Tasks.


As mentioned in the bug report, converting the data from Google into
vCard (or iCalendar for tasks) just to emulate existing backends (like
the one for Evolution) adds another indirection, which makes it harder
to get the data handling right. On the other hand, if GData already has
such a converter, it might be the easiest and fastest way to get
something working.

There's also the libical library. It seems to relieve developers of the headaches of data handling. I'll probably settle for that.

The code now reads tasks and task lists from Google Tasks and stores them in a local format. These are by far the most difficult parts of Google's Tasks data protocol. Updating or deleting items is much simpler because they require much less data processing. I had some trouble with Google's API which turned out to be buggy, but I managed to work around it. The code currently demonstrates that Google's requirement that users manually authorize applications to access their data can easily be circumvented, meaning that it provides a false sense of security. All you need to do is provide your Google username and password to an application, and it will be able to do anything with any of your Google data without you knowing any better.

Right now my primary concern is how to determine which Google Task corresponds to an iCal todo entry. I hope some of you who have experience synchronizing data can help me out here.

Google Tasks have unique IDs, but they're read-only. So if the Google Task is created first, then the Google Task ID could be used as a UID. However, if the iCal todo is created first, then its UID cannot be copied to the Google Task ID. Similarly, a Google Task includes a self-link which uniquely identifies the task (basically because its UID is repeated in the self-link; hopefully this data redundancy doesn't reflect the design of Google's Tasks database), but it's read-only, too. This leaves only "due date," "title," and "notes" as candidates for identifying the tasks, and even they are rather prone to change.

Is it generally acceptable to create, say, an "x-google-task-uid:" with the Google Task ID in the VTODO section and use that to synchronize with?

Similarly, since Google Tasks include a handful of fields that don't correspond to any iCalendar keys, should they be named with some "x-google-task-<property>"?

--
Ole Wolf
Rødhættevej 4 • 9400 Nørresundby
Telefon: 9632-0108 • Mobil: 2467-5526 • Skype: ole.wolf