struct notmuch_show_params;
typedef struct notmuch_show_format {
- struct sprinter *(*new_sprinter)(const void *ctx, FILE *stream);
+ struct sprinter *(*new_sprinter)(notmuch_database_t * db, FILE *stream);
notmuch_status_t (*part)(const void *ctx, struct sprinter *sprinter,
struct mime_node *node, int indent,
const struct notmuch_show_params *params);
}
struct sprinter *
-sprinter_json_create (const void *ctx, FILE *stream)
+sprinter_json_create (notmuch_database_t *db, FILE *stream)
{
static const struct sprinter_json template = {
.vtable = {
};
struct sprinter_json *res;
- res = talloc (ctx, struct sprinter_json);
+ res = talloc (db, struct sprinter_json);
if (! res)
return NULL;
*res = template;
+ res->vtable.notmuch = db;
res->stream = stream;
return &res->vtable;
}
}
struct sprinter *
-sprinter_sexp_create (const void *ctx, FILE *stream)
+sprinter_sexp_create (notmuch_database_t *db, FILE *stream)
{
static const struct sprinter_sexp template = {
.vtable = {
};
struct sprinter_sexp *res;
- res = talloc (ctx, struct sprinter_sexp);
+ res = talloc (db, struct sprinter_sexp);
if (! res)
return NULL;
*res = template;
+ res->vtable.notmuch = db;
res->stream = stream;
return &res->vtable;
}
}
struct sprinter *
-sprinter_text_create (const void *ctx, FILE *stream)
+sprinter_text_create (notmuch_database_t *db, FILE *stream)
{
static const struct sprinter_text template = {
.vtable = {
};
struct sprinter_text *res;
- res = talloc (ctx, struct sprinter_text);
+ res = talloc (db, struct sprinter_text);
if (! res)
return NULL;
*res = template;
+ res->vtable.notmuch = db;
res->stream = stream;
return &res->vtable;
}
struct sprinter *
-sprinter_text0_create (const void *ctx, FILE *stream)
+sprinter_text0_create (notmuch_database_t *db, FILE *stream)
{
struct sprinter *sp;
- sp = sprinter_text_create (ctx, stream);
+ sp = sprinter_text_create (db, stream);
if (! sp)
return NULL;
* (strings, integers and booleans).
*/
typedef struct sprinter {
+ /*
+ * Open notmuch database
+ */
+ notmuch_database_t *notmuch;
+
/* Start a new map/dictionary structure. This should be followed by
* a sequence of alternating calls to map_key and one of the
* value-printing functions until the map is ended by end.
/* Create a new unstructured printer that emits the default text format
* for "notmuch search". */
struct sprinter *
-sprinter_text_create (const void *ctx, FILE *stream);
+sprinter_text_create (notmuch_database_t *db, FILE *stream);
/* Create a new unstructured printer that emits the text format for
* "notmuch search", with each field separated by a null character
* instead of the newline character. */
struct sprinter *
-sprinter_text0_create (const void *ctx, FILE *stream);
+sprinter_text0_create (notmuch_database_t *db, FILE *stream);
/* Create a new structure printer that emits JSON. */
struct sprinter *
-sprinter_json_create (const void *ctx, FILE *stream);
+sprinter_json_create (notmuch_database_t *db, FILE *stream);
/* Create a new structure printer that emits S-Expressions. */
struct sprinter *
-sprinter_sexp_create (const void *ctx, FILE *stream);
+sprinter_sexp_create (notmuch_database_t *db, FILE *stream);
#endif // NOTMUCH_SPRINTER_H