aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-27 01:31:33 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-27 01:31:33 +0800
commit781b9204d274e1fa64c256e71147392e83cd2f08 (patch)
treee58bbf476e0b4564c6d2f5cbc7f710554d3fa3b9
parentfbc4f8863895af7fd34d34f133e64f60a805c825 (diff)
downloadgsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar.gz
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar.bz2
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar.lz
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar.xz
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.tar.zst
gsoc2013-evolution-781b9204d274e1fa64c256e71147392e83cd2f08.zip
set the last_use and use_score fields of the card to known values so the
2001-09-26 JP Rosevear <jpr@ximian.com> * 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 <peterw@ximian.com> * 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
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/backend/pas/pas-backend-file.c14
-rw-r--r--addressbook/conduit/address-conduit.c49
3 files changed, 65 insertions, 10 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 339a9ce750..3d65097596 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,15 @@
+2001-09-26 JP Rosevear <jpr@ximian.com>
+
+ * 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 <peterw@ximian.com>
+
+ * 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.
+
2001-09-25 Christopher James Lahey <clahey@ximian.com>
* gui/component/addressbook-component.c (user_create_new_item_cb):
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 4d222841b5..990d53e704 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -391,9 +391,19 @@ pas_backend_file_changes (PASBackendFile *bf,
/* don't include the version in the list of cards */
if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1
|| strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) {
+ ECard *card;
char *id = id_dbt.data;
- char *vcard_string = vcard_dbt.data;
-
+ char *vcard_string;
+
+ /* Remove fields the user can't change
+ * and can change without the rest of the
+ * card changing
+ */
+ card = e_card_new (vcard_dbt.data);
+ gtk_object_set (GTK_OBJECT (card), "last_use", NULL, "use_score", 0.0, NULL);
+ vcard_string = e_card_get_vcard_assume_utf8 (card);
+ gtk_object_unref (GTK_OBJECT (card));
+
/* check what type of change has occurred, if any */
switch (e_dbhash_compare (ehash, id, vcard_string)) {
case E_DBHASH_STATUS_SAME:
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);