All formats except Json can output empty messages for non
entire-thread, but in Json format we output "null" to keep the other
elements (e.g. the replies to the omitted message) in the correct
place.
const struct notmuch_show_params *params);
const char *message_set_sep;
const char *message_set_end;
const struct notmuch_show_params *params);
const char *message_set_sep;
const char *message_set_end;
+ const char *null_message;
} notmuch_show_format_t;
typedef struct notmuch_crypto {
} notmuch_show_format_t;
typedef struct notmuch_crypto {
.message_set_start = "[",
.part = format_part_json_entry,
.message_set_sep = ", ",
.message_set_start = "[",
.part = format_part_json_entry,
.message_set_sep = ", ",
+ .message_set_end = "]",
+ .null_message = "null"
};
static notmuch_status_t
};
static notmuch_status_t
return NOTMUCH_STATUS_SUCCESS;
}
return NOTMUCH_STATUS_SUCCESS;
}
+static notmuch_status_t
+show_null_message (const notmuch_show_format_t *format)
+{
+ /* Output a null message. Currently empty for all formats except Json */
+ if (format->null_message)
+ printf ("%s", format->null_message);
+ return NOTMUCH_STATUS_SUCCESS;
+}
+
static notmuch_status_t
show_message (void *ctx,
const notmuch_show_format_t *format,
static notmuch_status_t
show_message (void *ctx,
const notmuch_show_format_t *format,
if (status && !res)
res = status;
next_indent = indent + 1;
if (status && !res)
res = status;
next_indent = indent + 1;
-
- if (!status && format->message_set_sep)
- fputs (format->message_set_sep, stdout);
+ } else {
+ status = show_null_message (format);
+ if (!status && format->message_set_sep)
+ fputs (format->message_set_sep, stdout);
+
status = show_messages (ctx,
format,
notmuch_message_get_replies (message),
status = show_messages (ctx,
format,
notmuch_message_get_replies (message),