NeoMutt  2024-11-14-138-ge5ca67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
expando_command.c
Go to the documentation of this file.
1
29#include <stdbool.h>
30#include <stdio.h>
31#include "mutt/lib.h"
32#include "expando_command.h"
33#include "expando/lib.h"
34#include "pgp.h"
35
39static void pgp_command_file_message(const struct ExpandoNode *node, void *data,
40 MuttFormatFlags flags, struct Buffer *buf)
41{
42 const struct PgpCommandContext *cctx = data;
43
44 const char *s = cctx->fname;
45 buf_strcpy(buf, s);
46}
47
51static void pgp_command_file_signature(const struct ExpandoNode *node, void *data,
52 MuttFormatFlags flags, struct Buffer *buf)
53{
54 const struct PgpCommandContext *cctx = data;
55
56 const char *s = cctx->sig_fname;
57 buf_strcpy(buf, s);
58}
59
63static void pgp_command_key_ids(const struct ExpandoNode *node, void *data,
64 MuttFormatFlags flags, struct Buffer *buf)
65{
66 const struct PgpCommandContext *cctx = data;
67
68 const char *s = cctx->ids;
69 buf_strcpy(buf, s);
70}
71
75static void pgp_command_need_pass(const struct ExpandoNode *node, void *data,
76 MuttFormatFlags flags, struct Buffer *buf)
77{
78 const struct PgpCommandContext *cctx = data;
79
80 const char *s = cctx->need_passphrase ? "PGPPASSFD=0" : "";
81 buf_strcpy(buf, s);
82}
83
87static void pgp_command_sign_as(const struct ExpandoNode *node, void *data,
88 MuttFormatFlags flags, struct Buffer *buf)
89{
90 const struct PgpCommandContext *cctx = data;
91
92 const char *s = cctx->signas;
93 buf_strcpy(buf, s);
94}
95
102 // clang-format off
108 { -1, -1, NULL, NULL },
109 // clang-format on
110};
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:395
@ ED_PGP_CMD
Pgp Command ED_PGC_ ExpandoDataPgpCmd.
Definition: domain.h:52
Parse Expando string.
const struct ExpandoRenderCallback PgpCommandRenderCallbacks[]
Callbacks for PGP Command Expandos.
Ncrypt PGP Expando definitions.
static void pgp_command_file_message(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: Filename of message - Implements get_string_t -.
static void pgp_command_need_pass(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: PGPPASSFD=0 if passphrase is needed - Implements get_string_t -.
static void pgp_command_file_signature(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: Filename of signature - Implements get_string_t -.
static void pgp_command_sign_as(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: $pgp_sign_as or $pgp_default_key - Implements get_string_t -.
static void pgp_command_key_ids(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
PGP Command: key IDs - Implements get_string_t -.
Convenience wrapper for the library headers.
PGP sign, encrypt, check routines.
@ ED_PGC_KEY_IDS
PgpCommandContext.ids.
Definition: pgp.h:60
@ ED_PGC_FILE_SIGNATURE
PgpCommandContext.sig_fname.
Definition: pgp.h:59
@ ED_PGC_NEED_PASS
PgpCommandContext.need_passphrase.
Definition: pgp.h:61
@ ED_PGC_SIGN_AS
PgpCommandContext.signas.
Definition: pgp.h:62
@ ED_PGC_FILE_MESSAGE
PgpCommandContext.fname.
Definition: pgp.h:58
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: render.h:32
String manipulation buffer.
Definition: buffer.h:36
Basic Expando Node.
Definition: node.h:67
Data for a PGP command.
Definition: pgp.h:43
bool need_passphrase
p
Definition: pgp.h:44
const char * signas
a
Definition: pgp.h:47
const char * fname
f
Definition: pgp.h:45
const char * ids
r
Definition: pgp.h:48
const char * sig_fname
s
Definition: pgp.h:46