NeoMutt  2025-01-09-117-gace867
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
pgp_invoke_getkeys()

Run a command to download a PGP key. More...

+ Collaboration diagram for pgp_invoke_getkeys():

Functions

void pgp_class_invoke_getkeys (struct Address *addr)
 Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -.
 

Detailed Description

Run a command to download a PGP key.

Parameters
addrAddress to search for

Function Documentation

◆ pgp_class_invoke_getkeys()

void pgp_class_invoke_getkeys ( struct Address addr)

Run a command to download a PGP key - Implements CryptModuleSpecs::pgp_invoke_getkeys() -.

Definition at line 315 of file pgpinvoke.c.

316{
317 struct Buffer *personal = NULL;
318 struct PgpCommandContext cctx = { 0 };
319
320 const struct Expando *c_pgp_get_keys_command = cs_subset_expando(NeoMutt->sub, "pgp_get_keys_command");
321 if (!c_pgp_get_keys_command)
322 return;
323
324 struct Buffer *buf = buf_pool_get();
325 struct Buffer *cmd = buf_pool_get();
326 personal = addr->personal;
327 addr->personal = NULL;
328
329 struct Buffer *tmp = buf_pool_get();
330 mutt_addr_to_local(addr);
331 mutt_addr_write(tmp, addr, false);
332 buf_quote_filename(buf, buf_string(tmp), true);
333 buf_pool_release(&tmp);
334
335 addr->personal = personal;
336
337 cctx.ids = buf_string(buf);
338
339 mutt_pgp_command(cmd, &cctx, c_pgp_get_keys_command);
340
341 int fd_null = open("/dev/null", O_RDWR);
342
343 if (!isendwin())
344 mutt_message(_("Fetching PGP key..."));
345
346 if (mutt_system(buf_string(cmd)) != 0)
347 mutt_debug(LL_DEBUG1, "Error running \"%s\"\n", buf_string(cmd));
348
349 if (!isendwin())
351
352 if (fd_null >= 0)
353 close(fd_null);
354
355 buf_pool_release(&buf);
356 buf_pool_release(&cmd);
357}
size_t mutt_addr_write(struct Buffer *buf, struct Address *addr, bool display)
Write a single Address to a buffer.
Definition: address.c:1050
bool mutt_addr_to_local(struct Address *a)
Convert an Address from Punycode.
Definition: address.c:1340
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Definition: config_type.c:361
void buf_quote_filename(struct Buffer *buf, const char *filename, bool add_outer)
Quote a filename to survive the shell's quoting rules.
Definition: file.c:810
#define mutt_message(...)
Definition: logging2.h:92
#define mutt_debug(LEVEL,...)
Definition: logging2.h:90
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:44
#define _(a)
Definition: message.h:28
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
static void mutt_pgp_command(struct Buffer *buf, struct PgpCommandContext *cctx, const struct Expando *exp)
Prepare a PGP Command.
Definition: pgpinvoke.c:60
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:82
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:96
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:52
struct Buffer * personal
Real name of address.
Definition: address.h:37
String manipulation buffer.
Definition: buffer.h:36
Parsed Expando trees.
Definition: expando.h:41
Container for Accounts, Notifications.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:47
Data for a PGP command.
Definition: pgp.h:43
const char * ids
r
Definition: pgp.h:48
+ Here is the call graph for this function:
+ Here is the caller graph for this function: