From 781b9204d274e1fa64c256e71147392e83cd2f08 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 26 Sep 2001 17:31:33 +0000 Subject: set the last_use and use_score fields of the card to known values so the 2001-09-26 JP Rosevear * backend/pas/pas-backend-file.c (pas_backend_file_changes): set the last_use and use_score fields of the card to known values so the card doesn't register as changed when only they have changed 2001-09-26 Peter Williams * conduit/address-conduit.c (ecard_from_remote_record): Fix this function to set email addresses properly, and handle multiple occurrences of email addresses, home phone numbers, and business phone numbers. svn path=/trunk/; revision=13153 --- addressbook/conduit/address-conduit.c | 49 +++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) (limited to 'addressbook/conduit/address-conduit.c') diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index 3c2928cca2..13fb05a3b4 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -453,6 +453,8 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, char *txt; char *stringparts[3]; int i; + ECardSimpleEmailId last_email; + ECardSimpleField last_business, last_home; g_return_val_if_fail(remote!=NULL,NULL); memset (&address, 0, sizeof (struct Address)); @@ -505,19 +507,50 @@ ecard_from_remote_record(EAddrConduitContext *ctxt, free (delivery.country); free (delivery.code); g_free (label.data); - + + last_email = E_CARD_SIMPLE_EMAIL_ID_EMAIL; + last_business = E_CARD_SIMPLE_FIELD_PHONE_BUSINESS; + last_home = E_CARD_SIMPLE_FIELD_PHONE_HOME; + /* Phone numbers */ for (i = entryPhone1; i <= entryPhone5; i++) { char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]]; char *phonenum = get_entry_text (address, i); - if (!strcmp (phonelabel, "E-mail")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, phonenum); - else if (!strcmp (phonelabel, "Home")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_HOME, phonenum); - else if (!strcmp (phonelabel, "Work")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, phonenum); - else if (!strcmp (phonelabel, "Fax")) + if (!strcmp (phonelabel, "E-mail")) { + e_card_simple_set_email(simple, last_email, phonenum); + + switch (last_email) { + case E_CARD_SIMPLE_EMAIL_ID_EMAIL: + last_email = E_CARD_SIMPLE_EMAIL_ID_EMAIL_2; + break; + case E_CARD_SIMPLE_EMAIL_ID_EMAIL_2: + last_email = E_CARD_SIMPLE_EMAIL_ID_EMAIL_3; + break; + default: + WARN ("ran out of email fields in ecard_from_remote_record!"); + } + } else if (!strcmp (phonelabel, "Home")) { + e_card_simple_set(simple, last_home, phonenum); + + switch (last_home) { + case E_CARD_SIMPLE_FIELD_PHONE_HOME: + last_home = E_CARD_SIMPLE_FIELD_PHONE_HOME_2; + break; + default: + WARN ("ran out of home phone fields in ecard_from_remote_record!"); + } + } else if (!strcmp (phonelabel, "Work")) { + e_card_simple_set(simple, last_business, phonenum); + + switch (last_business) { + case E_CARD_SIMPLE_FIELD_PHONE_BUSINESS: + last_business = E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2; + break; + default: + WARN ("ran out of home phone fields in ecard_from_remote_record!"); + } + } else if (!strcmp (phonelabel, "Fax")) e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, phonenum); else if (!strcmp (phonelabel, "Other")) e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER, phonenum); -- cgit v1.2.3