* re-enable message summaries

This commit is contained in:
Dirk-Jan C. Binnema 2011-05-15 10:40:29 +03:00
parent b990bcb054
commit 9a1ccc3103
3 changed files with 19 additions and 12 deletions

View File

@ -54,12 +54,15 @@ view_msg (MuMsg *msg, const gchar *fields, size_t summary_len)
if ((date = mu_msg_get_date (msg))) if ((date = mu_msg_get_date (msg)))
g_print ("Date: %s\n", mu_str_date_s ("%c", date)); g_print ("Date: %s\n", mu_str_date_s ("%c", date));
/* TODO: reimplement the summary stuff... */ if (!(field = mu_msg_get_body_text (msg)))
/* if (summary_len > 0) { */ return TRUE; /* no body -- nothing more to do */
/* field = mu_msg_get_summary (msg, summary_len); */
/* g_print ("Summary: %s\n", field ? field : "<none>"); */ if (summary_len > 0) {
/* } else */ gchar *summ;
if ((field = mu_msg_get_body_text (msg))) summ = mu_str_summarize (field, summary_len);
g_print ("Summary: %s\n", summ);
g_free (summ);
} else
g_print ("\n%s\n", field); g_print ("\n%s\n", field);
return TRUE; return TRUE;

View File

@ -169,7 +169,7 @@ static void
print_summary (MuMsgIter *iter, size_t summary_len) print_summary (MuMsgIter *iter, size_t summary_len)
{ {
GError *err; GError *err;
/* const char *summ; */ char *summ;
MuMsg *msg; MuMsg *msg;
if (summary_len == 0) if (summary_len == 0)
@ -183,9 +183,9 @@ print_summary (MuMsgIter *iter, size_t summary_len)
return; return;
} }
/* TODO: summary again */ summ = mu_str_summarize (mu_msg_get_body_text(msg), summary_len);
/* summ = mu_msg_get_summary (msg, summary_len); */ g_print ("Summary: %s\n", summ ? summ : "<none>");
/* g_print ("Summary: %s\n", summ ? summ : "<none>"); */ g_free (summ);
mu_msg_unref (msg); mu_msg_unref (msg);
} }

View File

@ -30,6 +30,7 @@
#include "test-mu-common.h" #include "test-mu-common.h"
#include "src/mu-query.h" #include "src/mu-query.h"
#include "src/mu-str.h"
static gchar* static gchar*
fill_database (void) fill_database (void)
@ -211,6 +212,7 @@ test_mu_query_05 (void)
MuMsg *msg; MuMsg *msg;
gchar *xpath; gchar *xpath;
GError *err; GError *err;
gchar *summ;
xpath = fill_database (); xpath = fill_database ();
g_assert (xpath != NULL); g_assert (xpath != NULL);
@ -229,8 +231,10 @@ test_mu_query_05 (void)
g_assert_cmpstr (mu_msg_get_subject(msg),==, g_assert_cmpstr (mu_msg_get_subject(msg),==,
"Greetings from Lothlórien"); "Greetings from Lothlórien");
/* TODO: fix this again */ /* 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_unref (msg);
mu_msg_iter_destroy (iter); mu_msg_iter_destroy (iter);