* remove debug output, fix code for cc10, line33

This commit is contained in:
Dirk-Jan C. Binnema 2011-06-24 12:39:46 +03:00
parent ffb6dfae8c
commit 9c6014e40b
3 changed files with 44 additions and 37 deletions

View File

@ -46,13 +46,41 @@ get_recip (GMimeMessage *msg, GMimeRecipientType rtype)
return recep; 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 static gboolean
test_message (GMimeMessage *msg) test_message (GMimeMessage *msg)
{ {
gchar *val; gchar *val;
const gchar *str; const gchar *str;
g_print ("From : %s\n", g_mime_message_get_sender (msg)); g_print ("From : %s\n", g_mime_message_get_sender (msg));
val = get_recip (msg, GMIME_RECIPIENT_TYPE_TO); val = get_recip (msg, GMIME_RECIPIENT_TYPE_TO);
@ -74,29 +102,12 @@ test_message (GMimeMessage *msg)
g_print ("Msg-id : %s\n", str ? str : "<none>"); g_print ("Msg-id : %s\n", str ? str : "<none>");
{ {
str = g_mime_object_get_header (GMIME_OBJECT(msg), gchar *refsstr;
"References"); refsstr = get_refs_str (msg);
/* get stuff from the 'references' header */ g_print ("Refs : %s\n", refsstr ? refsstr : "<none>");
if (str) { g_free (refsstr);
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 : "<huh?>");
}
g_print ("\n");
g_mime_references_free (mime_refs);
}
} }
return TRUE; return TRUE;
} }

View File

@ -554,14 +554,13 @@ print_summary (MuMsgIter *iter)
static void static void
thread_indent (MuMsgIter *iter, gboolean color) thread_indent (MuMsgIter *iter)
{ {
const MuMsgIterThreadInfo *ti; const MuMsgIterThreadInfo *ti;
const char* threadpath; const char* threadpath;
int i; int i;
gboolean is_root, first_child, empty_parent, is_dup; gboolean is_root, first_child, empty_parent, is_dup;
ti = mu_msg_iter_get_thread_info (iter); ti = mu_msg_iter_get_thread_info (iter);
if (!ti) { if (!ti) {
g_warning ("cannot get thread-info for %s", 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; empty_parent = ti->prop & MU_MSG_ITER_THREAD_PROP_EMPTY_PARENT;
is_dup = ti->prop & MU_MSG_ITER_THREAD_PROP_DUP; is_dup = ti->prop & MU_MSG_ITER_THREAD_PROP_DUP;
/* count the colons... */ /* FIXME: count the colons... */
for (i = 0; *threadpath; ++threadpath) for (i = 0; *threadpath; ++threadpath)
i += (*threadpath == ':') ? 1 : 0; i += (*threadpath == ':') ? 1 : 0;
/* indent */ /* indent */
while (i --> 0) while (i --> 0)
fputs (" ", stdout); fputs (" ", stdout);
if (color)
fputs (MU_COLOR_YELLOW, stdout);
if (!is_root) { if (!is_root) {
fputs (first_child ? "`" : "|", stdout); fputs (first_child ? "`" : "|", stdout);
fputs (empty_parent ? "*> " : is_dup ? "=> " : "-> ", 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; const char* myfields;
size_t len; 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) if (threads)
thread_indent (iter, color); thread_indent (iter);
for (myfields = fields, len = 0; *myfields; ++myfields) { for (myfields = fields, len = 0; *myfields; ++myfields) {

View File

@ -43,7 +43,7 @@ fill_database (const char *testdir)
cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s" cmdline = g_strdup_printf ("%s index --muhome=%s --maildir=%s"
" --quiet", " --quiet",
MU_PROGRAM, tmpdir, testdir); MU_PROGRAM, tmpdir, testdir);
g_print ("%s\n", cmdline); /* g_print ("%s\n", cmdline); */
g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL, g_assert (g_spawn_command_line_sync (cmdline, NULL, NULL,
NULL, NULL)); NULL, NULL));