aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/conduit/address-conduit.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-27 13:06:41 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-27 13:06:41 +0800
commit9158afb85e4551cd2032e490bade03fbef49994e (patch)
tree7eb6673aabfce5d396c49e9b4c915c07e5f62713 /addressbook/conduit/address-conduit.c
parentb235a79effc13b17b0bffc78189b831493bd37d6 (diff)
downloadgsoc2013-evolution-9158afb85e4551cd2032e490bade03fbef49994e.tar.gz
gsoc2013-evolution-9158afb85e4551cd2032e490bade03fbef49994e.tar.zst
gsoc2013-evolution-9158afb85e4551cd2032e490bade03fbef49994e.zip
use the old record (if there was one) so as not to overwrite fields we
2001-09-27 JP Rosevear <jpr@ximian.com> * 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
Diffstat (limited to 'addressbook/conduit/address-conduit.c')
-rw-r--r--addressbook/conduit/address-conduit.c18
1 files changed, 14 insertions, 4 deletions
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;
}