aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/util/eab-book-util.c
diff options
context:
space:
mode:
authorSivaiah Nallagatla <snallagatla@novell.com>2004-11-18 04:57:34 +0800
committerSivaiah Nallagatla <siva@src.gnome.org>2004-11-18 04:57:34 +0800
commitf2b5ff4623c8f9b724e3f13db7055f5df575db8b (patch)
tree9132fa42aa1ecb99a036bd31699cc9b3f4084af3 /addressbook/util/eab-book-util.c
parent544016faf610fe5f339be059eee57af2cfcbfd3d (diff)
downloadgsoc2013-evolution-f2b5ff4623c8f9b724e3f13db7055f5df575db8b.tar.gz
gsoc2013-evolution-f2b5ff4623c8f9b724e3f13db7055f5df575db8b.tar.zst
gsoc2013-evolution-f2b5ff4623c8f9b724e3f13db7055f5df575db8b.zip
When name is NULL query against complete email id instead of user name
2004-11-07 Sivaiah Nallagatla <snallagatla@novell.com> * util/eab-book-util.c (eab_name_and_email_query) : When name is NULL query against complete email id instead of user name part to take care of users@foo.org not matching against users@bar.org . Also include query based on name always Fix for #67656 svn path=/trunk/; revision=27937
Diffstat (limited to 'addressbook/util/eab-book-util.c')
-rw-r--r--addressbook/util/eab-book-util.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/addressbook/util/eab-book-util.c b/addressbook/util/eab-book-util.c
index 1fdcd59ca0..4978fa7b59 100644
--- a/addressbook/util/eab-book-util.c
+++ b/addressbook/util/eab-book-util.c
@@ -100,12 +100,14 @@ eab_name_and_email_query (EBook *book,
* We only query against the username part of the address, to avoid not matching
* fred@foo.com and fred@mail.foo.com. While their may be namespace collisions
* in the usernames of everyone out there, it shouldn't be that bad. (Famous last words.)
+ * But if name is missing we query against complete email id to avoid matching emails like
+ * users@foo.org with users@bar.org
*/
if (escaped_email) {
const gchar *t = escaped_email;
while (*t && *t != '@')
++t;
- if (*t == '@') {
+ if (*t == '@' && escaped_name) {
email_query = g_strdup_printf ("(beginswith \"email\" \"%.*s@\")", t-escaped_email, escaped_email);
} else {
@@ -113,12 +115,9 @@ eab_name_and_email_query (EBook *book,
}
}
- /* Build our name query.
- * We only do name-query stuff if we don't have an e-mail address. Our basic assumption
- * is that the username part of the email is good enough to keep the amount of stuff returned
- * in the query relatively small.
- */
- if (escaped_name && !escaped_email)
+ /* Build our name query.*/
+
+ if (escaped_name)
name_query = g_strdup_printf ("(or (beginswith \"file_as\" \"%s\") (beginswith \"full_name\" \"%s\"))", escaped_name, escaped_name);
/* Assemble our e-mail & name queries */