aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/mail-config.c1
-rw-r--r--mail/mail-display.c39
-rw-r--r--mail/mail-format.c29
-rw-r--r--mail/mail-ops.c1
-rw-r--r--mail/mail-tools.c1
6 files changed, 62 insertions, 23 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9ec8318aca..cf0bf9a72a 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,19 @@
2002-12-16 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-display.c (mail_error_printf): Use camel_text_to_html()
+ instead of e_text_to_html().
+ (mail_text_write): Write the content directly to gtkhtml through
+ an html stream filter.
+
+ * mail-format.c (attachment_header): Use camel_text_to_html()
+ instead of e_text_to_html().
+ (write_text_header): Same.
+ (write_address): Here too.
+ (mail_get_message_rfc822): And here.
+ (mail_get_message_body): And finally here.
+
+2002-12-16 Jeffrey Stedfast <fejj@ximian.com>
+
* mail-format.c (handle_text_plain): Re-implemented to use
streams. Also no need to check for html since
camel-mime-part-utils.c now does this for us and will re-tag the
diff --git a/mail/mail-config.c b/mail/mail-config.c
index b7f5ce8356..1b02e462f1 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -49,7 +49,6 @@
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
-#include <e-util/e-html-utils.h>
#include <e-util/e-url.h>
#include <e-util/e-passwords.h>
#include "mail.h"
diff --git a/mail/mail-display.c b/mail/mail-display.c
index f21568fbe2..c9da2e4ed9 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -59,7 +59,6 @@
#include <libsoup/soup-message.h>
-#include "e-util/e-html-utils.h"
#include "e-util/e-mktemp.h"
#include "addressbook/backend/ebook/e-book-util.h"
@@ -1667,6 +1666,31 @@ void
mail_text_write (MailDisplayStream *stream, MailDisplay *md, CamelMimePart *part,
int idx, gboolean printing, const char *text)
{
+ CamelStreamFilter *filtered_stream;
+ CamelMimeFilter *html_filter;
+ guint32 flags;
+
+ flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
+
+ if (!printing)
+ flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
+
+ if (!printing && mail_config_get_citation_highlight ())
+ flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
+
+ html_filter = camel_mime_filter_tohtml_new (flags, mail_config_get_citation_color ());
+ filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *) stream);
+ camel_stream_filter_add (filtered_stream, html_filter);
+ camel_object_unref (html_filter);
+
+ camel_stream_write ((CamelStream *) stream, "<tt>\n", 5);
+ camel_stream_write ((CamelStream *) filtered_stream, text, strlen (text));
+ camel_stream_flush ((CamelStream *) filtered_stream);
+ camel_stream_write ((CamelStream *) stream, "</tt>\n", 6);
+ camel_object_unref (filtered_stream);
+
+#if 0
+ /* this was the old way of doing it, I don't understand why we need iframes... */
GByteArray *ba;
char *xed, *iframe;
char *btt = "<tt>\n";
@@ -1674,15 +1698,15 @@ mail_text_write (MailDisplayStream *stream, MailDisplay *md, CamelMimePart *part
char *htmltext;
guint32 flags;
- flags = E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_SPACES;
+ flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES;
if (!printing)
- flags |= E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES;
+ flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
if (!printing && mail_config_get_citation_highlight ())
- flags |= E_TEXT_TO_HTML_MARK_CITATION;
+ flags |= CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
- htmltext = e_text_to_html_full (text, flags, mail_config_get_citation_color ());
+ htmltext = camel_text_to_html (text, flags, mail_config_get_citation_color ());
ba = g_byte_array_new ();
g_byte_array_append (ba, (const guint8 *) btt, strlen (btt) + 1);
@@ -1695,11 +1719,13 @@ mail_text_write (MailDisplayStream *stream, MailDisplay *md, CamelMimePart *part
mail_display_add_url (md, "data_urls", xed, ba);
camel_stream_write ((CamelStream *) stream, iframe, strlen (iframe));
g_free (iframe);
+#endif
}
void
mail_error_printf (MailDisplayStream *stream, const char *format, ...)
{
+ /* FIXME: it'd be nice if camel-stream had a vprintf method... */
char *buf, *htmltext;
va_list ap;
@@ -1707,7 +1733,8 @@ mail_error_printf (MailDisplayStream *stream, const char *format, ...)
buf = g_strdup_vprintf (format, ap);
va_end (ap);
- htmltext = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ htmltext = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
g_free (buf);
camel_stream_printf ((CamelStream *) stream, "<em><font color=red>");
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 7c71d293b1..7b7eabd2ee 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -44,7 +44,6 @@
#include <camel/camel-mime-filter-tohtml.h>
#include <e-util/e-trie.h>
-#include <e-util/e-html-utils.h>
#include "mail.h"
#include "mail-tools.h"
@@ -630,14 +629,14 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
/* Write the MIME type */
info = gnome_vfs_mime_get_description (mime_type);
- htmlinfo = e_text_to_html (info ? info : mime_type, 0);
+ htmlinfo = camel_text_to_html (info ? info : mime_type, 0, 0);
camel_stream_printf ((CamelStream *) stream, _("%s attachment"), htmlinfo);
g_free (htmlinfo);
/* Write the name, if we have it. */
info = camel_mime_part_get_filename (part);
if (info) {
- htmlinfo = e_text_to_html (info, 0);
+ htmlinfo = camel_text_to_html (info, 0, 0);
camel_stream_printf ((CamelStream *) stream, " (%s)", htmlinfo);
g_free (htmlinfo);
}
@@ -645,7 +644,7 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
/* Write a description, if we have one. */
info = camel_mime_part_get_description (part);
if (info) {
- htmlinfo = e_text_to_html (info, md->printing ? 0 : E_TEXT_TO_HTML_CONVERT_URLS);
+ htmlinfo = camel_text_to_html (info, md->printing ? 0 : CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
camel_stream_printf ((CamelStream *) stream, ", \"%s\"", htmlinfo);
g_free (htmlinfo);
}
@@ -762,7 +761,7 @@ write_text_header (MailDisplayStream *stream, const char *name, const char *valu
char *encoded;
if (value && *value)
- encoded = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ encoded = camel_text_to_html (value, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
else
encoded = "";
@@ -802,11 +801,11 @@ write_address (MailDisplay *md, MailDisplayStream *stream,
camel_object_unref (subaddr);
if (have_name) {
- name_disp = e_text_to_html (name, 0);
+ name_disp = camel_text_to_html (name, 0, 0);
}
if (have_email) {
- email_disp = e_text_to_html (email, 0);
+ email_disp = camel_text_to_html (email, 0, 0);
}
if (i)
@@ -1873,7 +1872,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_from (message);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
g_string_sprintfa (retval, "%s<b>From:</b> %s<br>",
citation, html);
g_free (html);
@@ -1883,7 +1882,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
g_string_sprintfa (retval, "%s<b>To:</b> %s<br>",
citation, html);
g_free (html);
@@ -1893,7 +1892,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
g_string_sprintfa (retval, "%s<b>Cc:</b> %s<br>",
citation, html);
g_free (html);
@@ -1902,7 +1901,8 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
buf = (char *) camel_mime_message_get_subject (message);
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
+ html = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0);
g_string_sprintfa (retval, "%s<b>Subject:</b> %s<br>",
citation, html);
g_free (html);
@@ -1910,7 +1910,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
date_val = camel_mime_message_get_date (message, &offset);
buf = header_format_date (date_val, offset);
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = camel_text_to_html (buf, CAMEL_MIME_FILTER_TOHTML_CONVERT_NL, 0);
g_string_sprintfa (retval, "%s<b>Date:</b> %s<br>", citation, html);
g_free (html);
g_free (buf);
@@ -1982,8 +1982,9 @@ mail_get_message_body (CamelDataWrapper *data, gboolean want_plain, gboolean cit
if (text && !header_content_type_is (mime_type, "text", "html")) {
char *html;
- html = e_text_to_html (text, E_TEXT_TO_HTML_PRE | E_TEXT_TO_HTML_CONVERT_URLS |
- (cite ? E_TEXT_TO_HTML_CITE : 0));
+ html = camel_text_to_html (text, CAMEL_MIME_FILTER_TOHTML_PRE |
+ CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
+ (cite ? CAMEL_MIME_FILTER_TOHTML_CITE : 0), 0);
g_free (text);
text = html;
}
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index dd5717757d..81c5447f5d 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -45,7 +45,6 @@
#include "mail-session.h"
#include "composer/e-msg-composer.h"
#include "folder-browser.h"
-#include "e-util/e-html-utils.h"
#include "filter/filter-filter.h"
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 79abe80523..b219d744ee 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -44,7 +44,6 @@
#include "mail-local.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
-#include "e-util/e-html-utils.h"
/* **************************************** */