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/ChangeLog | 8 ++++++++ addressbook/conduit/address-conduit.c | 18 ++++++++++++++---- addressbook/conduit/address-conduit.h | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 853d90d1c9..c353f20095 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +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 + 2001-09-26 Chris Toshok * backend/pas/pas-book-factory.c (pas_book_factory_destroy): use 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; } diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h index ea5fc12378..0b9cc5e551 100644 --- a/addressbook/conduit/address-conduit.h +++ b/addressbook/conduit/address-conduit.h @@ -54,7 +54,8 @@ struct _EAddrLocalRecord { typedef struct _EAddrConduitContext EAddrConduitContext; struct _EAddrConduitContext { EAddrConduitCfg *cfg; - + GnomePilotDBInfo *dbi; + struct AddressAppInfo ai; EBook *ebook; -- cgit v1.2.3