Dear all,
I have created a kind of "proof-of-concept" for porting mozilla-sync to
use OSYNC_START_TYPE_EXTERNAL.
I post my approach here both to get the comments of the community, and
in the hope that it may help others.
What I did was actually quite simple, after all:
(1)
In get_sync_info I added
osync_plugin_set_start_type(pOSyncPlugin, OSYNC_START_TYPE_EXTERNAL);
(2)
In the plugin for Thunderbird (i.e *not* mozilla-sync, but the one that
runs inside Thunderbird) I added the necessary woodo to start up a new
thread to listen on the plugin pipe.
(3)
I stole the code from osplugin.c and the thread is simply doing this:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
OSyncError *error = NULL;
OSyncQueue *incoming = NULL;
OSyncQueue *outgoing = NULL;
OSyncClient *client = NULL;
client = osync_client_new(&error);
if (!client)
goto done;
/* Create connection pipes **/
incoming = osync_queue_new(pbz->mySzPathToPipe, &error);
if (!incoming)
goto error;
if (!osync_queue_create(incoming, &error))
goto error;
/* We now connect to our incoming queue */
if (!osync_queue_connect(incoming, OSYNC_QUEUE_RECEIVER, &error))
goto error;
if (!osync_client_set_incoming_queue(client, incoming, &error))
goto error;
osync_queue_unref(incoming);
osync_client_run_and_block(client);
osync_client_unref(client);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
As you may have seen in my other mails, there are still a couple of
outstanding issues.
/Henrik
|