aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJP Rosevear <jpr@helixcode.com>2000-12-05 23:26:57 +0800
committerJP Rosevear <jpr@src.gnome.org>2000-12-05 23:26:57 +0800
commitcc8915f5dda99c518055118a83d4000b5a9ed608 (patch)
treeaa5bd1b1761ad8dded6798c08f94605b539a3a10 /addressbook
parente57a50f5329105e8b5e6bf4497c2e09079012a0d (diff)
downloadgsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar.gz
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar.bz2
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar.lz
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar.xz
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.tar.zst
gsoc2013-evolution-cc8915f5dda99c518055118a83d4000b5a9ed608.zip
Create an empty vcard with the appropriate id for deleted cards
2000-12-05 JP Rosevear <jpr@helixcode.com> * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key): Create an empty vcard with the appropriate id for deleted cards * conduit/address-conduit.c (ecard_from_remote_record): Ensure the address fields are added sensibly svn path=/trunk/; revision=6793
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog8
-rw-r--r--addressbook/backend/pas/pas-backend-file.c9
-rw-r--r--addressbook/conduit/address-conduit.c54
3 files changed, 33 insertions, 38 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index bae159ff5c..2af22f8997 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,11 @@
+2000-12-05 JP Rosevear <jpr@helixcode.com>
+
+ * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key):
+ Create an empty vcard with the appropriate id for deleted cards
+
+ * conduit/address-conduit.c (ecard_from_remote_record): Ensure the
+ address fields are added sensibly
+
2000-12-05 Ettore Perazzoli <ettore@helixcode.com>
* gui/component/e-ldap-storage.c (setup_ldap_storage): Updated the
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 2ff9d1164e..31004e596e 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -548,10 +548,13 @@ pas_backend_file_changes_foreach_key (const char *key, gpointer user_data)
db_error = db->get (db, &id_dbt, &vcard_dbt, 0);
if (db_error == 1) {
+ ECard *ecard;
char *id = id_dbt.data;
- char *vcard_string = vcard_dbt.data;
-
- ctx->del_cards = g_list_append (ctx->del_cards, strdup(vcard_string));
+
+ ecard = e_card_new ("");
+ e_card_set_id (ecard, id);
+
+ ctx->del_cards = g_list_append (ctx->del_cards, e_card_get_vcard (ecard));
ctx->del_ids = g_list_append (ctx->del_ids, strdup(id));
}
}
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index 45dce1f1ed..8237c7da4c 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -39,6 +39,7 @@
#include <pi-dlp.h>
#include <pi-version.h>
#include <ebook/e-book.h>
+#include <ebook/e-card-types.h>
#include <ebook/e-card-cursor.h>
#include <ebook/e-card.h>
#include <ebook/e-card-simple.h>
@@ -378,12 +379,10 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
struct Address address;
ECard *ecard;
ECardSimple *simple;
- int i;
+ ECardDeliveryAddress delivery;
char *string;
char *stringparts[4];
- char *commaparts[3];
- char *spaceparts[3];
- char *commastring, *spacestring;
+ int i;
g_return_val_if_fail(remote!=NULL,NULL);
memset (&address, 0, sizeof (struct Address));
@@ -411,43 +410,28 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_FULL_NAME, string);
g_free(string);
- i = 0;
- if (check (entryAddress))
- spaceparts[i++] = get (entryAddress);
- if (check (entryZip))
- spaceparts[i++] = get (entryZip);
- spaceparts[i] = 0;
- spacestring = g_strjoinv(" ", spaceparts);
-
- i = 0;
- if (check (entryCity))
- commaparts[i++] = get (entryCity);
- if (spacestring && *spacestring)
- commaparts[i++] = spacestring;
- commaparts[i] = 0;
- commastring = g_strjoinv(", ", commaparts);
-
- i = 0;
- if (check (entryAddress))
- stringparts[i++] = get (entryAddress);
- if (commastring && *commastring)
- stringparts[i++] = commastring;
- if (check (entryCountry))
- stringparts[i++] = get (entryCountry);
- stringparts[i] = NULL;
- string = g_strjoinv("\n", stringparts);
- e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ADDRESS_HOME, string);
-
- g_free(spacestring);
- g_free(commastring);
- g_free(string);
-
if (check (entryTitle))
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_TITLE, get (entryTitle));
if (check (entryCompany))
e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ORG, get (entryCompany));
+ memset (&delivery, 0, sizeof (ECardDeliveryAddress));
+ delivery.flags = E_CARD_ADDR_HOME;
+ if (check (entryAddress))
+ delivery.street = get (entryAddress);
+ if (check (entryCity))
+ delivery.city = get (entryCity);
+ if (check (entryState))
+ delivery.region = get (entryState);
+ if (check (entryCountry))
+ delivery.country = get (entryCountry);
+ if (check (entryZip))
+ delivery.code = get (entryZip);
+ string = e_card_delivery_address_to_string (&delivery);
+ e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_ADDRESS_HOME, string);
+ g_free (string);
+
for (i = entryPhone1; i <= entryPhone5; i++) {
char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]];