[evolution-couchdb] Parse phone numbers
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-couchdb] Parse phone numbers
- Date: Fri, 19 Jun 2009 12:26:32 -0400 (EDT)
commit 67570ead7c3c879fba2e65de3f8f8901d383d04d
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Fri Jun 19 18:19:39 2009 +0200
Parse phone numbers
addressbook/e-book-backend-couchdb.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index c6e1846..8f0d40e 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -54,7 +54,6 @@ vcard_from_couch_document (CouchDBDocument *document)
email_str = couchdb_document_contact_email_get_address (email_address);
description_str = couchdb_document_contact_email_get_description (email_address);
- g_print ("email = %s, description = %s\n", email_str, description_str);
attr = e_vcard_attribute_new ("", e_contact_vcard_attribute (E_CONTACT_EMAIL));
if (description_str) {
@@ -83,6 +82,27 @@ vcard_from_couch_document (CouchDBDocument *document)
g_list_free (attr_list);
}
+ /* parse phone numbers */
+ list = couchdb_document_contact_get_phone_numbers (document);
+ while (list != NULL) {
+ const char *phone_str, *description_str;
+ CouchDBStructField *phone_number = (CouchDBStructField *) list->data;
+
+ phone_str = couchdb_document_contact_phone_get_number (phone_number);
+ description_str = couchdb_document_contact_phone_get_description (phone_number);
+
+ if (!g_ascii_strcasecmp (description_str, "home"))
+ e_contact_set (contact, E_CONTACT_PHONE_HOME, (const gpointer) phone_str);
+ else if (!g_ascii_strcasecmp (description_str, "work"))
+ e_contact_set (contact, E_CONTACT_PHONE_BUSINESS, (const gpointer) phone_str);
+ else
+ e_contact_set (contact, E_CONTACT_PHONE_OTHER, (const gpointer) phone_str);
+
+ /* remove address from list */
+ list = g_slist_remove (list, phone_number);
+ couchdb_struct_field_unref (phone_number);
+ }
+
/* birth date */
str = (char *) couchdb_document_contact_get_birth_date (document);
if (str) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]