diff --git a/contrib/gmime-test.c b/contrib/gmime-test.c index 2e797b31..12f27f61 100644 --- a/contrib/gmime-test.c +++ b/contrib/gmime-test.c @@ -46,13 +46,41 @@ get_recip (GMimeMessage *msg, GMimeRecipientType rtype) return recep; } +static gchar* +get_refs_str (GMimeMessage *msg) +{ + const gchar *str; + const GMimeReferences *cur; + GMimeReferences *mime_refs; + gchar *rv; + + str = g_mime_object_get_header (GMIME_OBJECT(msg), + "References"); + if (!str) + return NULL; + + mime_refs = g_mime_references_decode (str); + for (rv = NULL, cur = mime_refs; cur; + cur = g_mime_references_get_next(cur)) { + + const char* msgid; + msgid = g_mime_references_get_message_id (cur); + rv = g_strdup_printf ("%s%s%s", + rv ? rv : "", + rv ? "," : "", + msgid); + } + g_mime_references_free (mime_refs); + + return rv; +} static gboolean test_message (GMimeMessage *msg) { gchar *val; const gchar *str; - + g_print ("From : %s\n", g_mime_message_get_sender (msg)); val = get_recip (msg, GMIME_RECIPIENT_TYPE_TO); @@ -74,29 +102,12 @@ test_message (GMimeMessage *msg) g_print ("Msg-id : %s\n", str ? str : ""); { - str = g_mime_object_get_header (GMIME_OBJECT(msg), - "References"); - /* get stuff from the 'references' header */ - if (str) { - const GMimeReferences *cur; - GMimeReferences *mime_refs; - - g_print ("Refs : "); - - mime_refs = g_mime_references_decode (str); - for (cur = mime_refs; cur; - cur = g_mime_references_get_next(cur)) { - - const char* msgid; - msgid = g_mime_references_get_message_id (cur); - g_print ("%s%s", - cur == mime_refs ? "" : ",", - msgid ? msgid : ""); - } - g_print ("\n"); - g_mime_references_free (mime_refs); - } + gchar *refsstr; + refsstr = get_refs_str (msg); + g_print ("Refs : %s\n", refsstr ? refsstr : ""); + g_free (refsstr); } + return TRUE; } diff --git a/src/mu-cmd-find.c b/src/mu-cmd-find.c index 639c3f0e..5009693f 100644 --- a/src/mu-cmd-find.c +++ b/src/mu-cmd-find.c @@ -554,14 +554,13 @@ print_summary (MuMsgIter *iter) static void -thread_indent (MuMsgIter *iter, gboolean color) +thread_indent (MuMsgIter *iter) { const MuMsgIterThreadInfo *ti; const char* threadpath; int i; gboolean is_root, first_child, empty_parent, is_dup; - - + ti = mu_msg_iter_get_thread_info (iter); if (!ti) { g_warning ("cannot get thread-info for %s", @@ -578,24 +577,18 @@ thread_indent (MuMsgIter *iter, gboolean color) empty_parent = ti->prop & MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT; is_dup = ti->prop & MU_MSG_ITER_THREAD_PROP_DUP; - /* count the colons... */ + /* FIXME: count the colons... */ for (i = 0; *threadpath; ++threadpath) i += (*threadpath == ':') ? 1 : 0; /* indent */ while (i --> 0) fputs (" ", stdout); - - if (color) - fputs (MU_COLOR_YELLOW, stdout); - + if (!is_root) { fputs (first_child ? "`" : "|", stdout); fputs (empty_parent ? "*> " : is_dup ? "=> " : "-> ", stdout); } - - if (color) - fputs (MU_COLOR_DEFAULT, stdout); } @@ -606,9 +599,12 @@ output_plain_fields (MuMsgIter *iter, const char *fields, gboolean color, { const char* myfields; size_t len; - + + /* we reuse the color (whatever that may be) + * for message-priority for threads, too */ + ansi_color_maybe (MU_MSG_FIELD_ID_PRIO, color); if (threads) - thread_indent (iter, color); + thread_indent (iter); for (myfields = fields, len = 0; *myfields; ++myfields) { diff --git a/src/tests/test-mu-threads.c b/src/tests/test-mu-threads.c index b8f45259..5553b73f 100644 --- a/src/tests/test-mu-threads.c +++ b/src/tests/test-mu-threads.c @@ -43,7 +43,7 @@ fill_database (const char *testdir) cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s" " --quiet", MU_PROGRAM, tmpdir, testdir); - g_print ("%s\n", cmdline); + /* g_print ("%s\n", cmdline); */ g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, NULL, NULL));