NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
expando_command.c
Go to the documentation of this file.
1
22
28
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
39
static
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
51
static
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
63
static
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
75
static
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
87
static
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
101
const
struct
ExpandoRenderCallback
PgpCommandRenderCallbacks
[] = {
102
// clang-format off
103
{
ED_PGP_CMD
,
ED_PGC_FILE_MESSAGE
,
pgp_command_file_message
, NULL },
104
{
ED_PGP_CMD
,
ED_PGC_FILE_SIGNATURE
,
pgp_command_file_signature
, NULL },
105
{
ED_PGP_CMD
,
ED_PGC_KEY_IDS
,
pgp_command_key_ids
, NULL },
106
{
ED_PGP_CMD
,
ED_PGC_NEED_PASS
,
pgp_command_need_pass
, NULL },
107
{
ED_PGP_CMD
,
ED_PGC_SIGN_AS
,
pgp_command_sign_as
, NULL },
108
{ -1, -1, NULL, NULL },
109
// clang-format on
110
};
buf_strcpy
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition
buffer.c:401
ED_PGP_CMD
@ ED_PGP_CMD
Pgp Command ED_PGC_ ExpandoDataPgpCmd.
Definition
domain.h:53
lib.h
Parse Expando string.
PgpCommandRenderCallbacks
const struct ExpandoRenderCallback PgpCommandRenderCallbacks[]
Callbacks for PGP Command Expandos.
Definition
expando_command.c:101
expando_command.h
Ncrypt PGP Expando definitions.
pgp_command_file_message
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 -.
Definition
expando_command.c:39
pgp_command_need_pass
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 -.
Definition
expando_command.c:75
pgp_command_file_signature
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 -.
Definition
expando_command.c:51
pgp_command_sign_as
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 -.
Definition
expando_command.c:87
pgp_command_key_ids
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 -.
Definition
expando_command.c:63
lib.h
Convenience wrapper for the library headers.
pgp.h
PGP sign, encrypt, check routines.
ED_PGC_KEY_IDS
@ ED_PGC_KEY_IDS
PgpCommandContext.ids.
Definition
pgp.h:60
ED_PGC_FILE_SIGNATURE
@ ED_PGC_FILE_SIGNATURE
PgpCommandContext.sig_fname.
Definition
pgp.h:59
ED_PGC_NEED_PASS
@ ED_PGC_NEED_PASS
PgpCommandContext.need_passphrase.
Definition
pgp.h:61
ED_PGC_SIGN_AS
@ ED_PGC_SIGN_AS
PgpCommandContext.signas.
Definition
pgp.h:62
ED_PGC_FILE_MESSAGE
@ ED_PGC_FILE_MESSAGE
PgpCommandContext.fname.
Definition
pgp.h:58
MuttFormatFlags
uint8_t MuttFormatFlags
Definition
render.h:45
Buffer
String manipulation buffer.
Definition
buffer.h:36
ExpandoNode
Basic Expando Node.
Definition
node.h:67
ExpandoRenderCallback
Definition
render.h:82
PgpCommandContext
Data for a PGP command.
Definition
pgp.h:43
PgpCommandContext::need_passphrase
bool need_passphrase
p
Definition
pgp.h:44
PgpCommandContext::signas
const char * signas
a
Definition
pgp.h:47
PgpCommandContext::fname
const char * fname
f
Definition
pgp.h:45
PgpCommandContext::ids
const char * ids
r
Definition
pgp.h:48
PgpCommandContext::sig_fname
const char * sig_fname
s
Definition
pgp.h:46