aboutsummaryrefslogtreecommitdiffstats
path: root/mail
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
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')
-rw-r--r--mail/ChangeLog9
-rw-r--r--mail/mail-callbacks.c2
-rw-r--r--mail/mail-display.c5
-rw-r--r--mail/mail-format.c32
4 files changed, 32 insertions, 16 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index df2e021409..6f39f5d053 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2001-09-26 Dan Winship <danw@ximian.com>
* mail-folder-cache.c: Add a big comment explaining unread message
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 5ad09bf98f..ee68f9f5c5 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -607,7 +607,7 @@ create_msg_composer (const char *url)
account = mail_config_get_default_account ();
send_html = mail_config_get_send_html ();
-
+
composer = url ? e_msg_composer_new_from_url (url) : e_msg_composer_new ();
if (composer) {
diff --git a/mail/mail-display.c b/mail/mail-display.c
index f8e486fa8d..022654323a 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1734,13 +1734,16 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (url && !g_strncasecmp (url, "mailto:", 7)) {
PopupInfo *pop;
+ gchar *url_decoded = g_strdup (url);
+ camel_url_decode (url_decoded);
popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
CORBA_OBJECT_NIL);
bonobo_widget_set_property (BONOBO_WIDGET (popup_thing),
- "email", url+7,
+ "email", url_decoded+7,
NULL);
+ g_free (url_decoded);
pop = make_popup_window (popup_thing);
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++;
}