aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-destination.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-27 03:40:02 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-27 03:40:02 +0800
commit31f1562d1435fd8b99f9b7f5b19bc93b3210bab4 (patch)
tree56f9c3f410cc7b24637c57b777553c19fa0b951e /addressbook/backend/ebook/e-destination.c
parent56b24983e2413d5863442af43f10150808a8a56f (diff)
downloadgsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar.gz
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar.bz2
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar.lz
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar.xz
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.tar.zst
gsoc2013-evolution-31f1562d1435fd8b99f9b7f5b19bc93b3210bab4.zip
Properly handle names when the individual elements (given, addition,
2001-09-26 Jon Trowbridge <trow@ximian.com> * backend/ebook/e-card-compare.c (e_card_compare_name_to_string): Properly handle names when the individual elements (given, addition, family) contain whitespace. (Bug #10502) * backend/ebook/e-destination.c (e_destination_set_name): Reset textrep when we change the name. (e_destination_set_email): Reset textrep when we change the email. (e_destination_get_textrep): Make sure that the textrep version of the address is properly quoted if it contains unsafe characters. (All related to bug #10796) * gui/component/select-names/e-select-names-completion.c (match_nickname): Fix nickname matching. (bug #9698) (make_match): Use e_completion_match_new when building our match, rather than ad hoc manipulation of the struct. svn path=/trunk/; revision=13158
Diffstat (limited to 'addressbook/backend/ebook/e-destination.c')
-rw-r--r--addressbook/backend/ebook/e-destination.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index c5287e5e6d..970057f1fe 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -473,6 +473,8 @@ e_destination_set_name (EDestination *dest, const gchar *name)
if (changed) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
+ g_free (dest->priv->textrep);
+ dest->priv->textrep = NULL;
e_destination_changed (dest);
}
}
@@ -501,6 +503,8 @@ e_destination_set_email (EDestination *dest, const gchar *email)
if (changed) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
+ g_free (dest->priv->textrep);
+ dest->priv->textrep = NULL;
e_destination_changed (dest);
}
}
@@ -812,17 +816,18 @@ e_destination_get_textrep (const EDestination *dest)
if (e_destination_from_card (dest) && name != NULL)
return name;
- if (name && email) {
- gchar *rep = g_strdup_printf ("%s <%s>", name, email);
- if (dest->priv->textrep && !strcmp (rep, dest->priv->textrep)) {
- g_free (rep);
- } else {
- g_free (dest->priv->textrep);
- dest->priv->textrep = rep;
- }
- return dest->priv->textrep;
+ /* Make sure that our address gets quoted properly */
+ if (name && email && dest->priv->textrep == NULL) {
+ CamelInternetAddress *addr = camel_internet_address_new ();
+ camel_internet_address_add (addr, name, email);
+ g_free (dest->priv->textrep);
+ dest->priv->textrep = camel_address_encode (CAMEL_ADDRESS (addr));
+ camel_object_unref (CAMEL_OBJECT (addr));
}
+ if (dest->priv->textrep != NULL)
+ return dest->priv->textrep;
+
if (email)
return email;
@@ -908,7 +913,7 @@ static void
name_and_email_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
{
EDestination *dest = E_DESTINATION (closure);
-
+
if (status == E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS && g_list_length ((GList *) cards) == 1) {
ECard *card = E_CARD (cards->data);
const gchar *email = e_destination_get_email (dest);