aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-book-util.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-20 10:23:41 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-20 10:23:41 +0800
commit9ae341104ad563c81b2a8d14db9ae3af74a2b803 (patch)
tree038aae4dbec8e89d73d7149ed111ff11aaa7df51 /addressbook/backend/ebook/e-book-util.c
parent808bbced26ba3d2960c001725468849bba703f05 (diff)
downloadgsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar.gz
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar.bz2
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar.lz
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar.xz
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.tar.zst
gsoc2013-evolution-9ae341104ad563c81b2a8d14db9ae3af74a2b803.zip
Use the default e-mail address if we have nothing else to go on.
2001-09-19 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-destination.c (name_and_email_simple_query_cb): Use the default e-mail address if we have nothing else to go on. Previously we just failed, which basically meant that name-only searches would never work properly. (nickname_simple_query_cb): The logic was a bit tangled here; if our query status isn't SUCCESS, always give up but don't leak the destination. And if our nickname query fails and we try the name-and-email query, use the textrep for a name-only search. The only reason we are doing a nickname query in the first place is if we have an obviously invalid e-mail. (launch_cardify_query): Use e_destination_is_valid to determine if we should try a nickname query first. These changes basically fix bug 7728, and generally make the auto-cardification of addresses a lot more clever and robust. * backend/ebook/e-book-util.c (name_and_email_cb): Use e_card_compare_name_to_string instead of e_card_name_match_string. (e_book_name_and_email_query): The arguments to g_strsplit were in the wrong order. Doh! * backend/ebook/e-card-compare.c (e_card_compare_name_to_string): Added. Replaces e_card_name_match_string, and actually works. * backend/ebook/e-card.c: Removed e_card_name_match_string function, which didn't work particularly well. svn path=/trunk/; revision=13003
Diffstat (limited to 'addressbook/backend/ebook/e-book-util.c')
-rw-r--r--addressbook/backend/ebook/e-book-util.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index 7811629571..1468274230 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -26,11 +26,13 @@
*/
#include <config.h>
+#include "e-book-util.h"
+
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
-#include "e-book-util.h"
+#include "e-card-compare.h"
gboolean
e_book_load_local_address_book (EBook *book, EBookCallback open_response, gpointer closure)
@@ -351,9 +353,10 @@ name_and_email_cb (EBook *book, EBookSimpleQueryStatus status, const GList *card
while (cards) {
ECard *card = E_CARD (cards->data);
- if ((info->name == NULL || e_card_name_match_string (card->name, info->name))
- && (info->email == NULL || e_card_email_match_string (card, info->email)))
+ if ((info->name == NULL || e_card_compare_name_to_string (card, info->name) >= E_CARD_MATCH_VAGUE)
+ && (info->email == NULL || e_card_email_match_string (card, info->email))) {
filtered_cards = g_list_append (filtered_cards, card);
+ }
cards = g_list_next (cards);
}
@@ -392,7 +395,7 @@ e_book_name_and_email_query (EBook *book,
* in the usernames of everyone out there, it shouldn't be that bad. (Famous last words.)
*/
if (email) {
- const gchar *t=email;
+ const gchar *t = email;
while (*t && *t != '@')
++t;
if (*t == '@') {
@@ -414,7 +417,7 @@ e_book_name_and_email_query (EBook *book,
gint i, count=0;
g_strstrip (name_cpy);
- namev = g_strsplit (" ", name_cpy, 0);
+ namev = g_strsplit (name_cpy, " ", 0);
for (i=0; namev[i]; ++i) {
if (*namev[i]) {
char *str = namev[i];