[evolution-patches] Allow searching of IM fields in eds.
- From: Nat Friedman <nat novell com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] Allow searching of IM fields in eds.
- Date: Wed, 21 Jan 2004 00:48:24 -0500
This patch implements the function needed in e-book-backend-sexp.c to
allow searching of IM fields in the addressbook.
I've tested this and it appears to work.
See also:
http://bugzilla.ximian.com/show_bug.cgi?id=53165
Nat
? im-search.patch
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.49
diff -u -r1.49 ChangeLog
--- ChangeLog 20 Jan 2004 18:25:01 -0000 1.49
+++ ChangeLog 21 Jan 2004 05:39:04 -0000
@@ -1,3 +1,17 @@
+2004-01-21 Nat Friedman <nat novell com>
+
+ * libedata-book/e-book-backend-sexp.c (compare_im): New function
+ to allow searching of IM fields.
+ * libedata-book/e-book-backend-sexp.c (compare_im_aim): Likewise.
+ * libedata-book/e-book-backend-sexp.c (compare_im_msn): Likewise.
+ * libedata-book/e-book-backend-sexp.c (compare_im_icq): Likewise.
+ * libedata-book/e-book-backend-sexp.c (compare_im_yahoo):
+ Likewise.
+ * libedata-book/e-book-backend-sexp.c (compare_im_jabber):
+ Likewise.
+ * libedata-book/e-book-backend-sexp.c (prop_info_table): Added
+ entries for IM field searching.
+
2004-01-20 Hans Petter Jansson <hpj ximian com>
* libedata-book/e-data-book-view.c (e_data_book_view_new): Pass a
Index: libedata-book/e-book-backend-sexp.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libedata-book/e-book-backend-sexp.c,v
retrieving revision 1.2
diff -u -r1.2 e-book-backend-sexp.c
--- libedata-book/e-book-backend-sexp.c 5 Nov 2003 15:44:58 -0000 1.2
+++ libedata-book/e-book-backend-sexp.c 21 Jan 2004 05:39:04 -0000
@@ -37,6 +37,65 @@
};
static gboolean
+compare_im (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*),
+ EContactField im_field)
+{
+ GList *aims, *l;
+ gboolean found_it = FALSE;
+
+ aims = e_contact_get (contact, im_field);
+
+ for (l = aims; l != NULL; l = l->next) {
+ char *im = (char *) l->data;
+
+ g_warning ("Comparing %s and %s", str, im);
+
+ if (im && compare (im, str))
+ found_it = TRUE;
+
+ g_free (im);
+ }
+
+ return found_it;
+}
+
+static gboolean
+compare_im_aim (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ return compare_im (contact, str, compare, E_CONTACT_IM_AIM);
+}
+
+static gboolean
+compare_im_msn (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ return compare_im (contact, str, compare, E_CONTACT_IM_MSN);
+}
+
+static gboolean
+compare_im_icq (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ return compare_im (contact, str, compare, E_CONTACT_IM_ICQ);
+}
+
+static gboolean
+compare_im_yahoo (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ return compare_im (contact, str, compare, E_CONTACT_IM_YAHOO);
+}
+
+static gboolean
+compare_im_jabber (EContact *contact, const char *str,
+ char *(*compare)(const char*, const char*))
+{
+ return compare_im (contact, str, compare, E_CONTACT_IM_JABBER);
+}
+
+static gboolean
compare_email (EContact *contact, const char *str,
char *(*compare)(const char*, const char*))
{
@@ -151,10 +210,15 @@
NORMAL_PROP ( E_CONTACT_SPOUSE, "spouse" ),
NORMAL_PROP ( E_CONTACT_NOTE, "note"),
NORMAL_PROP ( E_CONTACT_UID, "id"),
- LIST_PROP ( "email", compare_email ),
- LIST_PROP ( "phone", compare_phone ),
- LIST_PROP ( "address", compare_address ),
- LIST_PROP ( "category", compare_category ),
+ LIST_PROP ( "im_aim", compare_im_aim ),
+ LIST_PROP ( "im_msn", compare_im_msn ),
+ LIST_PROP ( "im_icq", compare_im_icq ),
+ LIST_PROP ( "im_jabber", compare_im_jabber ),
+ LIST_PROP ( "im_yahoo", compare_im_yahoo ),
+ LIST_PROP ( "email", compare_email ),
+ LIST_PROP ( "phone", compare_phone ),
+ LIST_PROP ( "address", compare_address ),
+ LIST_PROP ( "category", compare_category ),
};
static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]