[evolution-patches] patch for #58701 (addressbook)



Hi,
The attached patch implements compare_address function in
e-book-backend-sexp.c so that search can happen overs values present in
address files in contact
Thanks,
Siva
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/ChangeLog,v
retrieving revision 1.178
diff -u -r1.178 ChangeLog
--- ChangeLog	16 Jul 2004 08:08:53 -0000	1.178
+++ ChangeLog	16 Jul 2004 14:23:55 -0000
@@ -1,3 +1,10 @@
+2004-07-16  Sivaiah Nallagatla 
+	
+	* libedata-book/e-book-backend-sexp.c (compare_address) : provided
+	implementation, search in all fileds of all types of addresses 
+	till a match occurs
+	Fixes #58701
+  
 2004-07-16  Chris Toshok  <toshok ximian com>
 
 	[ fixes #61052 ]
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.6
diff -u -r1.6 e-book-backend-sexp.c
--- libedata-book/e-book-backend-sexp.c	20 May 2004 00:44:15 -0000	1.6
+++ libedata-book/e-book-backend-sexp.c	16 Jul 2004 14:23:55 -0000
@@ -152,8 +152,29 @@
 compare_address (EContact *contact, const char *str,
 		 char *(*compare)(const char*, const char*))
 {
-	g_warning("address searching not implemented\n");
-	return FALSE;
+	
+	int i;
+	gboolean rv = FALSE;
+
+	for (i = E_CONTACT_FIRST_ADDRESS_ID; i <= E_CONTACT_LAST_ADDRESS_ID; i ++) {
+		EContactAddress *address = e_contact_get (contact, i);
+		if (address) {
+			rv =  (address->po && compare(address->po, str)) ||
+				(address->street && compare(address->street, str)) ||
+				(address->ext && compare(address->ext, str)) ||
+				(address->locality && compare(address->locality, str)) ||
+				(address->region && compare(address->region, str)) || 
+				(address->code && compare(address->code, str)) ||
+				(address->country && compare(address->country, str));
+			
+			if (rv)
+				break;
+		}
+		e_contact_address_free (address);
+	}
+
+	return rv;
+	
 }
 
 static gboolean


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