mirror of https://github.com/djcb/mu.git
* updates for mu_msg_get_body_(text|html) api change
This commit is contained in:
parent
86bf7b7165
commit
abfcc4a2f3
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -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... */
|
||||
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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 : "<none>", 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -200,11 +200,11 @@ convert_to_pdf (MuMsg *msg, GError **err)
|
|||
|
||||
gstr = g_string_append (gstr, "<hr>\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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** Copyright (C) 2010-2011 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
** Copyright (C) 2010-2012 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
||||
**
|
||||
** 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
|
||||
|
|
Loading…
Reference in New Issue