aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-01-19 09:15:25 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-01-19 09:15:25 +0800
commit4a011b9d49d23d3f26a9d054b5c9a5412a61b254 (patch)
tree5bdc32b44480c23b91d54d32c6c18882abf4c9fa
parentb2daabc151be6b918dcb89ba7d0b64e293e39df1 (diff)
downloadgsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar.gz
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar.bz2
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar.lz
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar.xz
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.tar.zst
gsoc2013-evolution-4a011b9d49d23d3f26a9d054b5c9a5412a61b254.zip
properly decode the mailto url rather than treating it as a simple string.
2004-01-19 Not Zed <NotZed@Ximian.com> * em-folder-view.c (emfv_on_url_cb): properly decode the mailto url rather than treating it as a simple string. * em-format-html.c (efh_format_address): if we have a name part, add it to the mailto part. As per rfc2368. So it isn't lost for clicking/etc. svn path=/trunk/; revision=24298
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/em-folder-view.c16
-rw-r--r--mail/em-format-html.c15
3 files changed, 34 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 214dfd190c..7fcaa927c6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+2004-01-19 Not Zed <NotZed@Ximian.com>
+
+ * em-folder-view.c (emfv_on_url_cb): properly decode the mailto
+ url rather than treating it as a simple string.
+
+ * em-format-html.c (efh_format_address): if we have a name part,
+ add it to the mailto part. As per rfc2368. So it isn't lost for
+ clicking/etc.
+
2004-01-16 JP Rosevear <jpr@ximian.com>
* em-format-html-display.c (efhd_bonobo_object): pass in an
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index fd2801f904..66835a56a8 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -2121,9 +2121,19 @@ emfv_on_url_cb (GObject *emitter, const char *url, EMFolderView *emfv)
char *nice_url = NULL;
if (url) {
- if (strncmp (url, "mailto:", 7) == 0)
- nice_url = g_strdup_printf (_("Click to mail %s"), url + 7);
- else
+ if (strncmp (url, "mailto:", 7) == 0) {
+ CamelInternetAddress *cia = camel_internet_address_new();
+ CamelURL *curl;
+ char *addr;
+
+ curl = camel_url_new(url, NULL);
+ camel_address_decode((CamelAddress *)cia, curl->path);
+ addr = camel_address_format((CamelAddress *)cia);
+ nice_url = g_strdup_printf (_("Click to mail %s"), addr&&addr[0]?addr:(url + 7));
+ g_free(addr);
+ camel_url_free(curl);
+ camel_object_unref(cia);
+ } else
nice_url = g_strdup_printf (_("Click to open %s"), url);
}
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index edd7c25730..a0346b00b0 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -1467,10 +1467,19 @@ efh_format_address (GString *out, struct _camel_header_address *a)
switch (a->type) {
case CAMEL_HEADER_ADDRESS_NAME:
- if (name && *name)
+ if (name && *name) {
+ char *real, *mailaddr;
+
g_string_append_printf (out, "%s &lt;", name);
-
- mailto = camel_url_encode (a->v.addr, "");
+ /* rfc2368 for mailto syntax and url encoding extras */
+ real = camel_header_encode_phrase(a->name);
+ mailaddr = g_strdup_printf("%s <%s>", real, a->v.addr);
+ g_free(real);
+ mailto = camel_url_encode(mailaddr, "?=&()");
+ g_free(mailaddr);
+ } else {
+ mailto = camel_url_encode (a->v.addr, "?=&()");
+ }
addr = camel_text_to_html (a->v.addr, flags, 0);
g_string_append_printf (out, "<a href=\"mailto:%s\">%s</a>", mailto, addr);
g_free (mailto);