mirror of https://github.com/djcb/mu.git
* re-enable message summaries
This commit is contained in:
parent
b990bcb054
commit
9a1ccc3103
15
src/mu-cmd.c
15
src/mu-cmd.c
|
@ -54,12 +54,15 @@ view_msg (MuMsg *msg, const gchar *fields, size_t summary_len)
|
|||
if ((date = mu_msg_get_date (msg)))
|
||||
g_print ("Date: %s\n", mu_str_date_s ("%c", date));
|
||||
|
||||
/* TODO: reimplement the summary stuff... */
|
||||
/* if (summary_len > 0) { */
|
||||
/* field = mu_msg_get_summary (msg, summary_len); */
|
||||
/* g_print ("Summary: %s\n", field ? field : "<none>"); */
|
||||
/* } else */
|
||||
if ((field = mu_msg_get_body_text (msg)))
|
||||
if (!(field = mu_msg_get_body_text (msg)))
|
||||
return TRUE; /* no body -- nothing more to do */
|
||||
|
||||
if (summary_len > 0) {
|
||||
gchar *summ;
|
||||
summ = mu_str_summarize (field, summary_len);
|
||||
g_print ("Summary: %s\n", summ);
|
||||
g_free (summ);
|
||||
} else
|
||||
g_print ("\n%s\n", field);
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -169,7 +169,7 @@ static void
|
|||
print_summary (MuMsgIter *iter, size_t summary_len)
|
||||
{
|
||||
GError *err;
|
||||
/* const char *summ; */
|
||||
char *summ;
|
||||
MuMsg *msg;
|
||||
|
||||
if (summary_len == 0)
|
||||
|
@ -183,9 +183,9 @@ print_summary (MuMsgIter *iter, size_t summary_len)
|
|||
return;
|
||||
}
|
||||
|
||||
/* TODO: summary again */
|
||||
/* summ = mu_msg_get_summary (msg, summary_len); */
|
||||
/* g_print ("Summary: %s\n", summ ? summ : "<none>"); */
|
||||
summ = mu_str_summarize (mu_msg_get_body_text(msg), summary_len);
|
||||
g_print ("Summary: %s\n", summ ? summ : "<none>");
|
||||
g_free (summ);
|
||||
|
||||
mu_msg_unref (msg);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "test-mu-common.h"
|
||||
#include "src/mu-query.h"
|
||||
#include "src/mu-str.h"
|
||||
|
||||
static gchar*
|
||||
fill_database (void)
|
||||
|
@ -211,6 +212,7 @@ test_mu_query_05 (void)
|
|||
MuMsg *msg;
|
||||
gchar *xpath;
|
||||
GError *err;
|
||||
gchar *summ;
|
||||
|
||||
xpath = fill_database ();
|
||||
g_assert (xpath != NULL);
|
||||
|
@ -229,8 +231,10 @@ test_mu_query_05 (void)
|
|||
g_assert_cmpstr (mu_msg_get_subject(msg),==,
|
||||
"Greetings from Lothlórien");
|
||||
/* TODO: fix this again */
|
||||
/* g_assert_cmpstr (mu_msg_get_summary(msg,5),==, */
|
||||
/* "Let's write some fünkÿ text using umlauts. Foo."); */
|
||||
|
||||
summ = mu_str_summarize (mu_msg_get_body_text(msg), 5);
|
||||
g_assert_cmpstr (summ,==, "Let's write some fünkÿ text using umlauts. Foo.");
|
||||
g_free (summ);
|
||||
|
||||
mu_msg_unref (msg);
|
||||
mu_msg_iter_destroy (iter);
|
||||
|
|
Loading…
Reference in New Issue