From 9158afb85e4551cd2032e490bade03fbef49994e Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 27 Sep 2001 05:06:41 +0000 Subject: use the old record (if there was one) so as not to overwrite fields we 2001-09-27 JP Rosevear * conduit/address-conduit.c (local_record_from_ecard): use the old record (if there was one) so as not to overwrite fields we don't sync (pre_sync): store the dbi in the context and don't make it object data svn path=/trunk/; revision=13187 --- addressbook/conduit/address-conduit.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'addressbook/conduit/address-conduit.c') diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index 13fb05a3b4..ef78fc88d0 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -355,6 +355,17 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont local->addr = g_new0 (struct Address, 1); + /* Handle the fields we don't sync by making sure we don't overwrite them */ + if (local->local.ID != 0) { + char record[0xffff]; + + if (dlp_ReadRecordById (ctxt->dbi->pilot_socket, + ctxt->dbi->db_handle, + local->local.ID, &record, + NULL, NULL, NULL, NULL) > 0) + unpack_Address (local->addr, record, 0xffff); + } + if (ecard->name) { if (ecard->name->given) local->addr->entry[entryFirstname] = e_pilot_utf8_to_pchar (ecard->name->given); @@ -708,6 +719,7 @@ pre_sync (GnomePilotConduit *conduit, LOG ("pre_sync: Addressbook Conduit v.%s", CONDUIT_VERSION); g_message ("Addressbook Conduit v.%s", CONDUIT_VERSION); + ctxt->dbi = dbi; ctxt->ebook = NULL; if (start_addressbook_server (ctxt) != 0) { @@ -737,8 +749,6 @@ pre_sync (GnomePilotConduit *conduit, /* gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records); */ /* gnome_pilot_conduit_sync_abs_set_num_deleted_local_records(abs_conduit, del_records); */ - gtk_object_set_data (GTK_OBJECT (conduit), "dbinfo", dbi); - buf = (unsigned char*)g_malloc (0xffff); len = dlp_ReadAppBlock (dbi->pilot_socket, dbi->db_handle, 0, (unsigned char *)buf, 0xffff); @@ -1115,9 +1125,9 @@ prepare (GnomePilotConduitSyncAbs *conduit, EAddrConduitContext *ctxt) { LOG ("prepare: encoding local %s\n", print_local (local)); - + *remote = local_record_to_pilot_record (local, ctxt); - + return 0; } -- cgit v1.2.3