summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Dumez <christophe.dumez@intel.com>2011-05-27 15:27:30 +0200
committerPatrick Ohly <patrick.ohly@intel.com>2011-06-07 10:53:08 +0200
commit5fd8caaa1b3b279ffac41e837dae0a1bcc2489cc (patch)
treed97a9575a8579f90ca4a555648f62dce5dcc49d8
parent078224089b3afa09c6344ce6e5327756dc2b70b8 (diff)
downloadevolution-data-server-5fd8caaa1b3b279ffac41e837dae0a1bcc2489cc.tar.gz
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. (cherry picked from commit 16ebd8f3e9269f7b788fc093f0c7fd952732ac52)
-rw-r--r--addressbook/libedata-book/e-book-backend-sexp.c25
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 c9c6bd573..f83e4c7bd 100644
--- a/addressbook/libedata-book/e-book-backend-sexp.c
+++ b/addressbook/libedata-book/e-book-backend-sexp.c
@@ -420,16 +420,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;
+ }
+ }
}
}
}