aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-format.c')
-rw-r--r--mail/em-format.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/mail/em-format.c b/mail/em-format.c
index 5bedde4007..36177d7991 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -56,7 +56,7 @@
#include "em-utils.h"
#include "mail-config.h"
-#define d(x)
+#define d(x)
/* Used to cache various data/info for redraws
The validity stuff could be cached at a higher level but this is easier
@@ -116,7 +116,7 @@ static void
emf_init(GObject *o)
{
EMFormat *emf = (EMFormat *)o;
-
+
emf->inline_table = g_hash_table_new_full (
g_str_hash, g_str_equal,
(GDestroyNotify) NULL,
@@ -133,7 +133,7 @@ static void
emf_finalise(GObject *o)
{
EMFormat *emf = (EMFormat *)o;
-
+
if (emf->session)
camel_object_unref(emf->session);
@@ -146,7 +146,7 @@ emf_finalise(GObject *o)
g_string_free(emf->part_id, TRUE);
/* FIXME: check pending jobs */
-
+
((GObjectClass *)emf_parent)->finalize(o);
}
@@ -204,7 +204,7 @@ em_format_get_type(void)
* em_format_class_add_handler:
* @emfc: EMFormatClass
* @info: Callback information.
- *
+ *
* Add a mime type handler to this class. This is only used by
* implementing classes. The @info.old pointer will automatically be
* setup to point to the old hanlder if one was already set. This can
@@ -227,13 +227,13 @@ em_format_class_add_handler(EMFormatClass *emfc, EMFormatHandler *info)
struct _class_handlers {
EMFormatClass *old;
EMFormatClass *new;
-};
+};
static void
merge_missing (gpointer key, gpointer value, gpointer userdata)
{
struct _class_handlers *classes = (struct _class_handlers *) userdata;
EMFormatHandler *info, *oldinfo;
-
+
oldinfo = (EMFormatHandler *) value;
info = g_hash_table_lookup (classes->new->type_handlers, key);
if (!info) {
@@ -258,9 +258,9 @@ em_format_merge_handler(EMFormat *new, EMFormat *old)
}
/**
* em_format_class_remove_handler:
- * @emfc:
- * @info:
- *
+ * @emfc:
+ * @info:
+ *
* Remove a handler. @info must be a value which was previously
* added.
**/
@@ -288,11 +288,11 @@ em_format_class_remove_handler(EMFormatClass *emfc, EMFormatHandler *info)
/**
* em_format_find_handler:
- * @emf:
- * @mime_type:
- *
+ * @emf:
+ * @mime_type:
+ *
* Find a format handler by @mime_type.
- *
+ *
* Return value: NULL if no handler is available.
**/
static const EMFormatHandler *
@@ -305,14 +305,14 @@ emf_find_handler(EMFormat *emf, const char *mime_type)
/**
* em_format_fallback_handler:
- * @emf:
- * @mime_type:
- *
+ * @emf:
+ * @mime_type:
+ *
* Try to find a format handler based on the major type of the @mime_type.
*
* The subtype is replaced with "*" and a lookup performed.
- *
- * Return value:
+ *
+ * Return value:
**/
const EMFormatHandler *
em_format_fallback_handler(EMFormat *emf, const char *mime_type)
@@ -335,18 +335,18 @@ em_format_fallback_handler(EMFormat *emf, const char *mime_type)
/**
* em_format_add_puri:
- * @emf:
- * @size:
+ * @emf:
+ * @size:
* @cid: Override the autogenerated content id.
- * @part:
- * @func:
- *
+ * @part:
+ * @func:
+ *
* Add a pending-uri handler. When formatting parts that reference
* other parts, a pending-uri (PURI) can be used to track the reference.
*
* @size is used to allocate the structure, so that it can be directly
* subclassed by implementors.
- *
+ *
* @cid can be used to override the key used to retreive the PURI, if NULL,
* then the content-location and the content-id of the @part are stored
* as lookup keys for the part.
@@ -427,8 +427,8 @@ em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *p
/**
* em_format_push_level:
- * @emf:
- *
+ * @emf:
+ *
* This is used to build a heirarchy of visible PURI objects based on
* the structure of the message. Used by multipart/alternative formatter.
*
@@ -455,8 +455,8 @@ em_format_push_level(EMFormat *emf)
/**
* em_format_pull_level:
- * @emf:
- *
+ * @emf:
+ *
* Drop a level of visibility back to the parent. Note that
* no PURI values are actually freed.
**/
@@ -469,13 +469,13 @@ em_format_pull_level(EMFormat *emf)
/**
* em_format_find_visible_puri:
- * @emf:
- * @uri:
- *
+ * @emf:
+ * @uri:
+ *
* Search for a PURI based on the visibility defined by :push_level()
* and :pull_level().
- *
- * Return value:
+ *
+ * Return value:
**/
EMFormatPURI *
em_format_find_visible_puri(EMFormat *emf, const char *uri)
@@ -502,13 +502,13 @@ em_format_find_visible_puri(EMFormat *emf, const char *uri)
/**
* em_format_find_puri:
- * @emf:
- * @uri:
- *
+ * @emf:
+ * @uri:
+ *
* Search for a PURI based on a uri. Both the content-id
* and content-location are checked.
- *
- * Return value:
+ *
+ * Return value:
**/
EMFormatPURI *
@@ -559,8 +559,8 @@ emf_clear_puri_node(struct _EMFormatPURITree *node)
/**
* em_format_clear_puri_tree:
- * @emf:
- *
+ * @emf:
+ *
* For use by implementors to clear out the message structure
* data.
**/
@@ -687,7 +687,7 @@ emf_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeM
emf->charset = g_strdup(emfsource->charset);
g_free (emf->default_charset);
emf->default_charset = g_strdup (emfsource->default_charset);
-
+
em_format_clear_headers(emf);
for (h = (struct _EMFormatHeader *)emfsource->header_list.head; h->next; h = h->next)
em_format_add_header(emf, h->name, h->flags);
@@ -765,7 +765,7 @@ emf_busy(EMFormat *emf)
* @msg: Camel Message.
* @emfsource: Used as a basis for user-altered layout, e.g. inline viewed
* attachments.
- *
+ *
* Format a message @msg. If @emfsource is non NULL, then the status of
* inlined expansion and so forth is copied direction from @emfsource.
*
@@ -777,9 +777,9 @@ emf_busy(EMFormat *emf)
/**
* em_format_set_session:
- * @emf:
- * @s:
- *
+ * @emf:
+ * @s:
+ *
* Set the CamelSession to be used for signature verification and decryption
* purposes. If this is not set, then signatures cannot be verified or
* encrypted messages viewed.
@@ -796,9 +796,9 @@ em_format_set_session(EMFormat *emf, struct _CamelSession *s)
/**
* em_format_set_mode:
- * @emf:
- * @type:
- *
+ * @emf:
+ * @type:
+ *
* Set display mode, EM_FORMAT_SOURCE, EM_FORMAT_ALLHEADERS, or
* EM_FORMAT_NORMAL.
**/
@@ -817,9 +817,9 @@ em_format_set_mode(EMFormat *emf, em_format_mode_t type)
/**
* em_format_set_charset:
- * @emf:
- * @charset:
- *
+ * @emf:
+ * @charset:
+ *
* set override charset on formatter. message will be redisplayed if
* required.
**/
@@ -840,9 +840,9 @@ em_format_set_charset(EMFormat *emf, const char *charset)
/**
* em_format_set_default_charset:
- * @emf:
- * @charset:
- *
+ * @emf:
+ * @charset:
+ *
* Set the fallback, default system charset to use when no other charsets
* are present. Message will be redisplayed if required (and sometimes redisplayed
* when it isn't).
@@ -864,8 +864,8 @@ em_format_set_default_charset(EMFormat *emf, const char *charset)
/**
* em_format_clear_headers:
- * @emf:
- *
+ * @emf:
+ *
* Clear the list of headers to be displayed. This will force all headers to
* be shown.
**/
@@ -895,8 +895,8 @@ static const struct {
/**
* em_format_default_headers:
- * @emf:
- *
+ * @emf:
+ *
* Set the headers to show to the default list.
*
* From, Reply-To, To, Cc, Bcc, Subject and Date.
@@ -905,7 +905,7 @@ void
em_format_default_headers(EMFormat *emf)
{
int i;
-
+
em_format_clear_headers(emf);
for (i=0; i<sizeof(default_headers)/sizeof(default_headers[0]); i++)
em_format_add_header(emf, default_headers[i].name, default_headers[i].flags);
@@ -913,10 +913,10 @@ em_format_default_headers(EMFormat *emf)
/**
* em_format_add_header:
- * @emf:
+ * @emf:
* @name: The name of the header, as it will appear during output.
* @flags: EM_FORMAT_HEAD_* defines to control display attributes.
- *
+ *
* Add a specific header to show. If any headers are set, they will
* be displayed in the order set by this function. Certain known
* headers included in this list will be shown using special
@@ -934,9 +934,9 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags)
/**
* em_format_is_attachment:
- * @emf:
+ * @emf:
* @part: Part to check.
- *
+ *
* Returns true if the part is an attachment.
*
* A part is not considered an attachment if it is a
@@ -945,7 +945,7 @@ void em_format_add_header(EMFormat *emf, const char *name, guint32 flags)
* the part.
*
* Content-Disposition is not checked.
- *
+ *
* Return value: TRUE/FALSE
**/
int em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
@@ -958,26 +958,26 @@ int em_format_is_attachment(EMFormat *emf, CamelMimePart *part)
|| camel_content_type_is(dw->mime_type, "application", "x-pkcs7-mime")
|| camel_content_type_is(dw->mime_type, "application", "pkcs7-mime")
|| camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-signed")
- || camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-encrypted")
+ || camel_content_type_is(dw->mime_type, "application", "x-inlinepgp-encrypted")
|| (camel_content_type_is (dw->mime_type, "text", "*")
&& camel_mime_part_get_filename(part) == NULL));
}
/**
* em_format_is_inline:
- * @emf:
- * @part:
+ * @emf:
+ * @part:
* @partid: format->part_id part id of this part.
* @handle: handler for this part
- *
+ *
* Returns true if the part should be displayed inline. Any part with
* a Content-Disposition of inline, or if the @handle has a default
* inline set, will be shown inline.
*
* :set_inline() called on the same part will override any calculated
* value.
- *
- * Return value:
+ *
+ * Return value:
**/
int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part, const EMFormatHandler *handle)
{
@@ -1005,10 +1005,10 @@ int em_format_is_inline(EMFormat *emf, const char *partid, CamelMimePart *part,
/**
* em_format_set_inline:
- * @emf:
+ * @emf:
* @partid: id of part
- * @state:
- *
+ * @state:
+ *
* Force the attachment @part to be expanded or hidden explictly to match
* @state. This is used only to record the change for a redraw or
* cloned layout render and does not force a redraw.
@@ -1065,10 +1065,10 @@ em_format_format_content(EMFormat *emf, CamelStream *stream, CamelMimePart *part
/**
* em_format_format_content:
- * @emf:
+ * @emf:
* @stream: Where to write the converted text
* @part: Part whose container is to be formatted
- *
+ *
* Decode/output a part's content to @stream.
**/
void
@@ -1081,7 +1081,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
CamelStream *mem_stream = NULL;
size_t size;
size_t max;
-
+
if (emf->charset) {
charset = emf->charset;
} else if (dw->mime_type
@@ -1097,14 +1097,14 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
null = camel_stream_null_new();
filter_stream = camel_stream_filter_new_with_stream(null);
camel_object_unref(null);
-
+
windows = (CamelMimeFilterWindows *)camel_mime_filter_windows_new(charset);
camel_stream_filter_add(filter_stream, (CamelMimeFilter *)windows);
-
+
camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filter_stream);
camel_stream_flush((CamelStream *)filter_stream);
camel_object_unref(filter_stream);
-
+
charset = camel_mime_filter_windows_real_charset (windows);
} else if (charset == NULL) {
charset = emf->default_charset;
@@ -1112,7 +1112,7 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
mem_stream = (CamelStream *)camel_stream_mem_new ();
filter_stream = camel_stream_filter_new_with_stream(mem_stream);
-
+
if ((filter = camel_mime_filter_charset_new_convert(charset, "UTF-8"))) {
camel_stream_filter_add(filter_stream, (CamelMimeFilter *) filter);
camel_object_unref(filter);
@@ -1137,13 +1137,13 @@ em_format_format_text(EMFormat *emf, CamelStream *stream, CamelDataWrapper *dw)
/**
* em_format_describe_part:
- * @part:
- * @mimetype:
- *
+ * @part:
+ * @mimetype:
+ *
* Generate a simple textual description of a part, @mime_type represents the
* the content.
- *
- * Return value:
+ *
+ * Return value:
**/
char *
em_format_describe_part(CamelMimePart *part, const char *mime_type)
@@ -1249,7 +1249,7 @@ emf_multipart_mixed(EMFormat *emf, CamelStream *stream, CamelMimePart *part, con
}
len = emf->part_id->len;
- nparts = camel_multipart_get_number(mp);
+ nparts = camel_multipart_get_number(mp);
for (i = 0; i < nparts; i++) {
part = camel_multipart_get_part(mp, i);
g_string_append_printf(emf->part_id, ".mixed.%d", i);
@@ -1285,7 +1285,7 @@ emf_multipart_alternative(EMFormat *emf, CamelStream *stream, CamelMimePart *par
type = camel_mime_part_get_content_type (part);
mime_type = camel_content_type_simple (type);
-
+
camel_strdown (mime_type);
/*if (want_plain && !strcmp (mime_type, "text/plain"))
@@ -1394,7 +1394,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
}
/* FIXME: put this stuff in a shared function */
- nparts = camel_multipart_get_number(mp);
+ nparts = camel_multipart_get_number(mp);
content_type = camel_mime_part_get_content_type(part);
start = camel_content_type_param (content_type, "start");
if (start && strlen(start)>2) {
@@ -1404,11 +1404,11 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
/* strip <>'s */
len = strlen (start) - 2;
start++;
-
+
for (i=0; i<nparts; i++) {
body_part = camel_multipart_get_part(mp, i);
cid = camel_mime_part_get_content_id(body_part);
-
+
if (cid && !strncmp(cid, start, len) && strlen(cid) == len) {
display_part = body_part;
displayid = i;
@@ -1418,12 +1418,12 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
} else {
display_part = camel_multipart_get_part(mp, 0);
}
-
+
if (display_part == NULL) {
emf_multipart_mixed(emf, stream, part, info);
return;
}
-
+
em_format_push_level(emf);
oldpartid = g_strdup(emf->part_id->str);
@@ -1440,7 +1440,7 @@ emf_multipart_related(EMFormat *emf, CamelStream *stream, CamelMimePart *part, c
d(printf(" part '%s' '%s' added\n", puri->uri?puri->uri:"", puri->cid));
}
}
-
+
g_string_append_printf(emf->part_id, ".related.%d", displayid);
em_format_part(emf, stream, display_part);
g_string_truncate(emf->part_id, partidlen);
@@ -1550,7 +1550,7 @@ emf_message_rfc822(EMFormat *emf, CamelStream *stream, CamelMimePart *part, cons
handle = em_format_find_handler(emf, "x-evolution/message/rfc822");
if (handle)
handle->handler(emf, stream, (CamelMimePart *)dw, handle);
-
+
g_string_truncate(emf->part_id, len);
}
@@ -1593,67 +1593,67 @@ emf_inlinepgp_signed(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, E
camel_object_unref(cipher);
return;
}
-
+
/* Setup output stream */
ostream = camel_stream_mem_new();
filtered_stream = camel_stream_filter_new_with_stream(ostream);
-
+
/* Add PGP header / footer filter */
pgp_filter = (CamelMimeFilterPgp *)camel_mime_filter_pgp_new();
camel_stream_filter_add(filtered_stream, (CamelMimeFilter *)pgp_filter);
camel_object_unref(pgp_filter);
-
+
/* Pass through the filters that have been setup */
dw = camel_medium_get_content_object((CamelMedium *)ipart);
camel_data_wrapper_decode_to_stream(dw, (CamelStream *)filtered_stream);
camel_stream_flush((CamelStream *)filtered_stream);
camel_object_unref(filtered_stream);
-
+
/* Create a new text/plain MIME part containing the signed content preserving the original part's Content-Type params */
content_type = camel_mime_part_get_content_type (ipart);
type = camel_content_type_format (content_type);
content_type = camel_content_type_decode (type);
g_free (type);
-
+
g_free (content_type->type);
content_type->type = g_strdup ("text");
g_free (content_type->subtype);
content_type->subtype = g_strdup ("plain");
type = camel_content_type_format (content_type);
camel_content_type_unref (content_type);
-
+
dw = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (dw, ostream);
camel_data_wrapper_set_mime_type (dw, type);
-
+
opart = camel_mime_part_new ();
camel_medium_set_content_object ((CamelMedium *) opart, dw);
camel_data_wrapper_set_mime_type_field ((CamelDataWrapper *) opart, dw->mime_type);
-
- /* Pass it off to the real formatter */
+
+ /* Pass it off to the real formatter */
em_format_format_secure(emf, stream, opart, valid);
-
+
/* Clean Up */
camel_object_unref(dw);
camel_object_unref(opart);
camel_object_unref(ostream);
camel_object_unref(cipher);
- camel_exception_free(ex);
+ camel_exception_free(ex);
}
static void
emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart, EMFormatHandler *info)
-{
+{
CamelCipherContext *cipher;
CamelCipherValidity *valid;
CamelException *ex;
CamelMimePart *opart;
-
+
cipher = camel_gpg_context_new(emf->session);
ex = camel_exception_new();
opart = camel_mime_part_new();
/* Decrypt the message */
- valid = camel_cipher_decrypt (cipher, ipart, opart, ex);
+ valid = camel_cipher_decrypt (cipher, ipart, opart, ex);
if (!valid) {
em_format_format_error(emf, stream, ex->desc?_("Could not parse PGP message"):_("Could not parse PGP message: Unknown error"));
if (ex->desc)
@@ -1666,7 +1666,7 @@ emf_inlinepgp_encrypted(EMFormat *emf, CamelStream *stream, CamelMimePart *ipart
return;
}
- /* Pass it off to the real formatter */
+ /* Pass it off to the real formatter */
em_format_format_secure(emf, stream, opart, valid);
/* Clean Up */