[evolution-patches] Address book: Fix for #268271



Hi,

Attached a patch to form the attribute FN from N, if vcard has only name
attribute, and also handle BASE64 encoding.
These are valid according to vcard 2.1 specification.

Please review,
Sushma.

Index: addressbook/libebook/e-vcard.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-vcard.c,v
retrieving revision 1.19
diff -u -p -r1.19 e-vcard.c
--- addressbook/libebook/e-vcard.c	21 Feb 2005 23:37:04 -0000	1.19
+++ addressbook/libebook/e-vcard.c	27 Apr 2005 06:27:16 -0000
@@ -1168,7 +1168,8 @@ e_vcard_attribute_add_param (EVCardAttri
 		}
 
 		if (param->values && param->values->data) {
-			if (!g_ascii_strcasecmp ((char*)param->values->data, "b"))
+			if (!g_ascii_strcasecmp ((char*)param->values->data, "b") ||
+			    !g_ascii_strcasecmp ((char*)param->values->data, "BASE64"))
 				attr->encoding = EVC_ENCODING_BASE64;
 			else if (!g_ascii_strcasecmp ((char*)param->values->data, EVC_QUOTEDPRINTABLE))
 				attr->encoding = EVC_ENCODING_QP;
Index: addressbook/libebook/e-contact.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libebook/e-contact.c,v
retrieving revision 1.42
diff -u -p -r1.42 e-contact.c
--- addressbook/libebook/e-contact.c	6 Feb 2005 12:28:41 -0000	1.42
+++ addressbook/libebook/e-contact.c	2 May 2005 08:42:03 -0000
@@ -463,6 +463,9 @@ static void*
 n_getter (EContact *contact, EVCardAttribute *attr)
 {
 	EContactName *name = g_new0 (EContactName, 1);
+	EVCardAttribute *new_attr;
+	char *name_str;
+
 	if (attr) {
 		GList *p = e_vcard_attribute_get_values (attr);
 
@@ -471,6 +474,15 @@ n_getter (EContact *contact, EVCardAttri
 		name->additional = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
 		name->prefixes   = g_strdup (p && p->data ? p->data : ""); if (p) p = p->next;
 		name->suffixes   = g_strdup (p && p->data ? p->data : "");
+	}
+
+	new_attr = e_contact_get_first_attr (contact, EVC_FN);
+	if (!new_attr) {
+		new_attr = e_vcard_attribute_new (NULL, EVC_FN);
+		e_vcard_add_attribute (E_VCARD (contact), new_attr);
+		name_str = e_contact_name_to_string (name);
+		e_vcard_attribute_add_value (new_attr, name_str);
+		g_free (name_str);
 	}
 
 	return name;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]