aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-09-27 03:44:47 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-09-27 03:44:47 +0800
commit1bb2bd5d721338af2e344b764975c87b2a63540a (patch)
tree9786220dc7ebba6ab5fb19b3526e20ac2cbb7d98 /mail/mail-format.c
parent010204b7bf75592bd178c735206331f4f6c23af5 (diff)
downloadgsoc2013-evolution-1bb2bd5d721338af2e344b764975c87b2a63540a.tar.gz
gsoc2013-evolution-1bb2bd5d721338af2e344b764975c87b2a63540a.tar.zst
gsoc2013-evolution-1bb2bd5d721338af2e344b764975c87b2a63540a.zip
Decode our URL before extracting the address to pop up contact info.
2001-09-26 Jon Trowbridge <trow@ximian.com> * mail-display.c (html_button_press_event): Decode our URL before extracting the address to pop up contact info. * mail-format.c (write_address): When writing out a mailto: link, make sure we construct a valid URL w/ correct encoding. Make sure our address is properly quoted, if necessary. svn path=/trunk/; revision=13160
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index f76431bbda..029fb5ab4b 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -797,9 +797,8 @@ elide_quotes (const gchar *str)
if (c) {
while (*c) {
- if (*c == '"')
- *c = '\'';
- ++c;
+ if (*c != '"')
+ ++c;
}
}
return cpy;
@@ -818,20 +817,27 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
i = 0;
while (camel_internet_address_get (addr, i, &name, &email)) {
+ CamelInternetAddress *subaddr;
+ gchar *addr_txt, *addr_url;
gboolean have_name = name && *name;
gboolean have_email = email && *email;
gchar *name_arg = NULL;
gchar *email_arg = NULL;
gchar *name_disp = NULL;
gchar *email_disp = NULL;
+
+ subaddr = camel_internet_address_new ();
+ camel_internet_address_add (subaddr, name, email);
+ addr_txt = camel_address_encode (CAMEL_ADDRESS (subaddr));
+ addr_url = camel_url_encode (addr_txt, TRUE, NULL);
+ camel_object_unref (CAMEL_OBJECT (subaddr));
if (have_name) {
- name_arg = elide_quotes (name);
name_disp = e_text_to_html (name, 0);
}
if (have_email) {
- email_arg = elide_quotes (email);
+ email_arg = elide_quotes (email); /* should never be an issue */
email_disp = e_text_to_html (email, 0);
}
@@ -844,15 +850,11 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
email_disp = g_strdup ("???");
}
- if (have_name) {
- mail_html_write (md->html, md->stream,
- "%s &lt;<a href=\"mailto:%s <%s>\">%s</a>&gt;",
- name_disp, name_arg, email_arg, email_disp);
- } else {
- mail_html_write (md->html, md->stream,
- "<a href=\"mailto:%s\">%s</a>",
- email_arg, email_disp);
- }
+ mail_html_write (md->html, md->stream,
+ "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
+ have_name ? name_disp : "",
+ addr_url,
+ email_disp);
} else {
char *str;
@@ -866,6 +868,8 @@ write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *fi
g_free (email_arg);
g_free (name_disp);
g_free (email_disp);
+ g_free (addr_txt);
+ g_free (addr_url);
i++;
}