NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_pgp.c File Reference

PGP Key Selection Dialog. More...

#include "config.h"
#include <ctype.h>
#include <locale.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "private.h"
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "format_flags.h"
#include "mutt_logging.h"
#include "muttlib.h"
#include "pgp.h"
#include "pgp_functions.h"
#include "pgpkey.h"
#include "pgplib.h"
#include "sort.h"
+ Include dependency graph for dlg_pgp.c:

Go to the source code of this file.

Functions

static int pgp_sort_address (const void *a, const void *b, void *sdata)
 Compare two keys by their addresses - Implements sort_t -.
 
static int pgp_sort_date (const void *a, const void *b, void *sdata)
 Compare two keys by their dates - Implements sort_t -.
 
static int pgp_sort_keyid (const void *a, const void *b, void *sdata)
 Compare two keys by their IDs - Implements sort_t -.
 
static int pgp_sort_trust (const void *a, const void *b, void *sdata)
 Compare two keys by their trust levels - Implements sort_t -.
 
static char * pgp_key_abilities (KeyFlags flags)
 Turn PGP key abilities into a string.
 
static char pgp_flags (KeyFlags flags)
 Turn PGP key flags into a string.
 
static const char * pgp_entry_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
 Format an entry on the PGP key selection menu - Implements format_t -.
 
static void pgp_make_entry (struct Menu *menu, char *buf, size_t buflen, int line)
 Format a PGP Key for the Menu - Implements Menu::make_entry() -.
 
static void pgp_key_table_free (struct Menu *menu, void **ptr)
 Free the key table - Implements Menu::mdata_free() -.
 
static int pgp_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int pgp_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
struct PgpKeyInfodlg_pgp (struct PgpKeyInfo *keys, struct Address *p, const char *s)
 Let the user select a key to use -.
 

Variables

static const struct Mapping PgpHelp []
 Help Bar for the PGP key selection dialog.
 
static const char TrustFlags [] = "?- +"
 Characters used to show the trust level for PGP keys.
 

Detailed Description

PGP Key Selection Dialog.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file dlg_pgp.c.

Function Documentation

◆ pgp_key_abilities()

static char * pgp_key_abilities ( KeyFlags  flags)
static

Turn PGP key abilities into a string.

Parameters
flagsFlags, see KeyFlags
Return values
ptrAbilities string
Note
This returns a pointer to a static buffer

Definition at line 209 of file dlg_pgp.c.

210{
211 static char buf[3];
212
213 if (!(flags & KEYFLAG_CANENCRYPT))
214 buf[0] = '-';
215 else if (flags & KEYFLAG_PREFER_SIGNING)
216 buf[0] = '.';
217 else
218 buf[0] = 'e';
219
220 if (!(flags & KEYFLAG_CANSIGN))
221 buf[1] = '-';
222 else if (flags & KEYFLAG_PREFER_ENCRYPTION)
223 buf[1] = '.';
224 else
225 buf[1] = 's';
226
227 buf[2] = '\0';
228
229 return buf;
230}
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
Definition: lib.h:129
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
Definition: lib.h:138
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
Definition: lib.h:137
#define KEYFLAG_CANSIGN
Key is suitable for signing.
Definition: lib.h:128
+ Here is the caller graph for this function:

◆ pgp_flags()

static char pgp_flags ( KeyFlags  flags)
static

Turn PGP key flags into a string.

Parameters
flagsFlags, see KeyFlags
Return values
charFlag character

Definition at line 237 of file dlg_pgp.c.

238{
239 if (flags & KEYFLAG_REVOKED)
240 return 'R';
241 if (flags & KEYFLAG_EXPIRED)
242 return 'X';
243 if (flags & KEYFLAG_DISABLED)
244 return 'd';
245 if (flags & KEYFLAG_CRITICAL)
246 return 'c';
247
248 return ' ';
249}
#define KEYFLAG_EXPIRED
Key is expired.
Definition: lib.h:132
#define KEYFLAG_CRITICAL
Key is marked critical.
Definition: lib.h:136
#define KEYFLAG_DISABLED
Key is marked disabled.
Definition: lib.h:134
#define KEYFLAG_REVOKED
Key is revoked.
Definition: lib.h:133
+ Here is the caller graph for this function:

Variable Documentation

◆ PgpHelp

const struct Mapping PgpHelp[]
static
Initial value:
= {
{ N_("Exit"), OP_EXIT },
{ N_("Select"), OP_GENERIC_SELECT_ENTRY },
{ N_("Check key"), OP_VERIFY_KEY },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}
#define N_(a)
Definition: message.h:32

Help Bar for the PGP key selection dialog.

Definition at line 93 of file dlg_pgp.c.

◆ TrustFlags

const char TrustFlags[] = "?- +"
static

Characters used to show the trust level for PGP keys.

Definition at line 104 of file dlg_pgp.c.