sön 2004-11-28 klockan 15:05 -0600 skrev Arthur Peters: > I am using multisync with Evolution 2 and a Sony Ericsson T637 (IrMC). > Entries do sync OK. However if I, say, sync then change an enrty on the > phone then sync again, I end up with (on Evo) a new entry of the new > version of that entry in addition to the old instead of a just a new > one. The same seems to accure the other way. I am starting with an empty > Evo address book, but a good few entries on the phone. > > Also, an entry deleted on one side is not deleted from the other. > [snip]
I found the bug and fixed this problem. Please try the attached patch and see if it works for you as well. I recommend doing a backup of the phonebook first (for safety). Apply the patch by issuing the command: (in multisync topdir) % patch -p0 < evolution_ebook.c.patch Technical details: In the function gboolean evo2_addrbook_modify(evo_environment *env, char *data, char *uid, char *uidret, int *uidretlen) the following was performed: uidret = e_contact_get_const (contact, E_CONTACT_UID); The parameter uidret is a pointer to data allocated by the syncengine and the line above overwrites it, with the result that the uid mapping was incorrect. If you look at the ids file you will find that one side of the pair is empty. Actually another bug is that the caller should specify the size of the allocated buffer which uidret points to. However, this modification would affect all plugins and I'll rather wait for 0.90 instead. /Jonas -- Jonas Birmé ([EMAIL PROTECTED]) Jabber: [EMAIL PROTECTED] http://home.birme.se/~birme/ IRC: [EMAIL PROTECTED] | +-----< Abandon the search for Truth; settle for a good fantasy >--
--- plugins/evolution2_sync/src/evolution_ebook.c 2004-11-26 14:06:52.000000000 +0100 +++ ../multisync-birme/plugins/evolution2_sync/src/evolution_ebook.c 2004-11-29 23:25:09.748546032 +0100 @@ -37,7 +37,7 @@ { EContact *contact; - uidret = NULL; + //uidret = NULL; if (uidretlen) *uidretlen = 0; @@ -49,18 +49,36 @@ if (!uid) { contact = e_contact_new_from_vcard(data); if (e_book_add_contact(env->adressbook, contact, NULL)) { - uidret = e_contact_get_const(contact, E_CONTACT_UID); - *uidretlen = strlen(uidret); + // Since uidret is not a char** assigning uidret = + // get_const() is not working. Memcpy (or similiar) must + // be used. The best thing is that the plugin allocates + // this memory, instead of the syncengine. If the + // syncenginge is responsible for allocation the size of + // uidret should be specified. + // By [EMAIL PROTECTED] + if (uidret) { + char *luid = e_contact_get_const(contact, E_CONTACT_UID); + if (luid) { + strncpy(uidret, luid, 256); // FIXME: 256 is hard coded in syncengine + evo_debug(env, 2, "uidret after e_book_add_contact: %s\n", + uidret); + *uidretlen = strlen(uidret); + } + } return TRUE; } } else { contact = e_contact_new_from_vcard(data); e_contact_set(contact, E_CONTACT_UID, uid); if (e_book_commit_contact(env->adressbook, contact, NULL)) { - uidret = e_contact_get_const (contact, E_CONTACT_UID); - printf("new uid after modding %s\n", uidret); - if (uidret) - *uidretlen = strlen(uidret); + if (uidret) { + char *luid = e_contact_get_const(contact, E_CONTACT_UID); + if (luid) { + strncpy(uidret, luid, 256); // FIXME: 256 is hard coded in syncengine + printf("new uid after modding %s\n", uidret); + *uidretlen = strlen(uidret); + } + } return TRUE; } }