NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_gpgme.c File Reference

GPGME Key Selection Dialog. More...

#include "config.h"
#include <ctype.h>
#include <gpgme.h>
#include <locale.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <time.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 "crypt_gpgme.h"
#include "format_flags.h"
#include "gpgme_functions.h"
#include "mutt_logging.h"
#include "muttlib.h"
#include "sort.h"
+ Include dependency graph for dlg_gpgme.c:

Go to the source code of this file.

Data Structures

struct  CryptEntry
 An entry in the Select-Key menu. More...
 

Functions

static int crypt_sort_address (const void *a, const void *b, void *sdata)
 Compare two keys by their addresses - Implements sort_t -.
 
static int crypt_sort_keyid (const void *a, const void *b, void *sdata)
 Compare two keys by their IDs - Implements sort_t -.
 
static int crypt_sort_date (const void *a, const void *b, void *sdata)
 Compare two keys by their dates - Implements sort_t -.
 
static int crypt_sort_trust (const void *a, const void *b, void *sdata)
 Compare two keys by their trust levels - Implements sort_t -.
 
static char * crypt_key_abilities (KeyFlags flags)
 Parse key flags into a string.
 
static char crypt_flags (KeyFlags flags)
 Parse the key flags into a single character.
 
static const char * crypt_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 a string for the key selection menu - Implements format_t -.
 
static void crypt_make_entry (struct Menu *menu, char *buf, size_t buflen, int line)
 Format a menu item for the key selection list - Implements Menu::make_entry() -.
 
static void gpgme_key_table_free (struct Menu *menu, void **ptr)
 Free the key table - Implements Menu::mdata_free() -.
 
static int gpgme_key_config_observer (struct NotifyCallback *nc)
 Notification that a Config Variable has changed - Implements observer_t -.
 
static int gpgme_key_window_observer (struct NotifyCallback *nc)
 Notification that a Window has changed - Implements observer_t -.
 
struct CryptKeyInfodlg_gpgme (struct CryptKeyInfo *keys, struct Address *p, const char *s, unsigned int app, bool *forced_valid)
 Get the user to select a key -.
 

Variables

static const struct Mapping GpgmeHelp []
 Help Bar for the GPGME key selection dialog.
 

Detailed Description

GPGME 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_gpgme.c.

Function Documentation

◆ crypt_key_abilities()

static char * crypt_key_abilities ( KeyFlags  flags)
static

Parse key flags into a string.

Parameters
flagsFlags, see KeyFlags
Return values
ptrFlag string
Note
The string is statically allocated.

Definition at line 248 of file dlg_gpgme.c.

249{
250 static char buf[3];
251
252 if (!(flags & KEYFLAG_CANENCRYPT))
253 buf[0] = '-';
254 else if (flags & KEYFLAG_PREFER_SIGNING)
255 buf[0] = '.';
256 else
257 buf[0] = 'e';
258
259 if (!(flags & KEYFLAG_CANSIGN))
260 buf[1] = '-';
261 else if (flags & KEYFLAG_PREFER_ENCRYPTION)
262 buf[1] = '.';
263 else
264 buf[1] = 's';
265
266 buf[2] = '\0';
267
268 return buf;
269}
#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:

◆ crypt_flags()

static char crypt_flags ( KeyFlags  flags)
static

Parse the key flags into a single character.

Parameters
flagsFlags, see KeyFlags
Return values
charFlag character

The returned character describes the most important flag.

Definition at line 278 of file dlg_gpgme.c.

279{
280 if (flags & KEYFLAG_REVOKED)
281 return 'R';
282 if (flags & KEYFLAG_EXPIRED)
283 return 'X';
284 if (flags & KEYFLAG_DISABLED)
285 return 'd';
286 if (flags & KEYFLAG_CRITICAL)
287 return 'c';
288
289 return ' ';
290}
#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

◆ GpgmeHelp

const struct Mapping GpgmeHelp[]
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 GPGME key selection dialog.

Definition at line 93 of file dlg_gpgme.c.