aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-08-28 15:44:18 +0800
committerChris Toshok <toshok@src.gnome.org>2002-08-28 15:44:18 +0800
commit2839143b0b274ce88a7495a005109ab7d89e676d (patch)
tree423c14505a862be28748dce9bb83b86886509c27
parentf4fbfa9176edc5ec4890d2e934d524bda1669ff4 (diff)
downloadgsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar.gz
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar.bz2
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar.lz
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar.xz
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.tar.zst
gsoc2013-evolution-2839143b0b274ce88a7495a005109ab7d89e676d.zip
[ fixes #20348 ] deprecate "categories" in favor of "category". evolution
2002-08-28 Chris Toshok <toshok@ximian.com> [ fixes #20348 ] * backend/pas/evolutionperson.schema: deprecate "categories" in favor of "category". evolution no longer uses "categories". * backend/pas/pas-backend-ldap.c (category_populate): new function, "category" is the new name, and it's multivalued so we need the complex-prop stuff.. (category_ber): new function, same. (category_compare): new function, same. * gui/component/addressbook.c (addressbook_search_activated): the text is "Category is" so we should use "is" instead of "contains" for the query. svn path=/trunk/; revision=17885
-rw-r--r--addressbook/ChangeLog16
-rw-r--r--addressbook/backend/pas/evolutionperson.schema10
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c82
-rw-r--r--addressbook/gui/component/addressbook.c2
4 files changed, 107 insertions, 3 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 4137340ab6..f9bf8ad0e6 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,19 @@
+2002-08-28 Chris Toshok <toshok@ximian.com>
+
+ [ fixes #20348 ]
+ * backend/pas/evolutionperson.schema: deprecate "categories" in
+ favor of "category". evolution no longer uses "categories".
+
+ * backend/pas/pas-backend-ldap.c (category_populate): new
+ function, "category" is the new name, and it's multivalued so we
+ need the complex-prop stuff..
+ (category_ber): new function, same.
+ (category_compare): new function, same.
+
+ * gui/component/addressbook.c (addressbook_search_activated): the
+ text is "Category is" so we should use "is" instead of "contains"
+ for the query.
+
2002-08-27 Chris Toshok <toshok@ximian.com>
[ Fixes #14835 ]
diff --git a/addressbook/backend/pas/evolutionperson.schema b/addressbook/backend/pas/evolutionperson.schema
index 4b64b3b7e4..29270555ea 100644
--- a/addressbook/backend/pas/evolutionperson.schema
+++ b/addressbook/backend/pas/evolutionperson.schema
@@ -151,6 +151,7 @@ attributetype ( 1.3.6.1.4.1.8506.1.2.22
SUBSTR telephoneNumberSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
+# deprecated - use the multivalued category
attributetype ( 1.3.6.1.4.1.8506.1.2.23
NAME 'categories'
EQUALITY caseIgnoreMatch
@@ -181,6 +182,13 @@ attributetype ( 1.3.6.1.4.1.8506.1.2.27
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
+attributetype ( 1.3.6.1.4.1.8506.1.2.28
+ NAME 'category'
+ EQUALITY caseIgnoreMatch
+ SUBSTR caseIgnoreSubstringsMatch
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{4096} )
+
+
# evolutionPerson
objectclass ( 1.3.6.1.4.1.8506.1.3.1
NAME 'evolutionPerson'
@@ -192,7 +200,7 @@ objectclass ( 1.3.6.1.4.1.8506.1.3.1
otherPhone $ businessRole $ managerName $ assistantName $ assistantPhone $
otherPostalAddress $ mailer $ birthDate $ anniversary $ spouseName $
note $ companyPhone $ callbackPhone $ otherFacsimileTelephoneNumber $
- radio $ telex $ tty $ categories $ calendarURI $ freeBusyURI )
+ radio $ telex $ tty $ categories $ category $ calendarURI $ freeBusyURI )
)
# evolutionPersonList
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 8ba07d0016..e3ffcade7b 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -187,6 +187,10 @@ static void birthday_populate (ECardSimple *card, char **values);
struct berval** birthday_ber (ECardSimple *card);
static gboolean birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2);
+static void category_populate (ECardSimple *card, char **values);
+struct berval** category_ber (ECardSimple *card);
+static gboolean category_compare (ECardSimple *ecard1, ECardSimple *ecard2);
+
struct prop_info {
ECardSimpleField field_id;
char *query_prop;
@@ -265,7 +269,7 @@ struct prop_info {
E_STRING_PROP (E_CARD_SIMPLE_FIELD_MAILER, "mailer", "mailer"),
E_STRING_PROP (E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "fileAs"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_CATEGORIES, "categories", "categories"),
+ E_COMPLEX_PROP (E_CARD_SIMPLE_FIELD_CATEGORIES, "category", "category", category_populate, category_ber, category_compare),
STRING_PROP (E_CARD_SIMPLE_FIELD_CALURI, "caluri", "calCalURI"),
STRING_PROP (E_CARD_SIMPLE_FIELD_FBURL, "fburl", "calFBURL"),
@@ -2206,6 +2210,82 @@ birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2)
return equal;
}
+static void
+category_populate (ECardSimple *card, char **values)
+{
+ int i;
+ ECard *ecard;
+ EList *categories;
+
+ gtk_object_get (GTK_OBJECT (card),
+ "card", &ecard,
+ NULL);
+
+ categories = e_list_new((EListCopyFunc) g_strdup,
+ (EListFreeFunc) g_free,
+ NULL);
+
+ for (i = 0; values[i]; i++)
+ e_list_append (categories, values[i]);
+
+ gtk_object_set (GTK_OBJECT (ecard),
+ "category_list", categories,
+ NULL);
+
+ gtk_object_unref (GTK_OBJECT (categories));
+
+ e_card_simple_sync_card (card);
+}
+
+struct berval**
+category_ber (ECardSimple *card)
+{
+ struct berval** result = NULL;
+ EList *categories;
+ EIterator *iterator;
+ ECard *ecard;
+ int i;
+
+ gtk_object_get (GTK_OBJECT (card),
+ "card", &ecard,
+ NULL);
+
+ gtk_object_get (GTK_OBJECT (ecard),
+ "category_list", &categories,
+ NULL);
+
+ result = g_new0 (struct berval*, e_list_length (categories) + 1);
+
+ for (iterator = e_list_get_iterator(categories), i = 0; e_iterator_is_valid (iterator); e_iterator_next (iterator), i++) {
+ const char *category = e_iterator_get (iterator);
+
+ result[i] = g_new (struct berval, 1);
+ result[i]->bv_val = g_strdup (category);
+ result[i]->bv_len = strlen (category);
+ }
+
+ gtk_object_unref (GTK_OBJECT (iterator));
+
+ return result;
+}
+
+static gboolean
+category_compare (ECardSimple *ecard1, ECardSimple *ecard2)
+{
+ char *categories1, *categories2;
+ gboolean equal;
+
+ categories1 = e_card_simple_get (ecard1, E_CARD_SIMPLE_FIELD_CATEGORIES);
+ categories2 = e_card_simple_get (ecard2, E_CARD_SIMPLE_FIELD_CATEGORIES);
+
+ equal = !strcmp (categories1, categories2);
+
+ g_free (categories1);
+ g_free (categories2);
+
+ return equal;
+}
+
typedef struct {
GList *list;
PASBackendLDAP *bl;
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 4631da23d9..ee761fb755 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -803,7 +803,7 @@ addressbook_search_activated (ESearchBar *esb, AddressbookView *view)
} else {
master_list = get_master_list ();
category_name = e_categories_master_list_nth (master_list, subid);
- search_query = g_strdup_printf ("(contains \"category\" \"%s\")", category_name);
+ search_query = g_strdup_printf ("(is \"category\" \"%s\")", category_name);
}
break;
default: