NeoMutt  2024-12-12-14-g7b49f7
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_verifycert.c File Reference

Certificate Verification Dialog. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "mutt/lib.h"
#include "gui/lib.h"
#include "color/lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "ssl.h"
+ Include dependency graph for dlg_verifycert.c:

Go to the source code of this file.

Functions

static int menu_dialog_dokey (struct Menu *menu, int *id)
 Check if there are any menu key events to process.
 
static int menu_dialog_translate_op (int op)
 Convert menubar movement to scrolling.
 
static int cert_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Create a Certificate for the Menu - Implements Menu::make_entry() -.
 
void cert_array_clear (struct CertArray *carr)
 Free all memory of a CertArray.
 
int dlg_certificate (const char *title, struct CertArray *carr, bool allow_always, bool allow_skip)
 Ask the user to validate the certificate -.
 

Variables

static const struct Mapping VerifyHelp []
 Help Bar for the Certificate Verification dialog.
 

Detailed Description

Certificate Verification Dialog.

Authors
  • Richard Russon
  • Pietro Cerutti

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_verifycert.c.

Function Documentation

◆ menu_dialog_dokey()

static int menu_dialog_dokey ( struct Menu menu,
int *  id 
)
static

Check if there are any menu key events to process.

Parameters
menuCurrent Menu
idKeyEvent ID
Return values
0An event occurred for the menu, or a timeout
-1There was an event, but not for menu

Definition at line 81 of file dlg_verifycert.c.

82{
84
85 if ((event.op == OP_TIMEOUT) || (event.op == OP_ABORT))
86 {
87 *id = event.op;
88 return 0;
89 }
90
91 struct CertMenuData *mdata = menu->mdata;
92 char *p = NULL;
93 if ((event.ch != 0) && (p = strchr(mdata->keys, event.ch)))
94 {
95 *id = OP_MAX + (p - mdata->keys + 1);
96 return 0;
97 }
98
99 if (event.op == OP_NULL)
100 mutt_unget_ch(event.ch);
101 else
102 mutt_unget_op(event.op);
103 return -1;
104}
struct KeyEvent mutt_getch(GetChFlags flags)
Read a character from the input buffer.
Definition: get.c:210
void mutt_unget_op(int op)
Return an operation to the input buffer.
Definition: get.c:126
void mutt_unget_ch(int ch)
Return a keystroke to the input buffer.
Definition: get.c:115
#define GETCH_IGNORE_MACRO
Don't use MacroEvents.
Definition: lib.h:52
#define OP_TIMEOUT
1 second with no events
Definition: opcodes.h:36
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition: opcodes.h:37
@ OP_MAX
Definition: opcodes.h:1006
Certificate data to use in the Menu.
Definition: ssl.h:42
char * keys
Keys used in the prompt.
Definition: ssl.h:45
An event such as a keypress.
Definition: lib.h:81
int op
Function opcode, e.g. OP_HELP.
Definition: lib.h:83
int ch
Raw key pressed.
Definition: lib.h:82
void * mdata
Private data.
Definition: lib.h:147
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ menu_dialog_translate_op()

static int menu_dialog_translate_op ( int  op)
static

Convert menubar movement to scrolling.

Parameters
opAction requested, e.g. OP_NEXT_ENTRY
Return values
numAction to perform, e.g. OP_NEXT_LINE

Definition at line 111 of file dlg_verifycert.c.

112{
113 switch (op)
114 {
115 case OP_NEXT_ENTRY:
116 return OP_NEXT_LINE;
117 case OP_PREV_ENTRY:
118 return OP_PREV_LINE;
119 case OP_CURRENT_TOP:
120 return OP_TOP_PAGE;
121 case OP_CURRENT_BOTTOM:
122 return OP_BOTTOM_PAGE;
123 case OP_CURRENT_MIDDLE:
124 return OP_MIDDLE_PAGE;
125 }
126
127 return op;
128}
+ Here is the caller graph for this function:

◆ cert_array_clear()

void cert_array_clear ( struct CertArray *  carr)

Free all memory of a CertArray.

Parameters
carrArray of text to clear
Note
Array is emptied, but not freed

Definition at line 157 of file dlg_verifycert.c.

158{
159 const char **line = NULL;
160 ARRAY_FOREACH(line, carr)
161 {
162 FREE(line);
163 }
164}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:212
#define FREE(x)
Definition: memory.h:55
+ Here is the caller graph for this function:

Variable Documentation

◆ VerifyHelp

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

Help Bar for the Certificate Verification dialog.

Definition at line 66 of file dlg_verifycert.c.