mercredi 21 mai 2008

phpGW third item from todo list: Or how to try to debug two apps each others ...

Hi all

I'm working on Sync since 3 days. First I had to compile the opensync / libsyncml stuff. I found some interesting help on compilation Opensync (here) and use. You should know that at time of writing, you should stick to the svn version 3307 (found why here) to be able to play a little bit with it.
To use it with phpGW I was obliged to made some patches that I still need to send back to the opensync project. Here's are some of them :
  • in libsyncmlclient :

    Index: src/syncml_http_client.c
    ===================================================================
    --- src/syncml_http_client.c (révision 3307)
    +++ src/syncml_http_client.c (copie de travail)
    @@ -558,6 +558,8 @@
    * automatically detect the datastores.
    */
    SmlDevInf *devinf = smlDevInfAgentGetDevInf(env->agent);
    + if(devinf != NULL)
    + {
    unsigned int stores = smlDevInfNumDataStores(devinf);
    unsigned int i;
    for (i=0; i < ctx =" osync_context_new(error);">
    @@ -570,6 +572,11 @@
    smlDevInfDataStoreGetSourceRef(datastore),
    contentType, version);
    }
    + }
    + else
    + {
    + osync_trace(TRACE_ERROR, "NULL devinf returned !");
    + }

    /* disconnect from the syncml server */
    OSyncContext *ctx = osync_context_new(error);

    this patch avoid a segfault when trying to discover the supported materials by phpGW SyncML Server.


Following the tutorial at blog.dukanovic.com in the latest part could help you with how to made it working for phpGW. If you have question don't hesitate to post them here, I will try to help you.

If you are interested by helping us to made sync working for phpGW, you can read this post for infos ...

Second part : Drums .... YEAH !!! It kinda works :).
So here's the step to reproduce my success (at least I Hope).
  1. msynctool --addgroup phpgw2file
  2. msynctool --addmember phpgw2file syncml-http-client
  3. msynctool --addmember phpgw2file file-sync
  4. msynctool --configure phpgw2file 1 : Replace the given file with this content between the <config> tags (on only this, adapted to you needs)

    <auth>BASIC</auth>
    <username>phpgroupware</username>
    <password>********</password>
    <url>http://localhost:80/~phpgroupware/syncml/syncml.php</url>
    <recvlimit>40000</recvlimit>
    <maxobjsize>4000000</maxobjsize>
    <syncml_version>1.1</syncml_version>
    <database>
    <name>my-notes-collection</name>
    <objtype>data</objtype>
    <objformat>plain</objformat>
    </database>

  5. msynctool --configure phpgw2file 2 : replace the content between <config> tags with

    <directory>
    <path>/tmp/tests/notes</path>
    <objtype>data</objtype>
    </directory>
    (note : the '/tmp/tests/notes' directory should exists)

  6. msynctool --discover phpgw2file 1

  7. msynctool --discover phpgw2file 2

  8. msynctool --sync phpgw2file


And YEAH ! it works ... Well ... mostly. Now you have to fix bugs in the ipc layer to let notes getting all be backs. But you can try to add a new notes, it could work ...

Regards.

Caeies

Aucun commentaire: