NeoMutt  2024-12-12-14-g7b49f7
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 316 of file pgpinvoke.c.

317{
318 struct Buffer *personal = NULL;
319 struct PgpCommandContext cctx = { 0 };
320
321 const struct Expando *c_pgp_get_keys_command = cs_subset_expando(NeoMutt->sub, "pgp_get_keys_command");
322 if (!c_pgp_get_keys_command)
323 return;
324
325 struct Buffer *buf = buf_pool_get();
326 struct Buffer *cmd = buf_pool_get();
327 personal = addr->personal;
328 addr->personal = NULL;
329
330 struct Buffer *tmp = buf_pool_get();
331 mutt_addr_to_local(addr);
332 mutt_addr_write(tmp, addr, false);
333 buf_quote_filename(buf, buf_string(tmp), true);
334 buf_pool_release(&tmp);
335
336 addr->personal = personal;
337
338 cctx.ids = buf_string(buf);
339
340 mutt_pgp_command(cmd, &cctx, c_pgp_get_keys_command);
341
342 int fd_null = open("/dev/null", O_RDWR);
343
344 if (!isendwin())
345 mutt_message(_("Fetching PGP key..."));
346
347 if (mutt_system(buf_string(cmd)) != 0)
348 mutt_debug(LL_DEBUG1, "Error running \"%s\"\n", buf_string(cmd));
349
350 if (!isendwin())
352
353 if (fd_null >= 0)
354 close(fd_null);
355
356 buf_pool_release(&buf);
357 buf_pool_release(&cmd);
358}
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:61
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: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: