[evolution-couchdb] Add email addresses to created documents
- From: Rodrigo Moya <rodrigo src gnome org>
- To: svn-commits-list gnome org
- Subject: [evolution-couchdb] Add email addresses to created documents
- Date: Wed, 24 Jun 2009 15:26:11 +0000 (UTC)
commit d86ab1c06a37ed97d0e0d6495a6dde8b9c84507e
Author: Rodrigo Moya <rodrigo gnome-db org>
Date: Wed Jun 24 13:29:46 2009 +0200
Add email addresses to created documents
addressbook/e-book-backend-couchdb.c | 28 ++++++++++++++++++++++++++--
1 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index f838716..390ea59 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -229,6 +229,8 @@ e_book_backend_couchdb_create_contact (EBookBackend *backend,
CouchDBDocument *document;
EContactDate *dt;
GError *error = NULL;
+ GSList *list;
+ gint i;
EBookBackendCouchDB *couchdb_backend = E_BOOK_BACKEND_COUCHDB (backend);
static guint uid_count = 0;
@@ -243,7 +245,30 @@ e_book_backend_couchdb_create_contact (EBookBackend *backend,
couchdb_document_contact_set_first_name (document, (const char *) e_contact_get (contact, E_CONTACT_GIVEN_NAME));
couchdb_document_contact_set_last_name (document, (const char *) e_contact_get (contact, E_CONTACT_FAMILY_NAME));
- /* FIXME: email_addresses */
+
+ /* email addresses */
+ list = NULL;
+ for (i = E_CONTACT_FIRST_EMAIL_ID; i <= E_CONTACT_LAST_EMAIL_ID; i++) {
+ gchar *email;
+
+ email = e_contact_get (contact, i);
+ if (email) {
+ CouchDBStructField *sf;
+
+ sf = couchdb_document_contact_email_new (email, /* FIXME */ NULL);
+ list = g_slist_append (list, sf);
+
+ g_free (email);
+ }
+ }
+
+ if (list) {
+ couchdb_document_contact_set_email_addresses (document, list);
+
+ g_slist_foreach (list, (GFunc) couchdb_struct_field_unref, NULL);
+ g_slist_free (list);
+ }
+
/* FIXME: phone numbers */
/* FIXME: addresses */
@@ -453,7 +478,6 @@ e_book_backend_couchdb_get_supported_fields (EBookBackend *backend,
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_GIVEN_NAME)));
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FAMILY_NAME)));
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_FULL_NAME)));
- fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL)));
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_1)));
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_2)));
fields = g_list_append (fields, g_strdup (e_contact_field_name (E_CONTACT_EMAIL_3)));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]