diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-04-24 10:51:45 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-04-24 10:51:45 +0800 |
commit | 038d1a932ce339985c91b05c2be35d512f7cef71 (patch) | |
tree | 83a183c4f1b31ec9bbbc1e0421753946f7617236 /mail/mail-format.c | |
parent | e37b58efec96ce102e8c354a979a2b37d28249c7 (diff) | |
download | gsoc2013-evolution-038d1a932ce339985c91b05c2be35d512f7cef71.tar.gz gsoc2013-evolution-038d1a932ce339985c91b05c2be35d512f7cef71.tar.zst gsoc2013-evolution-038d1a932ce339985c91b05c2be35d512f7cef71.zip |
Removed attempts to use Radek's evil <DATA> hacks, which were just causing
2001-04-23 Jon Trowbridge <trow@ximian.com>
* e-html-utils.c (e_text_to_html_full): Removed attempts to use
Radek's evil <DATA> hacks, which were just causing me
(and GtkHTML) grief.
2001-04-23 Jon Trowbridge <trow@ximian.com>
* gui/component/e-address-popup.c: Lots of code has been
simplified here.
(e_address_popup_factory_new_control): Rather than directly pop
our control up in a window (via the e_address_popup_popup
function, which is now gone), just return the widget and let the
caller do the popping. This works better, since it means we don't
have to work around the vagaries of bonobo focus & event handling.
(e_address_popup_set_name): Refresh when both name & email have
been set, rather than checking a stupid counter.
(e_address_popup_set_email): Ditto.
2001-04-23 Jon Trowbridge <trow@ximian.com>
* mail-display.c (html_button_press_event): Check for mailto:
links, and pop up our mail address menu when we find one.
(make_popup_window): The main piece of code (ignoring a zillion
little callbacks) to pop up our windows with reasonable semantics
for having them close automatically.
(mail_text_write): Enable converting addresses to mailto links
in message bodies.
* mail-format.c (write_address): Simplify code, removing Radek's
<DATA> hacks. Write out addresses as mailto: links.
svn path=/trunk/; revision=9534
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r-- | mail/mail-format.c | 86 |
1 files changed, 56 insertions, 30 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c index bd26438db3..3b09e43e8c 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -648,6 +648,22 @@ write_subject (const char *subject, int flags, GtkHTML *html, GtkHTMLStream *str g_free (encoded_subj); } +static gchar * +elide_quotes (const gchar *str) +{ + gchar *cpy = g_strdup (str); + gchar *c = cpy; + + if (c) { + while (*c) { + if (*c == '"') + *c = '\''; + ++c; + } + } + return cpy; +} + static void write_address(MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags) { @@ -662,43 +678,53 @@ write_address(MailDisplay *md, const CamelInternetAddress *addr, const char *fie i = 0; while (camel_internet_address_get (addr, i, &name, &email)) { - - if ((name && *name) || (email && *email)) { + 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; + + if (have_name) { + name_arg = elide_quotes (name); + name_disp = e_text_to_html (name, 0); + } - /* we need these <B> </B> to separate HTMLText objects */ - mail_html_write (md->html, md->stream, i ? ",<B> </B> " : "<td>"); - mail_html_write (md->html, md->stream, " "); + if (have_email) { + email_arg = elide_quotes (email); + email_disp = e_text_to_html (email, 0); + } - name_set = mail_set = FALSE; - if (name && *name) { - mail_html_write (md->html, md->stream, - "<!--+GtkHTML:<DATA class=\"Text\" key=\"name\" value=\"%s\">-->", - name); - name_set = TRUE; - } + mail_html_write (md->html, md->stream, i ? ", " : "<td>"); + + if (have_email || have_name) { - if (email && *email) { - mail_html_write (md->html, md->stream, - "<!--+GtkHTML:<DATA class=\"Text\" key=\"email\" value=\"%s\">-->", - email); - mail_set = TRUE; + if (!have_email) { + email_arg = g_strdup ("???"); + email_disp = g_strdup ("???"); } - - if (name && *name) - mail_html_write (md->html, md->stream, "%s ", name); - if (email && *email) - mail_html_write (md->html, md->stream, "%s%s%s", - name && *name ? "<" : "", - email, - name && *name ? ">" : ""); - if (name_set) + + if (have_name) { mail_html_write (md->html, md->stream, - "<!--+GtkHTML:<DATA class=\"Text\" clear=\"name\">-->"); - if (mail_set) + "%s <<a href=\"mailto:%s <%s>\">%s</a>>", + name_disp, name_arg, email_arg, email_disp); + } else { mail_html_write (md->html, md->stream, - "<!--+GtkHTML:<DATA class=\"Text\" clear=\"email\">-->"); + "<a href=\"mailto:%s\">%s</a>", + email_arg, email_disp); + } + + } else { + + mail_html_write (md->html, md->stream, "<i>Bad Address</i>"); + } - + + g_free (name_arg); + g_free (email_arg); + g_free (name_disp); + g_free (email_disp); + ++i; } mail_html_write (md->html, md->stream, "</td></tr>"); /* Finish up the table row */ |