diff options
Diffstat (limited to 'mail/em-format-quote.c')
-rw-r--r-- | mail/em-format-quote.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/mail/em-format-quote.c b/mail/em-format-quote.c index e92147304e..69626b951a 100644 --- a/mail/em-format-quote.c +++ b/mail/em-format-quote.c @@ -56,11 +56,11 @@ static EMFormatClass *emfq_parent; static void emfq_init(GObject *o) -{ +{ EMFormatQuote *emfq =(EMFormatQuote *) o; - + emfq->priv = g_malloc0(sizeof(*emfq->priv)); - + /* we want to convert url's etc */ emfq->text_html_flags = CAMEL_MIME_FILTER_TOHTML_PRE | CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES; @@ -75,7 +75,7 @@ emfq_finalise(GObject *o) camel_object_unref(emfq->stream); g_free(emfq->credits); g_free(emfq->priv); - + ((GObjectClass *) emfq_parent)->finalize(o); } @@ -92,7 +92,7 @@ emfq_class_init(GObjectClass *klass) ((EMFormatClass *) klass)->format_error = emfq_format_error; ((EMFormatClass *) klass)->format_source = emfq_format_source; ((EMFormatClass *) klass)->format_attachment = emfq_format_attachment; - + klass->finalize = emfq_finalise; } @@ -100,7 +100,7 @@ GType em_format_quote_get_type(void) { static GType type = 0; - + if (type == 0) { static const GTypeInfo info = { sizeof(EMFormatQuoteClass), @@ -110,11 +110,11 @@ em_format_quote_get_type(void) sizeof(EMFormatQuote), 0, (GInstanceInitFunc) emfq_init }; - + emfq_parent = g_type_class_ref(em_format_get_type()); type = g_type_register_static(em_format_get_type(), "EMFormatQuote", &info, 0); } - + return type; } @@ -122,14 +122,14 @@ EMFormatQuote * em_format_quote_new(const char *credits, CamelStream *stream, guint32 flags) { EMFormatQuote *emfq; - + emfq = (EMFormatQuote *)g_object_new(em_format_quote_get_type(), NULL); emfq->credits = g_strdup(credits); emfq->stream = stream; camel_object_ref(stream); emfq->flags = flags; - + return emfq; } @@ -155,7 +155,7 @@ emfq_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMime handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); handle = em_format_find_handler(emf, "x-evolution/message/rfc822"); if (handle) - handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); + handle->handler(emf, emfq->stream, (CamelMimePart *)msg, handle); camel_stream_flush(emfq->stream); @@ -173,23 +173,23 @@ emfq_format_text_header (EMFormatQuote *emfq, CamelStream *stream, const char *l { const char *fmt, *html; char *mhtml = NULL; - + if (value == NULL) return; - + while (*value == ' ') value++; - + if (!is_html) html = mhtml = camel_text_to_html (value, 0, 0); else html = value; - + if (flags & EM_FORMAT_HEADER_BOLD) fmt = "<b>%s</b>: %s<br>"; else fmt = "%s: %s<br>"; - + camel_stream_printf (stream, fmt, label, html); g_free (mhtml); } @@ -213,18 +213,18 @@ emfq_format_address (GString *out, struct _camel_header_address *a) { guint32 flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES; char *name, *mailto, *addr; - + while (a) { if (a->name) name = camel_text_to_html (a->name, flags, 0); else name = NULL; - + switch (a->type) { case CAMEL_HEADER_ADDRESS_NAME: if (name && *name) { char *real, *mailaddr; - + g_string_append_printf (out, "%s <", name); /* rfc2368 for mailto syntax and url encoding extras */ if ((real = camel_header_encode_phrase ((unsigned char *)a->name))) { @@ -242,7 +242,7 @@ emfq_format_address (GString *out, struct _camel_header_address *a) g_string_append_printf (out, "<a href=\"mailto:%s\">%s</a>", mailto, addr); g_free (mailto); g_free (addr); - + if (name && *name) g_string_append (out, ">"); break; @@ -255,9 +255,9 @@ emfq_format_address (GString *out, struct _camel_header_address *a) g_warning ("Invalid address type"); break; } - + g_free (name); - + a = a->next; if (a) g_string_append (out, ", "); @@ -273,28 +273,28 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const const char *txt, *label; int addrspec = 0, i; int is_html = FALSE; - + name = g_alloca (strlen (namein) + 1); strcpy (name, namein); camel_strdown (name); - + for (i = 0; addrspec_hdrs[i]; i++) { if (!strcmp (name, addrspec_hdrs[i])) { addrspec = 1; break; } } - + if (addrspec) { struct _camel_header_address *addrs; GString *html; - + if (!(txt = camel_medium_get_header (part, name))) return; - + if (!(addrs = camel_header_address_decode (txt, emf->charset ? emf->charset : emf->default_charset))) return; - + /* canonicalise the header name... first letter is * capitalised and any letter following a '-' also gets * capitalised */ @@ -305,9 +305,9 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const if (p[-1] == '-' && *p >= 'a' && *p <= 'z') *p -= 0x20; } while (*p); - + label = _(name); - + html = g_string_new (""); emfq_format_address (html, addrs); camel_header_address_unref (addrs); @@ -323,20 +323,20 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const if (!(txt = camel_medium_get_header (part, "x-mailer"))) if (!(txt = camel_medium_get_header (part, "user-agent"))) return; - + txt = value = camel_header_format_ctext (txt, charset); - + label = _("Mailer"); flags |= EM_FORMAT_HEADER_BOLD; } else if (!strcmp (name, "date") || !strcmp (name, "resent-date")) { if (!(txt = camel_medium_get_header (part, name))) return; - + if (!strcmp (name, "date")) label = _("Date"); else label = "Resent-Date"; - + flags |= EM_FORMAT_HEADER_BOLD; } else { txt = camel_medium_get_header (part, name); @@ -344,9 +344,9 @@ emfq_format_header (EMFormat *emf, CamelStream *stream, CamelMedium *part, const txt = value; label = namein; } - + emfq_format_text_header (emfq, stream, label, txt, flags, is_html); - + g_free (value); } @@ -357,14 +357,14 @@ emfq_format_headers (EMFormatQuote *emfq, CamelStream *stream, CamelMedium *part CamelContentType *ct; const char *charset; EMFormatHeader *h; - + if (!part) return; ct = camel_mime_part_get_content_type ((CamelMimePart *) part); charset = camel_content_type_param (ct, "charset"); - charset = e_iconv_charset_name (charset); - + charset = e_iconv_charset_name (charset); + /* dump selected headers */ h = (EMFormatHeader *) emf->header_list.head; while (h->next) { @@ -400,9 +400,9 @@ emfq_format_message(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con emfq_format_headers (emfq, stream, (CamelMedium *)part); } else if (emfq->flags & EM_FORMAT_QUOTE_HEADERS) emfq_format_headers (emfq, stream, (CamelMedium *)part); - + em_format_part (emf, stream, part); - + if (emfq->flags & EM_FORMAT_QUOTE_CITE) camel_stream_write_string(stream, "</blockquote></font><!--+GtkHTML:<DATA class=\"ClueFlow\" clear=\"orig\">-->"); } @@ -419,7 +419,7 @@ emfq_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart *part) | CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT, 0); camel_stream_filter_add(filtered_stream, html_filter); camel_object_unref(html_filter); - + em_format_format_text(emf, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); camel_object_unref(filtered_stream); } @@ -465,26 +465,26 @@ emfq_text_plain(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part, E return; flags = emfq->text_html_flags; - + /* Check for RFC 2646 flowed text. */ type = camel_mime_part_get_content_type(part); if (camel_content_type_is(type, "text", "plain") && (format = camel_content_type_param(type, "format")) && !g_ascii_strcasecmp(format, "flowed")) flags |= CAMEL_MIME_FILTER_TOHTML_FORMAT_FLOWED; - + filtered_stream = camel_stream_filter_new_with_stream(stream); - + if (emfq->flags != 0) { sig_strip = em_stripsig_filter_new (); camel_stream_filter_add (filtered_stream, sig_strip); camel_object_unref (sig_strip); } - + html_filter = camel_mime_filter_tohtml_new(flags, rgb); camel_stream_filter_add(filtered_stream, html_filter); camel_object_unref(html_filter); - + em_format_format_text((EMFormat *)emfq, (CamelStream *)filtered_stream, (CamelDataWrapper *)part); camel_stream_flush((CamelStream *)filtered_stream); camel_object_unref(filtered_stream); @@ -497,16 +497,16 @@ emfq_text_enriched(EMFormatQuote *emfq, CamelStream *stream, CamelMimePart *part CamelMimeFilter *enriched; CamelDataWrapper *dw; guint32 flags = 0; - + dw = camel_medium_get_content_object((CamelMedium *)part); - + if (!strcmp(info->mime_type, "text/richtext")) { flags = CAMEL_MIME_FILTER_ENRICHED_IS_RICHTEXT; camel_stream_write_string(stream, "\n<!-- text/richtext -->\n"); } else { camel_stream_write_string(stream, "\n<!-- text/enriched -->\n"); } - + enriched = camel_mime_filter_enriched_new(flags); filtered_stream = camel_stream_filter_new_with_stream (stream); camel_stream_filter_add(filtered_stream, enriched); @@ -548,7 +548,7 @@ static void emfq_builtin_init(EMFormatQuoteClass *efhc) { int i; - + for (i=0;i<sizeof(type_builtin_table)/sizeof(type_builtin_table[0]);i++) em_format_class_add_handler((EMFormatClass *)efhc, &type_builtin_table[i]); } |