* mu-cmd-find.c, mu-cmd.c: make sure we pass 'make line33'
This commit is contained in:
@ -572,6 +572,39 @@ indent (MuMsgIter *iter)
|
|||||||
fputs (" ", stdout);
|
fputs (" ", stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static size_t
|
||||||
|
output_plain_fields (MuMsgIter *iter, const char *fields, gboolean color,
|
||||||
|
gboolean threads)
|
||||||
|
{
|
||||||
|
const char* myfields;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
if (threads)
|
||||||
|
indent (iter);
|
||||||
|
|
||||||
|
for (myfields = fields, len = 0; *myfields; ++myfields) {
|
||||||
|
|
||||||
|
MuMsgFieldId mfid;
|
||||||
|
mfid = mu_msg_field_id_from_shortcut (*myfields, FALSE);
|
||||||
|
|
||||||
|
if (mfid == MU_MSG_FIELD_ID_NONE ||
|
||||||
|
(!mu_msg_field_xapian_value (mfid) &&
|
||||||
|
!mu_msg_field_xapian_contact (mfid)))
|
||||||
|
len += printf ("%c", *myfields);
|
||||||
|
|
||||||
|
else {
|
||||||
|
ansi_color_maybe (mfid, color);
|
||||||
|
len += mu_util_fputs_encoded
|
||||||
|
(display_field (iter, mfid), stdout);
|
||||||
|
ansi_reset_maybe (mfid, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
output_plain (MuMsgIter *iter, const char *fields, gboolean summary,
|
output_plain (MuMsgIter *iter, const char *fields, gboolean summary,
|
||||||
gboolean threads, gboolean color, size_t *count)
|
gboolean threads, gboolean color, size_t *count)
|
||||||
@ -585,26 +618,9 @@ output_plain (MuMsgIter *iter, const char *fields, gboolean summary,
|
|||||||
for (myiter = iter, mycount = 0; !mu_msg_iter_is_done (myiter);
|
for (myiter = iter, mycount = 0; !mu_msg_iter_is_done (myiter);
|
||||||
mu_msg_iter_next (myiter), ++mycount) {
|
mu_msg_iter_next (myiter), ++mycount) {
|
||||||
|
|
||||||
const char* myfields;
|
size_t len;
|
||||||
int len;
|
|
||||||
|
|
||||||
if (threads)
|
len = output_plain_fields (iter, fields, color, threads);
|
||||||
indent (myiter);
|
|
||||||
|
|
||||||
for (myfields = fields, len = 0; *myfields; ++myfields) {
|
|
||||||
MuMsgFieldId mfid;
|
|
||||||
mfid = mu_msg_field_id_from_shortcut (*myfields, FALSE);
|
|
||||||
if (mfid == MU_MSG_FIELD_ID_NONE ||
|
|
||||||
(!mu_msg_field_xapian_value (mfid) &&
|
|
||||||
!mu_msg_field_xapian_contact (mfid)))
|
|
||||||
len += printf ("%c", *myfields);
|
|
||||||
else {
|
|
||||||
ansi_color_maybe (mfid, color);
|
|
||||||
len += mu_util_fputs_encoded
|
|
||||||
(display_field (myiter, mfid), stdout);
|
|
||||||
ansi_reset_maybe (mfid, color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_print (len > 0 ? "\n" : "");
|
g_print (len > 0 ? "\n" : "");
|
||||||
if (summary)
|
if (summary)
|
||||||
|
|||||||
40
src/mu-cmd.c
40
src/mu-cmd.c
@ -88,17 +88,37 @@ print_field (const char* field, const char *val, gboolean color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
body_or_summary (MuMsg *msg, gboolean summary, gboolean color)
|
||||||
|
{
|
||||||
|
const char* field;
|
||||||
|
const int SUMMARY_LEN = 5;
|
||||||
|
|
||||||
|
field = mu_msg_get_body_text (msg);
|
||||||
|
if (!field)
|
||||||
|
return; /* no body -- nothing more to do */
|
||||||
|
|
||||||
|
if (summary) {
|
||||||
|
gchar *summ;
|
||||||
|
summ = mu_str_summarize (field, SUMMARY_LEN);
|
||||||
|
print_field ("Summary", summ, color);
|
||||||
|
g_free (summ);
|
||||||
|
} else {
|
||||||
|
color_maybe (MU_COLOR_YELLOW);
|
||||||
|
mu_util_print_encoded ("\n%s\n", field);
|
||||||
|
color_maybe (MU_COLOR_DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* we ignore fields for now */
|
/* we ignore fields for now */
|
||||||
static gboolean
|
static gboolean
|
||||||
view_msg (MuMsg *msg, const gchar *fields, gboolean summary,
|
view_msg (MuMsg *msg, const gchar *fields, gboolean summary,
|
||||||
gboolean color)
|
gboolean color)
|
||||||
{
|
{
|
||||||
const char *field;
|
|
||||||
gchar *attachs;
|
gchar *attachs;
|
||||||
time_t date;
|
time_t date;
|
||||||
const GSList *lst;
|
const GSList *lst;
|
||||||
const int SUMMARY_LEN = 5;
|
|
||||||
|
|
||||||
|
|
||||||
print_field ("From", mu_msg_get_from (msg), color);
|
print_field ("From", mu_msg_get_from (msg), color);
|
||||||
print_field ("To", mu_msg_get_to (msg), color);
|
print_field ("To", mu_msg_get_to (msg), color);
|
||||||
@ -122,19 +142,7 @@ view_msg (MuMsg *msg, const gchar *fields, gboolean summary,
|
|||||||
g_free (attachs);
|
g_free (attachs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(field = mu_msg_get_body_text (msg)))
|
body_or_summary (msg, summary, color);
|
||||||
return TRUE; /* no body -- nothing more to do */
|
|
||||||
|
|
||||||
if (summary) {
|
|
||||||
gchar *summ;
|
|
||||||
summ = mu_str_summarize (field, SUMMARY_LEN);
|
|
||||||
print_field ("Summary", summ, color);
|
|
||||||
g_free (summ);
|
|
||||||
} else {
|
|
||||||
color_maybe (MU_COLOR_YELLOW);
|
|
||||||
mu_util_print_encoded ("\n%s\n", field);
|
|
||||||
color_maybe (MU_COLOR_DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user