summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
14883b0)
This associates an sprinter constructor with each show format and uses
this to construct the appropriate sprinter. Currently nothing is done
with this sprinter, but the following patches will weave it through
the layers of notmuch show.
struct notmuch_show_params;
typedef struct notmuch_show_format {
struct notmuch_show_params;
typedef struct notmuch_show_format {
+ struct sprinter *(*new_sprinter) (const void *ctx, FILE *stream);
const char *message_set_start;
notmuch_status_t (*part) (const void *ctx,
struct mime_node *node, int indent,
const char *message_set_start;
notmuch_status_t (*part) (const void *ctx,
struct mime_node *node, int indent,
#include "notmuch-client.h"
#include "gmime-filter-reply.h"
#include "notmuch-client.h"
#include "gmime-filter-reply.h"
static notmuch_status_t
format_part_text (const void *ctx, mime_node_t *node,
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_text = {
static notmuch_status_t
format_part_text (const void *ctx, mime_node_t *node,
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_text = {
+ .new_sprinter = sprinter_text_create,
.part = format_part_text,
};
.part = format_part_text,
};
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_json = {
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_json = {
+ .new_sprinter = sprinter_json_create,
.message_set_start = "[",
.part = format_part_json_entry,
.message_set_sep = ", ",
.message_set_start = "[",
.part = format_part_json_entry,
.message_set_sep = ", ",
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_mbox = {
int indent, const notmuch_show_params_t *params);
static const notmuch_show_format_t format_mbox = {
+ .new_sprinter = sprinter_text_create,
.part = format_part_mbox,
};
.part = format_part_mbox,
};
unused (const notmuch_show_params_t *params));
static const notmuch_show_format_t format_raw = {
unused (const notmuch_show_params_t *params));
static const notmuch_show_format_t format_raw = {
+ .new_sprinter = sprinter_text_create,
.part = format_part_raw,
};
.part = format_part_raw,
};
char *query_string;
int opt_index, ret;
const notmuch_show_format_t *format = &format_text;
char *query_string;
int opt_index, ret;
const notmuch_show_format_t *format = &format_text;
notmuch_show_params_t params = {
.part = -1,
.omit_excluded = TRUE,
notmuch_show_params_t params = {
.part = -1,
.omit_excluded = TRUE,
+ /* Create structure printer. */
+ sprinter = format->new_sprinter(ctx, stdout);
+
/* If a single message is requested we do not use search_excludes. */
if (params.part >= 0)
ret = do_show_single (ctx, query, format, ¶ms);
/* If a single message is requested we do not use search_excludes. */
if (params.part >= 0)
ret = do_show_single (ctx, query, format, ¶ms);