diff --git a/lib/mu-store-read.cc b/lib/mu-store-read.cc index e03db4f0..e3321afc 100644 --- a/lib/mu-store-read.cc +++ b/lib/mu-store-read.cc @@ -62,7 +62,8 @@ _MuStore::get_uid_term (const char* path) * messages are only considered ones (ignore e.g. symlinks and * '//' in paths) */ if (!realpath (path, real_path)) { - g_warning ("realpath() failed: %s", strerror (errno)); + g_warning ("realpath() failed for %s: %s", + path, strerror (errno)); strcpy (real_path, path); /* ignore errors */ } diff --git a/lib/mu-store-write.cc b/lib/mu-store-write.cc index 2629636c..eb83e0c6 100644 --- a/lib/mu-store-write.cc +++ b/lib/mu-store-write.cc @@ -390,14 +390,13 @@ maybe_index_text_part (MuMsg *msg, MuMsgPart *part, PartData *pdata) char *txt, *norm; Xapian::TermGenerator termgen; - /* we handle the body text elsewhere; this is about other text + /* only deal with attachments, inlines are indexed as body * parts */ - if (part->part_type & MU_MSG_PART_TYPE_BODY) + if (!(part->part_type & MU_MSG_PART_TYPE_ATTACHMENT)) return; - /* TODO: add other text types? */ - if (g_ascii_strcasecmp (part->type, "text") != 0 || - g_ascii_strcasecmp (part->subtype, "plain") != 0) + /* only text/plain */ + if (!(part->part_type & MU_MSG_PART_TYPE_TEXT_PLAIN)) return; txt = mu_msg_part_get_text (msg, part, MU_MSG_OPTION_NONE, @@ -475,10 +474,10 @@ add_terms_values_body (Xapian::Document& doc, MuMsg *msg, if (mu_msg_get_flags(msg) & MU_FLAG_ENCRYPTED) return; /* ignore encrypted bodies */ - str = mu_msg_get_body_text (msg); + str = mu_msg_get_body_text (msg, MU_MSG_OPTION_NONE); if (!str) /* FIXME: html->txt fallback needed */ - str = mu_msg_get_body_html (msg); - + str = mu_msg_get_body_html (msg, + MU_MSG_OPTION_NONE); if (!str) return; /* no body... */ diff --git a/lib/tests/test-mu-msg.c b/lib/tests/test-mu-msg.c index 3ec45f50..a24c7c50 100644 --- a/lib/tests/test-mu-msg.c +++ b/lib/tests/test-mu-msg.c @@ -181,7 +181,7 @@ test_mu_msg_03 (void) ==, MU_MSG_PRIO_NORMAL); g_assert_cmpuint (mu_msg_get_date(msg), ==, 0); - g_assert_cmpstr (mu_msg_get_body_text(msg), + g_assert_cmpstr (mu_msg_get_body_text(msg, MU_MSG_OPTION_NONE), ==, "\nLet's write some fünkÿ text\nusing umlauts.\n\nFoo.\n"); g_assert_cmpuint (mu_msg_get_flags(msg), @@ -224,7 +224,7 @@ test_mu_msg_multimime (void) /* ie., are text parts properly concatenated? */ g_assert_cmpstr (mu_msg_get_subject(msg), ==, "multimime"); - g_assert_cmpstr (mu_msg_get_body_text(msg), + g_assert_cmpstr (mu_msg_get_body_text(msg, MU_MSG_OPTION_NONE), ==, "abcdef"); g_assert_cmpuint (mu_msg_get_flags(msg), ==, MU_FLAG_FLAGGED | MU_FLAG_SEEN | diff --git a/mu/mu-cmd-find.c b/mu/mu-cmd-find.c index 8cb6d71b..79f9c166 100644 --- a/mu/mu-cmd-find.c +++ b/mu/mu-cmd-find.c @@ -380,14 +380,19 @@ display_field (MuMsg *msg, MuMsgFieldId mfid) static void -print_summary (MuMsg *msg, int summary_len) +print_summary (MuMsg *msg, MuConfig *opts) { const char* body; char *summ; + MuMsgOptions msgopts; - body = mu_msg_get_body_text(msg); + msgopts = mu_config_get_msg_options (opts); + body = mu_msg_get_body_text(msg, msgopts); - summ = body ? mu_str_summarize (body, (unsigned)summary_len) : NULL; + if (body) + summ = mu_str_summarize (body, (unsigned)opts->summary_len); + else + summ = NULL; g_print ("Summary: "); mu_util_fputs_encoded (summ ? summ : "", stdout); @@ -478,7 +483,7 @@ output_plain (MuMsg *msg, MuMsgIter *iter, MuConfig *opts, GError **err) output_plain_fields (msg, opts->fields, !opts->nocolor, opts->threads); if (opts->summary_len > 0) - print_summary (msg, opts->summary_len); + print_summary (msg, opts); return TRUE; } diff --git a/mu/mu-cmd.c b/mu/mu-cmd.c index 9e3a109f..83c0570d 100644 --- a/mu/mu-cmd.c +++ b/mu/mu-cmd.c @@ -123,8 +123,8 @@ body_or_summary (MuMsg *msg, MuConfig *opts) gboolean color; color = !opts->nocolor; - body = mu_msg_get_body_text (msg); - + body = mu_msg_get_body_text (msg, + mu_config_get_msg_options(opts)); if (!body) return; diff --git a/mu/tests/test-mu-query.c b/mu/tests/test-mu-query.c index 263a48fe..00996841 100644 --- a/mu/tests/test-mu-query.c +++ b/mu/tests/test-mu-query.c @@ -305,7 +305,7 @@ test_mu_query_accented_chars_01 (void) "Greetings from Lothlórien"); /* TODO: fix this again */ - summ = mu_str_summarize (mu_msg_get_body_text(msg), 5); + summ = mu_str_summarize (mu_msg_get_body_text(msg, MU_MSG_OPTION_NONE), 5); g_assert_cmpstr (summ,==, "Let's write some fünkÿ text using umlauts. Foo."); g_free (summ); diff --git a/toys/msg2pdf/msg2pdf.c b/toys/msg2pdf/msg2pdf.c index 31b92aa3..ba3e985e 100644 --- a/toys/msg2pdf/msg2pdf.c +++ b/toys/msg2pdf/msg2pdf.c @@ -200,11 +200,11 @@ convert_to_pdf (MuMsg *msg, GError **err) gstr = g_string_append (gstr, "
\n"); - body = mu_msg_get_body_html (msg); + body = mu_msg_get_body_html (msg, MU_MSG_OPTION_NONE); if (body) g_string_append_printf (gstr, "%s", body); else { - body = mu_msg_get_body_text (msg); + body = mu_msg_get_body_text (msg, MU_MSG_OPTION_NONE); if (body) { gchar *esc; esc = g_markup_escape_text (body, -1); diff --git a/toys/mug/mu-msg-body-view.c b/toys/mug/mu-msg-body-view.c index 9f10d564..aed37f13 100644 --- a/toys/mug/mu-msg-body-view.c +++ b/toys/mug/mu-msg-body-view.c @@ -352,11 +352,12 @@ mu_msg_body_view_set_message (MuMsgBodyView *self, MuMsg *msg) set_message (self, msg); - data = msg ? mu_msg_get_body_html (msg) : ""; + data = msg ? mu_msg_get_body_html (msg, MU_MSG_OPTION_NONE) : ""; if (data) set_html (self, data); else - set_text (self, mu_msg_get_body_text (msg)); + set_text (self, + mu_msg_get_body_text (msg, MU_MSG_OPTION_NONE)); self->_priv->_view_mode = VIEW_MODE_MSG; } diff --git a/toys/mug/mug.c b/toys/mug/mug.c index 79f5177d..cf54bdc1 100644 --- a/toys/mug/mug.c +++ b/toys/mug/mug.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 2010-2011 Dirk-Jan C. Binnema +** Copyright (C) 2010-2012 Dirk-Jan C. Binnema ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the