provided implementation, search in all fileds of all types of addresses
authorSivaiah Nallagatla <snallagatla@novell.com>
Mon, 19 Jul 2004 05:33:07 +0000 (05:33 +0000)
committerSivaiah Nallagatla <siva@src.gnome.org>
Mon, 19 Jul 2004 05:33:07 +0000 (05:33 +0000)
2004-07-19  Sivaiah Nallagatla <snallagatla@novell.com>

        * 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

addressbook/ChangeLog
addressbook/libedata-book/e-book-backend-sexp.c

index a3139c2..77b885b 100644 (file)
@@ -1,3 +1,10 @@
+2004-07-19  Sivaiah Nallagatla <snallagatla@novell.com> 
+       
+       * 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 d6304ce..12b3315 100644 (file)
@@ -152,8 +152,30 @@ static gboolean
 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));
+                       
+                       e_contact_address_free (address);
+               
+                       if (rv)
+                               break;
+               }
+       }
+
+       return rv;
+       
 }
 
 static gboolean