NeoMutt  2024-10-02-37-gfa9146
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 383 of file pgpinvoke.c.

384{
385 struct Buffer *personal = NULL;
386 struct PgpCommandContext cctx = { 0 };
387
388 const struct Expando *c_pgp_get_keys_command = cs_subset_expando(NeoMutt->sub, "pgp_get_keys_command");
389 if (!c_pgp_get_keys_command)
390 return;
391
392 struct Buffer *buf = buf_pool_get();
393 struct Buffer *cmd = buf_pool_get();
394 personal = addr->personal;
395 addr->personal = NULL;
396
397 struct Buffer *tmp = buf_pool_get();
398 mutt_addr_to_local(addr);
399 mutt_addr_write(tmp, addr, false);
400 buf_quote_filename(buf, buf_string(tmp), true);
401 buf_pool_release(&tmp);
402
403 addr->personal = personal;
404
405 cctx.ids = buf_string(buf);
406
407 mutt_pgp_command(cmd, &cctx, c_pgp_get_keys_command);
408
409 int fd_null = open("/dev/null", O_RDWR);
410
411 if (!isendwin())
412 mutt_message(_("Fetching PGP key..."));
413
414 if (mutt_system(buf_string(cmd)) != 0)
415 mutt_debug(LL_DEBUG1, "Error running \"%s\"\n", buf_string(cmd));
416
417 if (!isendwin())
419
420 if (fd_null >= 0)
421 close(fd_null);
422
423 buf_pool_release(&buf);
424 buf_pool_release(&cmd);
425}
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:357
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:933
#define mutt_message(...)
Definition: logging2.h:91
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
#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:122
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
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:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
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: