From d9aefd47c40fb87a44acf7625b1599f72e066bce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Droz?= Date: Wed, 19 Dec 2012 02:53:05 +0100 Subject: [PATCH] ldif: export all available emails for an entry All available emails are now part of the LDIF output in the form of multiple "email:" attributes. --- filter.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/filter.c b/filter.c index 31b6f2d..c8b3d9e 100644 --- a/filter.c +++ b/filter.c @@ -998,6 +998,7 @@ static int ldif_export_database(FILE *out, struct db_enumerator e) { char email[MAX_EMAILSTR_LEN]; + abook_list *emails, *em; fprintf(out, "version: 1\n"); @@ -1018,10 +1019,15 @@ ldif_export_database(FILE *out, struct db_enumerator e) for(j = 0; j < ITEM_FIELDS; j++) { if(j == EMAIL) { - if(*email) // don't dump an empty email field - ldif_fput_type_and_value(out, - ldif_field_names[j], - email); + if(*email) { + tmp = db_email_get(e.item); + emails = csv_to_abook_list(tmp); + free(tmp); + for(em = emails; em; em = em->next) + ldif_fput_type_and_value(out, + ldif_field_names[EMAIL], + em->data); + } } else if(db_fget(e.item,j)) { ldif_fput_type_and_value(out, -- 2.39.5