[evolution-data-server] Bug #650950 - entry_compare() should iterate over attributes with the same name



commit 16ebd8f3e9269f7b788fc093f0c7fd952732ac52
Author: Christophe Dumez <christophe dumez intel com>
Date:   Fri May 27 15:27:30 2011 +0200

    Bug #650950 - entry_compare() should iterate over attributes with the same name
    
    Extend entry_compare() to iterate over attributes that have
    the same name (e.g. X-HOBBY) so that it can match any of
    them, not just the first one in the vCard.

 addressbook/libedata-book/e-book-backend-sexp.c |   25 +++++++++++++---------
 1 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-backend-sexp.c b/addressbook/libedata-book/e-book-backend-sexp.c
index 638735e..dd36226 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.c
+++ b/addressbook/libedata-book/e-book-backend-sexp.c
@@ -368,16 +368,21 @@ entry_compare (SearchContext *ctx, struct _ESExp *f,
 			} else {
 				/* it is not direct EContact known field, so try to find
 				   it in EVCard attributes */
-				EVCardAttribute *attr = e_vcard_get_attribute (E_VCARD (ctx->contact), propname);
-				GList *l, *values = attr ? e_vcard_attribute_get_values (attr) : NULL;
-
-				for (l = values; l && !truth; l = l->next) {
-					const gchar *value = l->data;
-
-					if (value && compare (value, argv[1]->value.string)) {
-						truth = TRUE;
-					} else if ((!value) && compare ("", argv[1]->value.string)) {
-						truth = TRUE;
+				GList *a, *attrs = e_vcard_get_attributes (E_VCARD (ctx->contact));
+				for (a = attrs; a && !truth; a = a->next) {
+					EVCardAttribute *attr = (EVCardAttribute *) a->data;
+                			if (g_ascii_strcasecmp (e_vcard_attribute_get_name (attr), propname) == 0) {
+						GList *l, *values = e_vcard_attribute_get_values (attr);
+
+						for (l = values; l && !truth; l = l->next) {
+							const gchar *value = l->data;
+
+							if (value && compare (value, argv[1]->value.string)) {
+								truth = TRUE;
+							} else if ((!value) && compare ("", argv[1]->value.string)) {
+								truth = TRUE;
+							}
+						}
 					}
 				}
 			}



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