mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-24 11:58:10 +01:00
cli: use notmuch_bool_t for boolean fields in notmuch_show_params_t
Use notmuch_bool_t instead of int for entire_thread, raw, and decrypt boolean fields in notmuch_show_params_t. No functional changes. Signed-off-by: Jani Nikula <jani@nikula.org>
This commit is contained in:
parent
c0cd090412
commit
c9c5a6f70c
3 changed files with 13 additions and 14 deletions
|
@ -98,15 +98,15 @@ typedef struct notmuch_show_format {
|
||||||
} notmuch_show_format_t;
|
} notmuch_show_format_t;
|
||||||
|
|
||||||
typedef struct notmuch_show_params {
|
typedef struct notmuch_show_params {
|
||||||
int entire_thread;
|
notmuch_bool_t entire_thread;
|
||||||
int raw;
|
notmuch_bool_t raw;
|
||||||
int part;
|
int part;
|
||||||
#ifdef GMIME_ATLEAST_26
|
#ifdef GMIME_ATLEAST_26
|
||||||
GMimeCryptoContext* cryptoctx;
|
GMimeCryptoContext* cryptoctx;
|
||||||
#else
|
#else
|
||||||
GMimeCipherContext* cryptoctx;
|
GMimeCipherContext* cryptoctx;
|
||||||
#endif
|
#endif
|
||||||
int decrypt;
|
notmuch_bool_t decrypt;
|
||||||
} notmuch_show_params_t;
|
} notmuch_show_params_t;
|
||||||
|
|
||||||
/* There's no point in continuing when we've detected that we've done
|
/* There's no point in continuing when we've detected that we've done
|
||||||
|
|
|
@ -661,7 +661,6 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
||||||
notmuch_show_params_t params = { .part = -1 };
|
notmuch_show_params_t params = { .part = -1 };
|
||||||
int format = FORMAT_DEFAULT;
|
int format = FORMAT_DEFAULT;
|
||||||
int reply_all = TRUE;
|
int reply_all = TRUE;
|
||||||
notmuch_bool_t decrypt = FALSE;
|
|
||||||
|
|
||||||
notmuch_opt_desc_t options[] = {
|
notmuch_opt_desc_t options[] = {
|
||||||
{ NOTMUCH_OPT_KEYWORD, &format, "format", 'f',
|
{ NOTMUCH_OPT_KEYWORD, &format, "format", 'f',
|
||||||
|
@ -672,7 +671,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
||||||
(notmuch_keyword_t []){ { "all", TRUE },
|
(notmuch_keyword_t []){ { "all", TRUE },
|
||||||
{ "sender", FALSE },
|
{ "sender", FALSE },
|
||||||
{ 0, 0 } } },
|
{ 0, 0 } } },
|
||||||
{ NOTMUCH_OPT_BOOLEAN, &decrypt, "decrypt", 'd', 0 },
|
{ NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },
|
||||||
{ 0, 0, 0, 0, 0 }
|
{ 0, 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -687,7 +686,7 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
||||||
else
|
else
|
||||||
reply_format_func = notmuch_reply_format_default;
|
reply_format_func = notmuch_reply_format_default;
|
||||||
|
|
||||||
if (decrypt) {
|
if (params.decrypt) {
|
||||||
#ifdef GMIME_ATLEAST_26
|
#ifdef GMIME_ATLEAST_26
|
||||||
/* TODO: GMimePasswordRequestFunc */
|
/* TODO: GMimePasswordRequestFunc */
|
||||||
params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");
|
params.cryptoctx = g_mime_gpg_context_new (NULL, "gpg");
|
||||||
|
@ -697,8 +696,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
if (params.cryptoctx) {
|
if (params.cryptoctx) {
|
||||||
g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);
|
g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) params.cryptoctx, FALSE);
|
||||||
params.decrypt = TRUE;
|
|
||||||
} else {
|
} else {
|
||||||
|
params.decrypt = FALSE;
|
||||||
fprintf (stderr, "Failed to construct gpg context.\n");
|
fprintf (stderr, "Failed to construct gpg context.\n");
|
||||||
}
|
}
|
||||||
#ifndef GMIME_ATLEAST_26
|
#ifndef GMIME_ATLEAST_26
|
||||||
|
|
|
@ -1028,11 +1028,11 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
int format_specified = 0;
|
int format_specified = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
params.entire_thread = 0;
|
params.entire_thread = FALSE;
|
||||||
params.raw = 0;
|
params.raw = FALSE;
|
||||||
params.part = -1;
|
params.part = -1;
|
||||||
params.cryptoctx = NULL;
|
params.cryptoctx = NULL;
|
||||||
params.decrypt = 0;
|
params.decrypt = FALSE;
|
||||||
|
|
||||||
argc--; argv++; /* skip subcommand argument */
|
argc--; argv++; /* skip subcommand argument */
|
||||||
|
|
||||||
|
@ -1047,13 +1047,13 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
format = &format_text;
|
format = &format_text;
|
||||||
} else if (strcmp (opt, "json") == 0) {
|
} else if (strcmp (opt, "json") == 0) {
|
||||||
format = &format_json;
|
format = &format_json;
|
||||||
params.entire_thread = 1;
|
params.entire_thread = TRUE;
|
||||||
} else if (strcmp (opt, "mbox") == 0) {
|
} else if (strcmp (opt, "mbox") == 0) {
|
||||||
format = &format_mbox;
|
format = &format_mbox;
|
||||||
mbox = 1;
|
mbox = 1;
|
||||||
} else if (strcmp (opt, "raw") == 0) {
|
} else if (strcmp (opt, "raw") == 0) {
|
||||||
format = &format_raw;
|
format = &format_raw;
|
||||||
params.raw = 1;
|
params.raw = TRUE;
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Invalid value for --format: %s\n", opt);
|
fprintf (stderr, "Invalid value for --format: %s\n", opt);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1062,7 +1062,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
} else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {
|
} else if (STRNCMP_LITERAL (argv[i], "--part=") == 0) {
|
||||||
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
|
params.part = atoi(argv[i] + sizeof ("--part=") - 1);
|
||||||
} else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {
|
} else if (STRNCMP_LITERAL (argv[i], "--entire-thread") == 0) {
|
||||||
params.entire_thread = 1;
|
params.entire_thread = TRUE;
|
||||||
} else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||
|
} else if ((STRNCMP_LITERAL (argv[i], "--verify") == 0) ||
|
||||||
(STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {
|
(STRNCMP_LITERAL (argv[i], "--decrypt") == 0)) {
|
||||||
if (params.cryptoctx == NULL) {
|
if (params.cryptoctx == NULL) {
|
||||||
|
@ -1082,7 +1082,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)
|
if (STRNCMP_LITERAL (argv[i], "--decrypt") == 0)
|
||||||
params.decrypt = 1;
|
params.decrypt = TRUE;
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
|
fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue