NeoMutt  2023-11-03-85-g512e01
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
GUI: Dialog Windows

A Dialog is an interactive set of windows allowing the user to perform some task. More...

Functions

static bool dlg_alias (struct Buffer *buf, struct AliasMenuData *mdata)
 Display a menu of Aliases -.
 
static bool dlg_query (struct Buffer *buf, struct AliasMenuData *mdata)
 Get the user to enter an Address Query -.
 
void dlg_attachment (struct ConfigSubset *sub, struct MailboxView *mv, struct Email *e, FILE *fp, bool attach_msg)
 Show the attachments in a Menu -.
 
void dlg_autocrypt (void)
 Display the Autocrypt account Menu -.
 
void dlg_browser (struct Buffer *file, SelectFileFlags flags, struct Mailbox *m, char ***files, int *numfiles)
 Let the user select a file -.
 
int dlg_compose (struct Email *e, struct Buffer *fcc, uint8_t flags, struct ConfigSubset *sub)
 Allow the user to edit the message envelope -.
 
int dlg_certificate (const char *title, struct CertArray *carr, bool allow_always, bool allow_skip)
 Ask the user to validate the certificate -.
 
void dlg_history (char *buf, size_t buflen, char **matches, int match_count)
 Select an item from a history list -.
 
struct Mailboxdlg_index (struct MuttWindow *dlg, struct Mailbox *m_init)
 Display a list of emails -.
 
void dlg_mixmaster (struct ListHead *chainhead)
 Create a Mixmaster chain -.
 
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 -.
 
struct PgpKeyInfodlg_pgp (struct PgpKeyInfo *keys, struct Address *p, const char *s)
 Let the user select a key to use -.
 
struct SmimeKeydlg_smime (struct SmimeKey *keys, const char *query)
 Get the user to select a key -.
 
int dlg_pager (struct PagerView *pview)
 Display an email, attachment, or help, in a window -.
 
bool dlg_pattern (char *buf, size_t buflen)
 Show menu to select a Pattern -.
 
struct Emaildlg_postponed (struct Mailbox *m)
 Create a Menu to select a postponed message -.
 

Detailed Description

A Dialog is an interactive set of windows allowing the user to perform some task.

The All Dialogs window is a container window and not visible. All active dialogs will be children of this window, though only one will be active at a time.

Windows

Name Type Constructor
All Dialogs WT_ALL_DIALOGS alldialogs_new()

Parent

Children

The All Dialogs window has many possible children, e.g.

Data

The All Dialogs window has no data.

Events

Once constructed, it is controlled by the following events:

Event Type Handler
NT_WINDOW alldialogs_window_observer()

The All Dialogs window does not implement MuttWindow::recalc() or MuttWindow::repaint().

Function Documentation

◆ dlg_alias()

static bool dlg_alias ( struct Buffer buf,
struct AliasMenuData mdata 
)
static

Display a menu of Aliases -.

Parameters
bufBuffer for expanded aliases
mdataMenu data holding Aliases
Return values
trueSelection was made

The Alias Dialog is an Address Book. The user can select addresses to add to an Email.

Definition at line 314 of file dlg_alias.c.

315{
316 if (ARRAY_EMPTY(&mdata->ava))
317 {
318 mutt_warning(_("You have no aliases"));
319 return false;
320 }
321
322 mdata->query = buf;
323 mdata->title = mutt_str_dup(_("Aliases"));
324
325 struct MuttWindow *dlg = alias_dialog_new(mdata);
326 struct Menu *menu = dlg->wdata;
327 struct MuttWindow *win_sbar = window_find_child(dlg, WT_STATUS_BAR);
328 mdata->menu = menu;
329 mdata->sbar = win_sbar;
330
331 alias_array_sort(&mdata->ava, mdata->sub);
332
333 struct AliasView *avp = NULL;
334 ARRAY_FOREACH(avp, &mdata->ava)
335 {
336 avp->num = ARRAY_FOREACH_IDX;
337 }
338
339 struct MuttWindow *old_focus = window_set_focus(menu->win);
340 // ---------------------------------------------------------------------------
341 // Event Loop
342 int rc = 0;
343 int op = OP_NULL;
344 do
345 {
346 menu_tagging_dispatcher(menu->win, op);
347 window_redraw(NULL);
348
350 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
351 if (op < 0)
352 continue;
353 if (op == OP_NULL)
354 {
356 continue;
357 }
359
360 rc = alias_function_dispatcher(dlg, op);
361 if (rc == FR_UNKNOWN)
362 rc = menu_function_dispatcher(menu->win, op);
363 if (rc == FR_UNKNOWN)
364 rc = global_function_dispatcher(NULL, op);
365 } while ((rc != FR_DONE) && (rc != FR_CONTINUE));
366 // ---------------------------------------------------------------------------
367
368 window_set_focus(old_focus);
369 simple_dialog_free(&dlg);
370 window_redraw(NULL);
371 return (rc == FR_CONTINUE); // Was a selection made?
372}
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:166
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition: array.h:211
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition: array.h:73
@ FR_DONE
Exit the Dialog.
Definition: dispatcher.h:35
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
@ FR_CONTINUE
Remain in the Dialog.
Definition: dispatcher.h:34
static struct MuttWindow * alias_dialog_new(struct AliasMenuData *mdata)
Create an Alias Selection Dialog.
Definition: dlg_alias.c:277
int km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
Definition: get.c:475
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:305
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:230
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:169
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:317
int alias_function_dispatcher(struct MuttWindow *win, int op)
Perform a Alias function - Implements function_dispatcher_t -.
Definition: functions.c:417
#define mutt_warning(...)
Definition: logging2.h:90
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:168
#define GETCH_NO_FLAGS
No flags are set.
Definition: lib.h:52
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
#define _(a)
Definition: message.h:28
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:73
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:634
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:684
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:48
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:53
struct MuttWindow * sbar
Status Bar.
Definition: gui.h:59
struct Menu * menu
Menu.
Definition: gui.h:56
struct Buffer * query
Query string.
Definition: gui.h:57
char * title
Title for the status bar.
Definition: gui.h:60
struct ConfigSubset * sub
Config items.
Definition: gui.h:55
GUI data wrapping an Alias.
Definition: gui.h:36
int num
Index number in list.
Definition: gui.h:37
Definition: lib.h:70
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
void * wdata
Private data.
Definition: mutt_window.h:145
@ MENU_ALIAS
Select an email address by its alias.
Definition: type.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_query()

static bool dlg_query ( struct Buffer buf,
struct AliasMenuData mdata 
)
static

Get the user to enter an Address Query -.

Parameters
bufBuffer for the query
mdataMenu data holding Aliases
Return values
trueSelection was made

The Select Query Dialog is an Address Book. It is dynamically created from an external source using $query_command.

The user can select addresses to add to an Email.

Definition at line 397 of file dlg_query.c.

398{
399 struct MuttWindow *dlg = query_dialog_new(mdata, buf_string(buf));
400 struct Menu *menu = dlg->wdata;
401 struct MuttWindow *win_sbar = window_find_child(dlg, WT_STATUS_BAR);
402 struct MuttWindow *win_menu = window_find_child(dlg, WT_MENU);
403 mdata->menu = menu;
404 mdata->sbar = win_sbar;
405 mdata->query = buf;
406
407 alias_array_sort(&mdata->ava, mdata->sub);
408
409 struct AliasView *avp = NULL;
410 ARRAY_FOREACH(avp, &mdata->ava)
411 {
412 avp->num = ARRAY_FOREACH_IDX;
413 }
414
415 struct MuttWindow *old_focus = window_set_focus(menu->win);
416 // ---------------------------------------------------------------------------
417 // Event Loop
418 int rc = 0;
419 int op = OP_NULL;
420 do
421 {
422 menu_tagging_dispatcher(menu->win, op);
423 window_redraw(NULL);
424
426 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
427 if (op < 0)
428 continue;
429 if (op == OP_NULL)
430 {
432 continue;
433 }
435
436 rc = alias_function_dispatcher(dlg, op);
437 if (rc == FR_UNKNOWN)
438 rc = menu_function_dispatcher(win_menu, op);
439 if (rc == FR_UNKNOWN)
440 rc = global_function_dispatcher(NULL, op);
441 } while ((rc != FR_DONE) && (rc != FR_CONTINUE));
442 // ---------------------------------------------------------------------------
443
444 window_set_focus(old_focus);
445 simple_dialog_free(&dlg);
446 window_redraw(NULL);
447 return (rc == FR_CONTINUE); // Was a selection made?
448}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
static struct MuttWindow * query_dialog_new(struct AliasMenuData *mdata, const char *query)
Create an Query Selection Dialog.
Definition: dlg_query.c:356
@ WT_MENU
An Window containing a Menu.
Definition: mutt_window.h:98
@ MENU_QUERY
Select from results of external query.
Definition: type.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_attachment()

void dlg_attachment ( struct ConfigSubset sub,
struct MailboxView mv,
struct Email e,
FILE *  fp,
bool  attach_msg 
)

Show the attachments in a Menu -.

Parameters
subConfig Subset
mvMailbox view
eEmail
fpFile with the content of the email, or NULL
attach_msgAre we in "attach message" mode?

The Select Attachment dialog shows an Email's attachments. They can be viewed using the Pager or Mailcap programs. They can also be saved, printed, deleted, etc.

Definition at line 473 of file dlg_attach.c.

475{
476 if (!mv || !mv->mailbox || !e || !fp)
477 return;
478
479 struct Mailbox *m = mv->mailbox;
480
481 /* make sure we have parsed this message */
484
486 struct Menu *menu = dlg->wdata;
488 menu->tag = attach_tag;
489
490 struct AttachCtx *actx = mutt_actx_new();
491 actx->email = e;
492 actx->fp_root = fp;
493 mutt_update_recvattach_menu(actx, menu, true);
494
496 priv->menu = menu;
497 priv->actx = actx;
498 priv->sub = sub;
499 priv->mailbox = m;
500 priv->attach_msg = attach_msg;
501 menu->mdata = priv;
503
504 // NT_COLOR is handled by the SimpleDialog
507
508 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
509 sbar_set_title(sbar, _("Attachments"));
510
511 struct MuttWindow *old_focus = window_set_focus(menu->win);
512 // ---------------------------------------------------------------------------
513 // Event Loop
514 int rc = 0;
515 int op = OP_NULL;
516 do
517 {
518 menu_tagging_dispatcher(menu->win, op);
519 window_redraw(NULL);
520
522 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
523 if (op < 0)
524 continue;
525 if (op == OP_NULL)
526 {
528 continue;
529 }
531
532 rc = attach_function_dispatcher(dlg, op);
533 if (rc == FR_UNKNOWN)
534 rc = menu_function_dispatcher(menu->win, op);
535 if (rc == FR_UNKNOWN)
536 rc = global_function_dispatcher(NULL, op);
537
538 if (rc == FR_CONTINUE)
539 {
540 op = priv->op;
541 }
542
543 } while (rc != FR_DONE);
544 // ---------------------------------------------------------------------------
545
546 window_set_focus(old_focus);
547 simple_dialog_free(&dlg);
548}
struct AttachCtx * mutt_actx_new(void)
Create a new Attachment Context.
Definition: attach.c:189
struct AttachPrivateData * attach_private_data_new(void)
Create new Attach Data.
Definition: private_data.c:50
void mutt_parse_mime_message(struct Email *e, FILE *fp)
Parse a MIME email.
Definition: attachments.c:596
static const struct Mapping AttachmentHelp[]
Help Bar for the Attachment selection dialog.
Definition: dlg_attach.c:93
int attach_function_dispatcher(struct MuttWindow *win, int op)
Perform a Attach function - Implements function_dispatcher_t -.
Definition: functions.c:712
static void attach_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format an Attachment for the Menu - Implements Menu::make_entry() -.
Definition: dlg_attach.c:405
void attach_private_data_free(struct Menu *menu, void **ptr)
Free the Attach Data - Implements Menu::mdata_free() -.
Definition: private_data.c:38
static int attach_tag(struct Menu *menu, int sel, int act)
Tag an attachment - Implements Menu::tag() -.
Definition: dlg_attach.c:419
static int attach_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_attach.c:109
static int attach_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_attach.c:438
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:132
void mutt_message_hook(struct Mailbox *m, struct Email *e, HookFlags type)
Perform a message hook.
Definition: hook.c:666
#define MUTT_MESSAGE_HOOK
message-hook: run before displaying a message
Definition: hook.h:44
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:191
@ WT_DLG_ATTACHMENT
Attachment Dialog, dlg_attachment()
Definition: mutt_window.h:78
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
void mutt_update_recvattach_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Update the Attachment Menu.
Definition: recvattach.c:1208
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:227
A set of attachments.
Definition: attach.h:51
FILE * fp_root
Used by recvattach for updating.
Definition: attach.h:53
struct Email * email
Used by recvattach for updating.
Definition: attach.h:52
Private state data for Attachments.
Definition: private_data.h:35
int op
Op returned from the Pager, e.g. OP_NEXT_ENTRY.
Definition: private_data.h:40
struct Menu * menu
Current Menu.
Definition: private_data.h:36
struct ConfigSubset * sub
Config subset.
Definition: private_data.h:38
struct AttachCtx * actx
List of all Attachments.
Definition: private_data.h:37
bool attach_msg
Are we in "attach message" mode?
Definition: private_data.h:41
struct Mailbox * mailbox
Current Mailbox.
Definition: private_data.h:39
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:50
A mailbox.
Definition: mailbox.h:79
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:96
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:151
int(* tag)(struct Menu *menu, int sel, int act)
Definition: lib.h:121
void * mdata
Private data.
Definition: lib.h:137
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
@ MENU_ATTACHMENT
Select an attachment.
Definition: type.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_autocrypt()

void dlg_autocrypt ( void  )

Display the Autocrypt account Menu -.

The Autocrypt Dialog lets the user select an Autocrypt Account to use.

Definition at line 307 of file dlg_autocrypt.c.

308{
309 const bool c_autocrypt = cs_subset_bool(NeoMutt->sub, "autocrypt");
310 if (!c_autocrypt)
311 return;
312
313 if (mutt_autocrypt_init(false))
314 return;
315
317
318 struct Menu *menu = dlg->wdata;
320
321 populate_menu(menu);
322
323 struct AutocryptData ad = { false, menu };
324 dlg->wdata = &ad;
325
326 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
327 // L10N: Autocrypt Account Management Menu title
328 sbar_set_title(sbar, _("Autocrypt Accounts"));
329
330 // NT_COLOR is handled by the SimpleDialog
333
334 struct MuttWindow *old_focus = window_set_focus(menu->win);
335 // ---------------------------------------------------------------------------
336 // Event Loop
337 int op = OP_NULL;
338 do
339 {
340 menu_tagging_dispatcher(menu->win, op);
341 window_redraw(NULL);
342
344 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
345 if (op < 0)
346 continue;
347 if (op == OP_NULL)
348 {
350 continue;
351 }
353
354 int rc = autocrypt_function_dispatcher(dlg, op);
355
356 if (rc == FR_UNKNOWN)
357 rc = menu_function_dispatcher(menu->win, op);
358 if (rc == FR_UNKNOWN)
359 rc = global_function_dispatcher(NULL, op);
360 } while (!ad.done);
361 // ---------------------------------------------------------------------------
362
363 window_set_focus(old_focus);
364 simple_dialog_free(&dlg);
365}
int mutt_autocrypt_init(bool can_create)
Initialise Autocrypt.
Definition: autocrypt.c:96
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
static const struct Mapping AutocryptHelp[]
Help Bar for the Autocrypt Account selection dialog.
Definition: dlg_autocrypt.c:86
bool populate_menu(struct Menu *menu)
Add the Autocrypt data to a Menu.
int autocrypt_function_dispatcher(struct MuttWindow *win, int op)
Perform a Autocrypt function - Implements function_dispatcher_t -.
Definition: functions.c:203
static void autocrypt_make_entry(struct Menu *menu, char *buf, size_t buflen, int num)
Format an Autocrypt Account for the Menu - Implements Menu::make_entry() -.
static int autocrypt_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int autocrypt_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
@ WT_DLG_AUTOCRYPT
Autocrypt Dialog, dlg_autocrypt()
Definition: mutt_window.h:79
Data to pass to the Autocrypt Functions.
Definition: functions.h:34
bool done
Should we close the Dialog?
Definition: functions.h:35
struct Menu * menu
Autocrypt Menu.
Definition: functions.h:36
@ MENU_AUTOCRYPT
Autocrypt Account menu.
Definition: type.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_browser()

void dlg_browser ( struct Buffer file,
SelectFileFlags  flags,
struct Mailbox m,
char ***  files,
int *  numfiles 
)

Let the user select a file -.

Parameters
[in]fileBuffer for the result
[in]flagsFlags, see SelectFileFlags
[in]mMailbox
[out]filesArray of selected files
[out]numfilesNumber of selected files

The Select File Dialog is a file browser. It allows the user to select a file or directory to use.

Definition at line 1226 of file dlg_browser.c.

1228{
1230 priv->file = file;
1231 priv->mailbox = m;
1232 priv->files = files;
1233 priv->numfiles = numfiles;
1234 struct MuttWindow *dlg = NULL;
1235
1236 priv->multiple = (flags & MUTT_SEL_MULTI);
1237 priv->folder = (flags & MUTT_SEL_FOLDER);
1238 priv->state.is_mailbox_list = (flags & MUTT_SEL_MAILBOX) && priv->folder;
1239 priv->last_selected_mailbox = -1;
1240
1241 init_lastdir();
1242
1243 if (OptNews)
1244 {
1245 if (buf_is_empty(file))
1246 {
1248
1249 /* default state for news reader mode is browse subscribed newsgroups */
1250 priv->state.is_mailbox_list = false;
1251 for (size_t i = 0; i < adata->groups_num; i++)
1252 {
1253 struct NntpMboxData *mdata = adata->groups_list[i];
1254 if (mdata && mdata->subscribed)
1255 {
1256 priv->state.is_mailbox_list = true;
1257 break;
1258 }
1259 }
1260 }
1261 else
1262 {
1263 buf_copy(priv->prefix, file);
1264 }
1265 }
1266 else if (!buf_is_empty(file))
1267 {
1268 buf_expand_path(file);
1269 if (imap_path_probe(buf_string(file), NULL) == MUTT_IMAP)
1270 {
1271 init_state(&priv->state, NULL);
1272 priv->state.imap_browse = true;
1273 if (imap_browse(buf_string(file), &priv->state) == 0)
1274 {
1275 buf_strcpy(&LastDir, priv->state.folder);
1276 browser_sort(&priv->state);
1277 }
1278 }
1279 else
1280 {
1281 int i;
1282 for (i = buf_len(file) - 1; (i > 0) && ((buf_string(file))[i] != '/'); i--)
1283 {
1284 ; // do nothing
1285 }
1286
1287 if (i > 0)
1288 {
1289 if ((buf_string(file))[0] == '/')
1290 {
1291 buf_strcpy_n(&LastDir, buf_string(file), i);
1292 }
1293 else
1294 {
1296 buf_addch(&LastDir, '/');
1297 buf_addstr_n(&LastDir, buf_string(file), i);
1298 }
1299 }
1300 else
1301 {
1302 if ((buf_string(file))[0] == '/')
1303 buf_strcpy(&LastDir, "/");
1304 else
1306 }
1307
1308 if ((i <= 0) && (buf_string(file)[0] != '/'))
1309 buf_copy(priv->prefix, file);
1310 else
1311 buf_strcpy(priv->prefix, buf_string(file) + i + 1);
1312 priv->kill_prefix = true;
1313 }
1314 }
1315 else
1316 {
1317 if (priv->folder)
1318 {
1319 /* Whether we use the tracking feature of the browser depends
1320 * on which sort method we chose to use. This variable is defined
1321 * only to help readability of the code. */
1322 bool browser_track = false;
1323
1324 const enum SortType c_sort_browser = cs_subset_sort(NeoMutt->sub, "sort_browser");
1325 switch (c_sort_browser & SORT_MASK)
1326 {
1327 case SORT_DESC:
1328 case SORT_SUBJECT:
1329 case SORT_ORDER:
1330 browser_track = true;
1331 break;
1332 }
1333
1334 /* We use mutt_browser_select_dir to initialize the two
1335 * variables (LastDir, LastDirBackup) at the appropriate
1336 * values.
1337 *
1338 * We do it only when LastDir is not set (first pass there)
1339 * or when CurrentFolder and LastDirBackup are not the same.
1340 * This code is executed only when we list files, not when
1341 * we press up/down keys to navigate in a displayed list.
1342 *
1343 * We only do this when CurrentFolder has been set (ie, not
1344 * when listing folders on startup with "neomutt -y").
1345 *
1346 * This tracker is only used when browser_track is true,
1347 * meaning only with sort methods SUBJECT/DESC for now. */
1348 if (CurrentFolder)
1349 {
1350 if (buf_is_empty(&LastDir))
1351 {
1352 /* If browsing in "local"-mode, than we chose to define LastDir to
1353 * MailDir */
1355 {
1356 case MUTT_IMAP:
1357 case MUTT_MAILDIR:
1358 case MUTT_MBOX:
1359 case MUTT_MH:
1360 case MUTT_MMDF:
1361 {
1362 const char *const c_folder = cs_subset_string(NeoMutt->sub, "folder");
1363 const char *const c_spool_file = cs_subset_string(NeoMutt->sub, "spool_file");
1364 if (c_folder)
1365 buf_strcpy(&LastDir, c_folder);
1366 else if (c_spool_file)
1367 mutt_browser_select_dir(c_spool_file);
1368 break;
1369 }
1370 default:
1372 break;
1373 }
1374 }
1376 {
1378 }
1379 }
1380
1381 /* When browser tracking feature is disabled, clear LastDirBackup */
1382 if (!browser_track)
1384 }
1385 else
1386 {
1388 }
1389
1390 if (!priv->state.is_mailbox_list &&
1392 {
1393 init_state(&priv->state, NULL);
1394 priv->state.imap_browse = true;
1396 browser_sort(&priv->state);
1397 }
1398 else
1399 {
1400 size_t i = buf_len(&LastDir);
1401 while ((i > 0) && (buf_string(&LastDir)[--i] == '/'))
1402 LastDir.data[i] = '\0';
1404 if (buf_is_empty(&LastDir))
1406 }
1407 }
1408
1409 buf_reset(file);
1410
1411 const struct Mapping *help_data = NULL;
1412
1413 if (OptNews)
1414 help_data = FolderNewsHelp;
1415 else
1416 help_data = FolderHelp;
1417
1418 dlg = simple_dialog_new(MENU_FOLDER, WT_DLG_BROWSER, help_data);
1419
1420 priv->menu = dlg->wdata;
1421 dlg->wdata = priv;
1424 if (priv->multiple)
1425 priv->menu->tag = file_tag;
1426
1427 priv->sbar = window_find_child(dlg, WT_STATUS_BAR);
1429
1430 struct MuttWindow *win_menu = priv->menu->win;
1431
1432 // NT_COLOR is handled by the SimpleDialog
1436
1437 struct MuttWindow *old_focus = window_set_focus(priv->menu->win);
1438
1439 if (priv->state.is_mailbox_list)
1440 {
1441 examine_mailboxes(m, NULL, &priv->state);
1442 }
1443 else if (!priv->state.imap_browse)
1444 {
1445 // examine_directory() calls browser_add_folder() which needs the menu
1446 if (examine_directory(m, priv->menu, &priv->state, buf_string(&LastDir),
1447 buf_string(priv->prefix)) == -1)
1448 {
1449 goto bail;
1450 }
1451 }
1452
1453 init_menu(&priv->state, priv->menu, m, priv->sbar);
1454 // only now do we have a valid priv->state to attach
1455 priv->menu->mdata = &priv->state;
1456
1457 // ---------------------------------------------------------------------------
1458 // Event Loop
1459 int op = OP_NULL;
1460 do
1461 {
1462 menu_tagging_dispatcher(priv->menu->win, op);
1463 window_redraw(NULL);
1464
1466 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
1467 if (op < 0)
1468 continue;
1469 if (op == OP_NULL)
1470 {
1472 continue;
1473 }
1475
1476 int rc = browser_function_dispatcher(priv->win_browser, op);
1477
1478 if (rc == FR_UNKNOWN)
1479 rc = menu_function_dispatcher(priv->menu->win, op);
1480 if (rc == FR_UNKNOWN)
1481 rc = global_function_dispatcher(NULL, op);
1482 } while (!priv->done);
1483 // ---------------------------------------------------------------------------
1484
1485bail:
1486 window_set_focus(old_focus);
1487 simple_dialog_free(&dlg);
1489}
int browser_function_dispatcher(struct MuttWindow *win, int op)
Perform a Browser function.
Definition: functions.c:1138
#define MUTT_SEL_MAILBOX
Select a mailbox.
Definition: lib.h:58
void browser_sort(struct BrowserState *state)
Sort the entries in the browser.
Definition: sort.c:185
#define MUTT_SEL_FOLDER
Select a local directory.
Definition: lib.h:60
#define MUTT_SEL_MULTI
Multi-selection is enabled.
Definition: lib.h:59
struct BrowserPrivateData * browser_private_data_new(void)
Create new Browser Data.
Definition: private_data.c:55
size_t buf_addstr_n(struct Buffer *buf, const char *s, size_t len)
Add a string to a Buffer, expanding it if necessary.
Definition: buffer.c:108
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition: buffer.c:466
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition: buffer.c:88
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition: buffer.c:303
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
Definition: buffer.c:194
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
Definition: buffer.c:422
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition: buffer.c:253
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition: buffer.c:407
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:572
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:267
void init_state(struct BrowserState *state, struct Menu *menu)
Initialise a browser state.
Definition: dlg_browser.c:623
int examine_directory(struct Mailbox *m, struct Menu *menu, struct BrowserState *state, const char *dirname, const char *prefix)
Get list of all files/newsgroups with mask.
Definition: dlg_browser.c:646
void init_menu(struct BrowserState *state, struct Menu *menu, struct Mailbox *m, struct MuttWindow *sbar)
Set up a new menu.
Definition: dlg_browser.c:959
static void init_lastdir(void)
Initialise the browser directories.
Definition: dlg_browser.c:139
static const struct Mapping FolderNewsHelp[]
Help Bar for the NNTP Mailbox browser dialog.
Definition: dlg_browser.c:116
struct Buffer LastDir
Browser: previous selected directory.
Definition: dlg_browser.c:130
void mutt_browser_select_dir(const char *f)
Remember the last directory selected.
Definition: dlg_browser.c:1203
struct Buffer LastDirBackup
Browser: backup copy of the current directory.
Definition: dlg_browser.c:132
static const struct Mapping FolderHelp[]
Help Bar for the File/Dir/Mailbox browser dialog.
Definition: dlg_browser.c:104
int examine_mailboxes(struct Mailbox *m, struct Menu *menu, struct BrowserState *state)
Get list of mailboxes/subscribed newsgroups.
Definition: dlg_browser.c:773
bool OptNews
(pseudo) used to change reader mode
Definition: globals.c:75
char * CurrentFolder
Currently selected mailbox.
Definition: globals.c:44
static void folder_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a Folder for the Menu - Implements Menu::make_entry() -.
Definition: dlg_browser.c:894
static int select_file_search(struct Menu *menu, regex_t *rx, int line)
Menu search callback for matching files - Implements Menu::search() -.
Definition: dlg_browser.c:878
static int file_tag(struct Menu *menu, int sel, int act)
Tag an entry in the menu - Implements Menu::tag() -.
Definition: dlg_browser.c:1064
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
Definition: imap.c:2327
static int browser_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_browser.c:1084
static int browser_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition: dlg_browser.c:1124
static int browser_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_browser.c:1169
void browser_private_data_free(struct BrowserPrivateData **ptr)
Free Private Browser Data - Implements MuttWindow::wdata_free() -.
Definition: private_data.c:37
int imap_browse(const char *path, struct BrowserState *state)
IMAP hook into the folder browser.
Definition: browse.c:192
@ MUTT_MMDF
'mmdf' Mailbox type
Definition: mailbox.h:46
@ MUTT_MH
'MH' Mailbox type
Definition: mailbox.h:47
@ MUTT_IMAP
'IMAP' Mailbox type
Definition: mailbox.h:50
@ MUTT_MBOX
'mbox' Mailbox type
Definition: mailbox.h:45
@ MUTT_MAILDIR
'Maildir' Mailbox type
Definition: mailbox.h:48
const char * mutt_path_getcwd(struct Buffer *cwd)
Get the current working directory.
Definition: path.c:498
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:798
@ WT_DLG_BROWSER
Browser Dialog, dlg_browser()
Definition: mutt_window.h:80
void buf_expand_path(struct Buffer *buf)
Create the canonical path.
Definition: muttlib.c:329
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition: mx.c:1326
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition: nntp.c:77
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition: notify_type.h:49
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:74
SortType
Methods for sorting.
Definition: sort2.h:38
@ SORT_SUBJECT
Sort by the email's subject.
Definition: sort2.h:42
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
Definition: sort2.h:44
@ SORT_DESC
Sort by the folder's description.
Definition: sort2.h:59
void * adata
Private data (for Mailbox backends)
Definition: account.h:43
Private state data for the Browser.
Definition: private_data.h:34
char *** files
Array of selected files.
Definition: private_data.h:38
struct Menu * menu
Menu.
Definition: private_data.h:43
struct Buffer * prefix
Folder prefix string.
Definition: private_data.h:49
bool kill_prefix
Prefix is in use.
Definition: private_data.h:44
bool done
Should we close the Dialog?
Definition: private_data.h:53
bool folder
Select folders.
Definition: private_data.h:46
int last_selected_mailbox
Index of last selected Mailbox.
Definition: private_data.h:50
int * numfiles
Number of selected files.
Definition: private_data.h:39
struct Mailbox * mailbox
Mailbox.
Definition: private_data.h:37
struct BrowserState state
State containing list of files/dir/mailboxes.
Definition: private_data.h:42
struct Buffer * file
Buffer for the result.
Definition: private_data.h:36
bool multiple
Allow multiple selections.
Definition: private_data.h:45
struct MuttWindow * win_browser
Browser Window.
Definition: private_data.h:52
struct MuttWindow * sbar
Status Bar.
Definition: private_data.h:51
char * folder
Folder name.
Definition: lib.h:117
bool is_mailbox_list
Viewing mailboxes.
Definition: lib.h:118
bool imap_browse
IMAP folder.
Definition: lib.h:116
char * data
Pointer to data.
Definition: buffer.h:35
void * mdata
Driver specific data.
Definition: mailbox.h:131
Mapping between user-readable string and a constant.
Definition: mapping.h:32
int(* search)(struct Menu *menu, regex_t *rx, int line)
Definition: lib.h:109
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
NNTP-specific Account data -.
Definition: adata.h:36
void ** groups_list
Definition: adata.h:60
NNTP-specific Mailbox data -.
Definition: mdata.h:34
struct NntpAccountData * adata
Definition: mdata.h:48
@ MENU_FOLDER
General file/mailbox browser.
Definition: type.h:45
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_compose()

int dlg_compose ( struct Email e,
struct Buffer fcc,
uint8_t  flags,
struct ConfigSubset sub 
)

Allow the user to edit the message envelope -.

Parameters
eEmail to fill
fccBuffer to save FCC
flagsFlags, e.g. MUTT_COMPOSE_NOFREEHEADER
subConfigSubset
Return values
1Message should be postponed
0Normal exit
-1Abort message

The Compose Dialog allows the user to edit the email envelope before sending.

Definition at line 307 of file dlg_compose.c.

308{
309 struct MuttWindow *dlg = compose_dlg_init(sub, e, fcc);
310 struct ComposeSharedData *shared = dlg->wdata;
311 shared->mailbox = get_current_mailbox();
312 shared->email = e;
313 shared->sub = sub;
314 shared->fcc = fcc;
315 shared->fcc_set = false;
316 shared->flags = flags;
317 shared->rc = -1;
318
322
323 if (OptNewsSend)
325 else
326 dlg->help_data = ComposeHelp;
327 dlg->help_menu = MENU_COMPOSE;
328
329 struct Menu *menu = shared->adata->menu;
330 update_menu(shared->adata->actx, menu, true);
332
333 struct MuttWindow *win_env = window_find_child(dlg, WT_CUSTOM);
334
335 dialog_push(dlg);
336 struct MuttWindow *old_focus = window_set_focus(menu->win);
337 // ---------------------------------------------------------------------------
338 // Event Loop
339 int rc = 0;
340 int op = OP_NULL;
341 do
342 {
343 OptNews = false; /* for any case */
344 menu_tagging_dispatcher(menu->win, op);
345 window_redraw(NULL);
346
348 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
349 if (op < 0)
350 continue;
351 if (op == OP_NULL)
352 {
354 continue;
355 }
357
358 rc = compose_function_dispatcher(dlg, op);
359 if (rc == FR_UNKNOWN)
360 rc = env_function_dispatcher(win_env, op);
361 if (rc == FR_UNKNOWN)
362 rc = menu_function_dispatcher(menu->win, op);
363 if (rc == FR_UNKNOWN)
364 rc = global_function_dispatcher(NULL, op);
365 } while (rc != FR_DONE);
366 // ---------------------------------------------------------------------------
367
368#ifdef USE_AUTOCRYPT
369 /* This is a fail-safe to make sure the bit isn't somehow turned
370 * on. The user could have disabled the option after setting SEC_AUTOCRYPT,
371 * or perhaps resuming or replying to an autocrypt message. */
372 const bool c_autocrypt = cs_subset_bool(sub, "autocrypt");
373 if (!c_autocrypt)
374 e->security &= ~SEC_AUTOCRYPT;
375#endif
376
377 if (shared->adata->actx->idxlen)
378 e->body = shared->adata->actx->idx[0]->body;
379 else
380 e->body = NULL;
381
382 rc = shared->rc;
383
384 window_set_focus(old_focus);
385 dialog_pop();
386 mutt_window_free(&dlg);
387
388 return rc;
389}
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:109
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:142
void update_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: dlg_compose.c:219
static const struct Mapping ComposeHelp[]
Help Bar for the Compose dialog.
Definition: dlg_compose.c:93
static const struct Mapping ComposeNewsHelp[]
Help Bar for the News Compose dialog.
Definition: dlg_compose.c:111
static struct MuttWindow * compose_dlg_init(struct ConfigSubset *sub, struct Email *e, struct Buffer *fcc)
Allocate the Windows for Compose.
Definition: dlg_compose.c:254
@ NT_EMAIL_CHANGE
Email has changed.
Definition: email.h:152
bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: globals.c:76
int env_function_dispatcher(struct MuttWindow *win, int op)
Perform an Envelope function - Implements function_dispatcher_t -.
Definition: functions.c:545
int compose_function_dispatcher(struct MuttWindow *win, int op)
Perform a Compose function - Implements function_dispatcher_t -.
Definition: functions.c:2099
static int compose_email_observer(struct NotifyCallback *nc)
Notification that an Email has changed - Implements observer_t -.
Definition: dlg_compose.c:148
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_compose.c:127
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_compose.c:167
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:662
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:173
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:202
@ WT_CUSTOM
Window with a custom drawing function.
Definition: mutt_window.h:95
@ NT_EMAIL
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
@ NT_ALL
Register for all notifications.
Definition: notify_type.h:35
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
short idxlen
Number of attachmentes.
Definition: attach.h:56
struct Body * body
Attachment.
Definition: attach.h:36
struct Menu * menu
Menu displaying the attachments.
Definition: attach_data.h:35
struct AttachCtx * actx
Set of attachments.
Definition: attach_data.h:34
Shared Compose Data.
Definition: shared_data.h:35
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:36
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:37
int flags
Flags, e.g. MUTT_COMPOSE_NOFREEHEADER.
Definition: shared_data.h:43
bool fcc_set
User has edited the Fcc: field.
Definition: shared_data.h:44
int rc
Return code to leave compose.
Definition: shared_data.h:45
struct ComposeAttachData * adata
Attachments.
Definition: shared_data.h:39
struct Email * email
Email being composed.
Definition: shared_data.h:38
struct Buffer * fcc
Buffer to save FCC.
Definition: shared_data.h:42
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:41
struct Body * body
List of MIME parts.
Definition: email.h:67
struct Notify * notify
Notifications: NotifyEmail, EventEmail.
Definition: email.h:71
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:142
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:141
@ MENU_COMPOSE
Compose an email.
Definition: type.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_certificate()

int dlg_certificate ( const char *  title,
struct CertArray *  carr,
bool  allow_always,
bool  allow_skip 
)

Ask the user to validate the certificate -.

Parameters
titleMenu title
carrCertificate text to display
allow_alwaysIf true, allow the user to always accept the certificate
allow_skipIf true, allow the user to skip the verification
Return values
1Reject certificate (or menu aborted)
2Accept certificate once
3Accept certificate always/skip (see notes)
4Accept certificate skip

The Verify Certificate Dialog shows a list of signatures for a domain certificate. They can choose whether to accept or reject it.

The possible retvals will depend on the parameters. The options are given in the order: Reject, Once, Always, Skip. The retval represents the chosen option.

Definition at line 181 of file dlg_verifycert.c.

182{
184
185 struct CertMenuData mdata = { carr };
186
187 struct Menu *menu = dlg->wdata;
188 menu->mdata = &mdata;
189 menu->mdata_free = NULL; // Menu doesn't own the data
191 menu->max = ARRAY_SIZE(carr);
192
193 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
194 sbar_set_title(sbar, title);
195
196 if (allow_always)
197 {
198 if (allow_skip)
199 {
200 mdata.prompt = _("(r)eject, accept (o)nce, (a)ccept always, (s)kip");
201 /* L10N: The letters correspond to the choices in the string:
202 "(r)eject, accept (o)nce, (a)ccept always, (s)kip"
203 This is an interactive certificate confirmation prompt for an SSL connection. */
204 mdata.keys = _("roas");
205 }
206 else
207 {
208 mdata.prompt = _("(r)eject, accept (o)nce, (a)ccept always");
209 /* L10N: The letters correspond to the choices in the string:
210 "(r)eject, accept (o)nce, (a)ccept always"
211 This is an interactive certificate confirmation prompt for an SSL connection. */
212 mdata.keys = _("roa");
213 }
214 }
215 else
216 {
217 if (allow_skip)
218 {
219 mdata.prompt = _("(r)eject, accept (o)nce, (s)kip");
220 /* L10N: The letters correspond to the choices in the string:
221 "(r)eject, accept (o)nce, (s)kip"
222 This is an interactive certificate confirmation prompt for an SSL connection. */
223 mdata.keys = _("ros");
224 }
225 else
226 {
227 mdata.prompt = _("(r)eject, accept (o)nce");
228 /* L10N: The letters correspond to the choices in the string:
229 "(r)eject, accept (o)nce"
230 This is an interactive certificate confirmation prompt for an SSL connection. */
231 mdata.keys = _("ro");
232 }
233 }
235
236 struct MuttWindow *old_focus = window_set_focus(menu->win);
237 // ---------------------------------------------------------------------------
238 // Event Loop
239 int choice = 0;
240 int op = OP_NULL;
241 do
242 {
243 window_redraw(NULL);
245
246 // Try to catch dialog keys before ops
247 if (menu_dialog_dokey(menu, &op) != 0)
248 {
250 }
251
252 if (op == OP_TIMEOUT)
253 continue;
254
255 // Convert menubar movement to scrolling
257
258 if (op <= OP_MAX)
259 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
260 else
261 mutt_debug(LL_DEBUG1, "Got choice %d\n", op - OP_MAX);
262
263 switch (op)
264 {
265 case -1: // Abort: Ctrl-G
266 case OP_QUIT: // Q)uit
267 case OP_MAX + 1: // R)eject
268 choice = 1;
269 break;
270 case OP_MAX + 2: // O)nce
271 choice = 2;
272 break;
273 case OP_MAX + 3: // A)lways / S)kip
274 choice = 3;
275 break;
276 case OP_MAX + 4: // S)kip
277 choice = 4;
278 break;
279
280 case OP_JUMP:
281 case OP_JUMP_1:
282 case OP_JUMP_2:
283 case OP_JUMP_3:
284 case OP_JUMP_4:
285 case OP_JUMP_5:
286 case OP_JUMP_6:
287 case OP_JUMP_7:
288 case OP_JUMP_8:
289 case OP_JUMP_9:
290 mutt_error(_("Jumping is not implemented for dialogs"));
291 continue;
292
293 case OP_SEARCH:
294 case OP_SEARCH_NEXT:
295 case OP_SEARCH_OPPOSITE:
296 case OP_SEARCH_REVERSE:
297 mutt_error(_("Search is not implemented for this menu"));
298 continue;
299 }
300
301 (void) menu_function_dispatcher(menu->win, op);
302 } while (choice == 0);
303 // ---------------------------------------------------------------------------
304
305 window_set_focus(old_focus);
306 simple_dialog_free(&dlg);
307
308 return choice;
309}
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:86
@ MT_COLOR_PROMPT
Question/user input.
Definition: color.h:61
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 const struct Mapping VerifyHelp[]
Help Bar for the Certificate Verification dialog.
#define mutt_error(...)
Definition: logging2.h:92
static void cert_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Create a Certificate for the Menu - Implements Menu::make_entry() -.
#define GETCH_IGNORE_MACRO
Don't use MacroEvents.
Definition: lib.h:53
void msgwin_set_text(struct MuttWindow *win, const char *text, enum ColorId color)
Set the text for the Message Window.
Definition: msgwin.c:484
@ WT_DLG_CERTIFICATE
Certificate Dialog, dlg_certificate()
Definition: mutt_window.h:81
#define OP_TIMEOUT
1 second with no events
Definition: opcodes.h:34
@ OP_MAX
Definition: opcodes.h:380
Certificate data to use in the Menu.
Definition: ssl.h:42
struct CertArray * carr
Lines of the Certificate.
Definition: ssl.h:43
char * prompt
Prompt for user, similar to mw_multi_choice.
Definition: ssl.h:44
char * keys
Keys used in the prompt.
Definition: ssl.h:45
int max
Number of entries in the menu.
Definition: lib.h:72
@ MENU_DIALOG
Simple Dialog.
Definition: type.h:43
@ MENU_GENERIC
Generic selection list.
Definition: type.h:46
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_history()

void dlg_history ( char *  buf,
size_t  buflen,
char **  matches,
int  match_count 
)

Select an item from a history list -.

Parameters
[in]bufBuffer in which to save string
[in]buflenBuffer length
[out]matchesItems to choose from
[in]match_countNumber of items

The History Dialog lets the user select from the history of commands, functions or files.

Definition at line 144 of file dlg_history.c.

145{
147
148 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
149 char title[256] = { 0 };
150 snprintf(title, sizeof(title), _("History '%s'"), buf);
151 sbar_set_title(sbar, title);
152
153 struct Menu *menu = dlg->wdata;
155 menu->max = match_count;
156 menu->mdata = matches;
157 menu->mdata_free = NULL; // Menu doesn't own the data
158
159 struct HistoryData hd = { false, false, buf, buflen,
161 dlg->wdata = &hd;
162
163 struct MuttWindow *old_focus = window_set_focus(menu->win);
164 // ---------------------------------------------------------------------------
165 // Event Loop
166 int op = OP_NULL;
167 do
168 {
169 menu_tagging_dispatcher(menu->win, op);
170 window_redraw(NULL);
171
173 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
174 if (op < 0)
175 continue;
176 if (op == OP_NULL)
177 {
179 continue;
180 }
182
183 int rc = history_function_dispatcher(dlg, op);
184 if (rc == FR_UNKNOWN)
185 rc = menu_function_dispatcher(menu->win, op);
186 if (rc == FR_UNKNOWN)
187 rc = global_function_dispatcher(NULL, op);
188 } while (!hd.done);
189 // ---------------------------------------------------------------------------
190
191 window_set_focus(old_focus);
192 simple_dialog_free(&dlg);
193}
static const struct Mapping HistoryHelp[]
Help Bar for the History Selection dialog.
Definition: dlg_history.c:75
int history_function_dispatcher(struct MuttWindow *win, int op)
Perform a History function - Implements function_dispatcher_t -.
Definition: functions.c:75
static void history_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a History Item for the Menu - Implements Menu::make_entry() -.
Definition: dlg_history.c:123
@ WT_DLG_HISTORY
History Dialog, dlg_history()
Definition: mutt_window.h:85
Data to pass to the History Functions.
Definition: functions.h:35
size_t buflen
Length of the results buffer.
Definition: functions.h:39
struct Menu * menu
History Menu.
Definition: functions.h:40
char ** matches
History entries.
Definition: functions.h:41
bool done
Should we close the Dialog?
Definition: functions.h:36
char * buf
Buffer for the results.
Definition: functions.h:38
int match_count
Number of history entries.
Definition: functions.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_index()

struct Mailbox * dlg_index ( struct MuttWindow dlg,
struct Mailbox m_init 
)

Display a list of emails -.

Parameters
dlgDialog containing Windows to draw on
m_initInitial mailbox
Return values
ptrMailbox open in the index

The Index Dialog is the heart of NeoMutt. From here, the user can read and reply to emails, organise them into folders, set labels, etc.

Definition at line 1057 of file dlg_index.c.

1058{
1059 /* Make sure use_threads/sort/sort_aux are coherent */
1061
1062 struct IndexSharedData *shared = dlg->wdata;
1064
1065 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
1066
1067 struct IndexPrivateData *priv = panel_index->wdata;
1068 priv->win_index = window_find_child(panel_index, WT_MENU);
1069
1070 int op = OP_NULL;
1071
1072 if (shared->mailbox && (shared->mailbox->type == MUTT_NNTP))
1073 dlg->help_data = IndexNewsHelp;
1074 else
1075 dlg->help_data = IndexHelp;
1076 dlg->help_menu = MENU_INDEX;
1077
1078 priv->menu = priv->win_index->wdata;
1080 priv->menu->color = index_color;
1081 priv->menu->max = shared->mailbox ? shared->mailbox->vcount : 0;
1083
1084 struct MuttWindow *old_focus = window_set_focus(priv->menu->win);
1085 mutt_window_reflow(NULL);
1086
1087 if (!shared->attach_msg)
1088 {
1089 /* force the mailbox check after we enter the folder */
1091 }
1092#ifdef USE_INOTIFY
1093 mutt_monitor_add(NULL);
1094#endif
1095
1096 const bool c_collapse_all = cs_subset_bool(shared->sub, "collapse_all");
1097 if (mutt_using_threads() && c_collapse_all)
1098 {
1099 collapse_all(shared->mailbox_view, priv->menu, 0);
1101 }
1102
1103 int rc = 0;
1104 do
1105 {
1106 /* Clear the tag prefix unless we just started it.
1107 * Don't clear the prefix on a timeout, but do clear on an abort */
1108 if (priv->tag_prefix && (op != OP_TAG_PREFIX) &&
1109 (op != OP_TAG_PREFIX_COND) && (op != OP_TIMEOUT))
1110 {
1111 priv->tag_prefix = false;
1112 }
1113
1114 /* check if we need to resort the index because just about
1115 * any 'op' below could do mutt_enter_command(), either here or
1116 * from any new priv->menu launched, and change $sort/$sort_aux */
1117 if (OptNeedResort && shared->mailbox && (shared->mailbox->msg_count != 0) &&
1118 (menu_get_index(priv->menu) >= 0))
1119 {
1120 resort_index(shared->mailbox_view, priv->menu);
1121 }
1122
1123 priv->menu->max = shared->mailbox ? shared->mailbox->vcount : 0;
1124 priv->oldcount = shared->mailbox ? shared->mailbox->msg_count : 0;
1125
1126 if (shared->mailbox && shared->mailbox_view)
1127 {
1129
1130 shared->mailbox_view->menu = priv->menu;
1131 /* check for new mail in the mailbox. If nonzero, then something has
1132 * changed about the file (either we got new mail or the file was
1133 * modified underneath us.) */
1134 enum MxStatus check = mx_mbox_check(shared->mailbox);
1135
1136 if (check == MX_STATUS_ERROR)
1137 {
1138 if (buf_is_empty(&shared->mailbox->pathbuf))
1139 {
1140 /* fatal error occurred */
1141 mview_free(&shared->mailbox_view);
1143 }
1144
1146 }
1147 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED) ||
1148 (check == MX_STATUS_FLAGS))
1149 {
1150 /* notify the user of new mail */
1151 if (check == MX_STATUS_REOPENED)
1152 {
1153 mutt_error(_("Mailbox was externally modified. Flags may be wrong."));
1154 }
1155 else if (check == MX_STATUS_NEW_MAIL)
1156 {
1157 for (size_t i = 0; i < shared->mailbox->msg_count; i++)
1158 {
1159 const struct Email *e = shared->mailbox->emails[i];
1160 if (e && !e->read && !e->old)
1161 {
1162 mutt_message(_("New mail in this mailbox"));
1163 const bool c_beep_new = cs_subset_bool(shared->sub, "beep_new");
1164 if (c_beep_new)
1165 mutt_beep(true);
1166 const char *const c_new_mail_command = cs_subset_string(shared->sub, "new_mail_command");
1167 if (c_new_mail_command)
1168 {
1169 char cmd[1024] = { 0 };
1170 menu_status_line(cmd, sizeof(cmd), shared, NULL, sizeof(cmd),
1171 NONULL(c_new_mail_command));
1172 if (mutt_system(cmd) != 0)
1173 mutt_error(_("Error running \"%s\""), cmd);
1174 }
1175 break;
1176 }
1177 }
1178 }
1179 else if (check == MX_STATUS_FLAGS)
1180 {
1181 mutt_message(_("Mailbox was externally modified"));
1182 }
1183
1184 /* avoid the message being overwritten by mailbox */
1185 priv->do_mailbox_notify = false;
1186
1187 bool verbose = shared->mailbox->verbose;
1188 shared->mailbox->verbose = false;
1189 update_index(priv->menu, shared->mailbox_view, check, priv->oldcount, shared);
1190 shared->mailbox->verbose = verbose;
1191 priv->menu->max = shared->mailbox->vcount;
1194 }
1195
1197 menu_get_index(priv->menu)));
1198 }
1199
1200 if (!shared->attach_msg)
1201 {
1202 /* check for new mail in the incoming folders */
1204 if (priv->do_mailbox_notify)
1205 {
1206 if (mutt_mailbox_notify(shared->mailbox))
1207 {
1208 const bool c_beep_new = cs_subset_bool(shared->sub, "beep_new");
1209 if (c_beep_new)
1210 mutt_beep(true);
1211 const char *const c_new_mail_command = cs_subset_string(shared->sub, "new_mail_command");
1212 if (c_new_mail_command)
1213 {
1214 char cmd[1024] = { 0 };
1215 menu_status_line(cmd, sizeof(cmd), shared, priv->menu, sizeof(cmd),
1216 NONULL(c_new_mail_command));
1217 if (mutt_system(cmd) != 0)
1218 mutt_error(_("Error running \"%s\""), cmd);
1219 }
1220 }
1221 }
1222 else
1223 {
1224 priv->do_mailbox_notify = true;
1225 }
1226 }
1227
1228 window_redraw(NULL);
1229
1230 /* give visual indication that the next command is a tag- command */
1231 if (priv->tag_prefix)
1232 {
1233 msgwin_set_text(NULL, "tag-", MT_COLOR_NORMAL);
1234 }
1235
1236 const bool c_arrow_cursor = cs_subset_bool(shared->sub, "arrow_cursor");
1237 const bool c_braille_friendly = cs_subset_bool(shared->sub, "braille_friendly");
1238 const int index = menu_get_index(priv->menu);
1239 if (c_arrow_cursor)
1240 {
1241 const char *const c_arrow_string = cs_subset_string(shared->sub, "arrow_string");
1242 const int arrow_width = mutt_strwidth(c_arrow_string);
1243 mutt_window_move(priv->menu->win, arrow_width, index - priv->menu->top);
1244 }
1245 else if (c_braille_friendly)
1246 {
1247 mutt_window_move(priv->menu->win, 0, index - priv->menu->top);
1248 }
1249 else
1250 {
1251 mutt_window_move(priv->menu->win, priv->menu->win->state.cols - 1,
1252 index - priv->menu->top);
1253 }
1254 mutt_refresh();
1255
1256 window_redraw(NULL);
1258
1259 if (op == OP_REPAINT)
1260 {
1261 priv->menu->top = 0; /* so we scroll the right amount */
1262 /* force a real complete redraw. clrtobot() doesn't seem to be able
1263 * to handle every case without this. */
1264 msgwin_clear_text(NULL);
1265 mutt_refresh();
1266 continue;
1267 }
1268
1269 /* either user abort or timeout */
1270 if (op < OP_NULL)
1271 {
1272 if (priv->tag_prefix)
1273 msgwin_clear_text(NULL);
1274 continue;
1275 }
1276
1277 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
1278
1279 /* special handling for the priv->tag-prefix function */
1280 const bool c_auto_tag = cs_subset_bool(shared->sub, "auto_tag");
1281 if ((op == OP_TAG_PREFIX) || (op == OP_TAG_PREFIX_COND))
1282 {
1283 /* A second priv->tag-prefix command aborts */
1284 if (priv->tag_prefix)
1285 {
1286 priv->tag_prefix = false;
1287 msgwin_clear_text(NULL);
1288 continue;
1289 }
1290
1291 if (!shared->mailbox)
1292 {
1293 mutt_error(_("No mailbox is open"));
1294 continue;
1295 }
1296
1297 if (shared->mailbox->msg_tagged == 0)
1298 {
1299 if (op == OP_TAG_PREFIX)
1300 {
1301 mutt_error(_("No tagged messages"));
1302 }
1303 else if (op == OP_TAG_PREFIX_COND)
1304 {
1306 mutt_message(_("Nothing to do"));
1307 }
1308 continue;
1309 }
1310
1311 /* get the real command */
1312 priv->tag_prefix = true;
1313 continue;
1314 }
1315 else if (c_auto_tag && shared->mailbox && (shared->mailbox->msg_tagged != 0))
1316 {
1317 priv->tag_prefix = true;
1318 }
1319
1321
1322 OptNews = false; /* for any case */
1323
1324#ifdef USE_NOTMUCH
1325 nm_db_debug_check(shared->mailbox);
1326#endif
1327
1328 rc = index_function_dispatcher(priv->win_index, op);
1329
1330 if (rc == FR_UNKNOWN)
1331 rc = menu_function_dispatcher(priv->win_index, op);
1332
1333 if (rc == FR_UNKNOWN)
1334 {
1335 struct MuttWindow *win_sidebar = window_find_child(dlg, WT_SIDEBAR);
1336 rc = sb_function_dispatcher(win_sidebar, op);
1337 }
1338 if (rc == FR_UNKNOWN)
1339 rc = global_function_dispatcher(NULL, op);
1340
1341 if (rc == FR_UNKNOWN)
1343
1344#ifdef USE_NOTMUCH
1345 nm_db_debug_check(shared->mailbox);
1346#endif
1347 } while (rc != FR_DONE);
1348
1349 mview_free(&shared->mailbox_view);
1350 window_set_focus(old_focus);
1351
1352 return shared->mailbox;
1353}
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:58
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition: compile.c:777
void mutt_refresh(void)
Force a refresh of the screen.
Definition: curs_lib.c:75
void mutt_beep(bool force)
Irritate the user.
Definition: curs_lib.c:65
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition: curs_lib.c:454
const struct Mapping IndexNewsHelp[]
Help Bar for the News Index dialog.
Definition: dlg_index.c:113
void update_index(struct Menu *menu, struct MailboxView *mv, enum MxStatus check, int oldcount, const struct IndexSharedData *shared)
Update the index.
Definition: dlg_index.c:538
int find_first_message(struct MailboxView *mv)
Get index of first new message.
Definition: dlg_index.c:305
static const struct Mapping IndexHelp[]
Help Bar for the Index dialog.
Definition: dlg_index.c:98
void resort_index(struct MailboxView *mv, struct Menu *menu)
Resort the index.
Definition: dlg_index.c:365
void collapse_all(struct MailboxView *mv, struct Menu *menu, int toggle)
Collapse/uncollapse all threads.
Definition: dlg_index.c:161
void mutt_flush_macro_to_endcond(void)
Drop a macro from the input buffer.
Definition: get.c:165
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: globals.c:74
int sb_function_dispatcher(struct MuttWindow *win, int op)
Perform a Sidebar function - Implements function_dispatcher_t -.
Definition: functions.c:374
int index_function_dispatcher(struct MuttWindow *win, int op)
Perform an Index function - Implements function_dispatcher_t -.
Definition: functions.c:3254
#define mutt_message(...)
Definition: logging2.h:91
const struct AttrColor * index_color(struct Menu *menu, int line)
Calculate the colour for a line of the index - Implements Menu::color() -.
Definition: dlg_index.c:885
void index_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format an Email for the Menu - Implements Menu::make_entry() -.
Definition: dlg_index.c:790
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
Definition: shared_data.c:234
void index_shared_data_set_mview(struct IndexSharedData *shared, struct MailboxView *mv)
Set the MailboxView for the Index and friends.
Definition: shared_data.c:159
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
Definition: index.c:182
void mailbox_gc_run(void)
Run the garbage-collection.
Definition: mailbox.c:305
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
Definition: mailbox.h:49
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:60
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:180
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:156
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition: menu.c:170
int mutt_monitor_add(struct Mailbox *m)
Add a watch for a mailbox.
Definition: monitor.c:480
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
Definition: msgwin.c:516
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
Definition: mutt_mailbox.c:166
bool mutt_mailbox_notify(struct Mailbox *m_cur)
Notify the user if there's new mail.
Definition: mutt_mailbox.c:232
#define mutt_using_threads()
Definition: mutt_thread.h:112
void mutt_window_reflow(struct MuttWindow *win)
Resize a Window and its children.
Definition: mutt_window.c:344
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
Definition: mutt_window.c:297
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ WT_SIDEBAR
Side panel containing Accounts or groups of data.
Definition: mutt_window.h:101
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:417
void mview_free(struct MailboxView **ptr)
Free a MailboxView.
Definition: mview.c:49
struct MailboxView * mview_new(struct Mailbox *m, struct Notify *parent)
Create a new MailboxView.
Definition: mview.c:90
enum MxStatus mx_mbox_check(struct Mailbox *m)
Check for new mail - Wrapper for MxOps::mbox_check()
Definition: mx.c:1099
#define MUTT_MAILBOX_CHECK_NO_FLAGS
No flags are set.
Definition: mxapi.h:53
#define MUTT_MAILBOX_CHECK_FORCE
Ignore MailboxTime and check for new mail.
Definition: mxapi.h:54
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_snc(), and mbox_close()
Definition: mxapi.h:63
@ MX_STATUS_ERROR
An error occurred.
Definition: mxapi.h:64
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
Definition: mxapi.h:69
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition: mxapi.h:68
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition: mxapi.h:66
void nm_db_debug_check(struct Mailbox *m)
Check if the database is open.
Definition: db.c:388
#define OP_REPAINT
Repaint is needed.
Definition: opcodes.h:32
int mutt_system(const char *cmd)
Run an external command.
Definition: system.c:50
void menu_status_line(char *buf, size_t buflen, struct IndexSharedData *shared, struct Menu *menu, int cols, const char *fmt)
Create the status line.
Definition: status.c:477
#define NONULL(x)
Definition: string2.h:37
The envelope/body of an email.
Definition: email.h:37
bool read
Email is read.
Definition: email.h:48
bool old
Email is seen, but unread.
Definition: email.h:47
int index
The absolute (unsorted) message number.
Definition: email.h:111
Private state data for the Index.
Definition: private_data.h:35
struct MuttWindow * win_index
Window for the Index.
Definition: private_data.h:42
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:40
bool tag_prefix
tag-prefix has been pressed
Definition: private_data.h:36
bool do_mailbox_notify
Do we need to notify the user of new mail?
Definition: private_data.h:38
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:41
int oldcount
Old count of mails in the mailbox.
Definition: private_data.h:37
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
bool attach_msg
Are we in "attach message" mode?
Definition: shared_data.h:46
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:38
struct MailboxView * mailbox_view
Current Mailbox view.
Definition: shared_data.h:40
struct SearchState * search_state
State of the current search.
Definition: shared_data.h:45
struct Menu * menu
Needed for pattern compilation.
Definition: mview.h:46
int vcount
The number of virtual messages.
Definition: mailbox.h:99
int msg_count
Total number of messages.
Definition: mailbox.h:88
enum MailboxType type
Mailbox type.
Definition: mailbox.h:102
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
struct Buffer pathbuf
Path of the Mailbox.
Definition: mailbox.h:80
int msg_tagged
How many messages are tagged?
Definition: mailbox.h:94
bool verbose
Display status messages?
Definition: mailbox.h:116
const struct AttrColor *(* color)(struct Menu *menu, int line)
Definition: lib.h:133
int top
Entry that is the top of the current page.
Definition: lib.h:81
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
struct PatternList * pattern
compiled search pattern
Definition: search_state.h:36
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
@ MENU_INDEX
Index panel (list of emails)
Definition: type.h:51
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_mixmaster()

void dlg_mixmaster ( struct ListHead *  chainhead)

Create a Mixmaster chain -.

Parameters
chainheadList of chain links

The Mixmaster Dialogs allows the user to create a chain of anonymous remailers. The user can add/delete/reorder the hostss.

Definition at line 186 of file dlg_mixmaster.c.

187{
188 struct MixmasterPrivateData priv = { 0 };
189
190 struct RemailerArray ra = remailer_get_hosts();
191 if (ARRAY_EMPTY(&ra))
192 {
193 mutt_error(_("Can't get mixmaster's type2.list"));
194 return;
195 }
196
197 struct MuttWindow *dlg = mix_dlg_new(&priv, &ra);
198
199 win_chain_init(priv.win_chain, chainhead, &ra);
200 mutt_list_free(chainhead);
201
202 dialog_push(dlg);
203 struct MuttWindow *old_focus = window_set_focus(priv.win_hosts);
204
205 // ---------------------------------------------------------------------------
206 // Event Loop
207 int op = OP_NULL;
208 int rc = FR_UNKNOWN;
209 do
210 {
212 window_redraw(NULL);
213
215 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
216 if (op < 0)
217 continue;
218 if (op == OP_NULL)
219 {
221 continue;
222 }
224
225 rc = mix_function_dispatcher(dlg, op);
226
227 if (rc == FR_UNKNOWN)
228 rc = menu_function_dispatcher(priv.win_hosts, op);
229 if (rc == FR_UNKNOWN)
230 rc = global_function_dispatcher(NULL, op);
231 } while ((rc != FR_DONE) && (rc != FR_NO_ACTION));
232 // ---------------------------------------------------------------------------
233
234 /* construct the remailer list */
235 if (rc == FR_DONE)
236 win_chain_extract(priv.win_chain, chainhead);
237
238 window_set_focus(old_focus);
239 dialog_pop();
240 mutt_window_free(&dlg);
241
243}
@ FR_NO_ACTION
Valid function - no action performed.
Definition: dispatcher.h:37
static struct MuttWindow * mix_dlg_new(struct MixmasterPrivateData *priv, struct RemailerArray *ra)
Create a new Mixmaster Remailer Dialog.
int mix_function_dispatcher(struct MuttWindow *win, int op)
Perform a Mixmaster function - Implements function_dispatcher_t -.
Definition: functions.c:183
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
Definition: list.c:122
struct RemailerArray remailer_get_hosts(void)
Parse the type2.list as given by mixmaster -T.
Definition: remailer.c:114
void remailer_clear_hosts(struct RemailerArray *ra)
Clear a Remailer List.
Definition: remailer.c:205
Private state data for the Mixmaster.
Definition: private_data.h:30
struct MuttWindow * win_chain
Chain Window.
Definition: private_data.h:32
struct MuttWindow * win_hosts
Hosts Window.
Definition: private_data.h:31
@ MENU_MIXMASTER
Create/edit a Mixmaster chain.
Definition: type.h:53
int win_chain_extract(struct MuttWindow *win, struct ListHead *chain)
Extract the Chain list data.
Definition: win_chain.c:233
void win_chain_init(struct MuttWindow *win, struct ListHead *chain, struct RemailerArray *ra)
Initialise the Chain list Window.
Definition: win_chain.c:207
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_gpgme()

struct CryptKeyInfo * dlg_gpgme ( struct CryptKeyInfo keys,
struct Address p,
const char *  s,
unsigned int  app,
bool *  forced_valid 
)

Get the user to select a key -.

Parameters
[in]keysList of keys to select from
[in]pAddress to match
[in]sReal name to display
[in]appFlags, e.g. APPLICATION_PGP
[out]forced_validSet to true if user overrode key's validity
Return values
ptrKey selected by user

The Select GPGME Key Dialog lets the user select a PGP Key to use.

Definition at line 631 of file dlg_gpgme.c.

633{
634 int keymax;
635 int i;
636 sort_t f = NULL;
637 enum MenuType menu_to_use = MENU_GENERIC;
638 bool unusable = false;
639
640 /* build the key table */
641 keymax = 0;
642 i = 0;
643 struct CryptKeyInfo **key_table = NULL;
644 const bool c_pgp_show_unusable = cs_subset_bool(NeoMutt->sub, "pgp_show_unusable");
645 for (struct CryptKeyInfo *k = keys; k; k = k->next)
646 {
647 if (!c_pgp_show_unusable && (k->flags & KEYFLAG_CANTUSE))
648 {
649 unusable = true;
650 continue;
651 }
652
653 if (i == keymax)
654 {
655 keymax += 20;
656 mutt_mem_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax);
657 }
658
659 key_table[i++] = k;
660 }
661
662 if (!i && unusable)
663 {
664 mutt_error(_("All matching keys are marked expired/revoked"));
665 return NULL;
666 }
667
668 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
669 switch (c_pgp_sort_keys & SORT_MASK)
670 {
671 case SORT_ADDRESS:
673 break;
674 case SORT_DATE:
675 f = crypt_sort_date;
676 break;
677 case SORT_KEYID:
679 break;
680 case SORT_TRUST:
681 default:
683 break;
684 }
685
686 if (key_table)
687 {
688 bool sort_reverse = c_pgp_sort_keys & SORT_REVERSE;
689 mutt_qsort_r(key_table, i, sizeof(struct CryptKeyInfo *), f, &sort_reverse);
690 }
691
692 if (app & APPLICATION_PGP)
693 menu_to_use = MENU_KEY_SELECT_PGP;
694 else if (app & APPLICATION_SMIME)
695 menu_to_use = MENU_KEY_SELECT_SMIME;
696
697 struct MuttWindow *dlg = simple_dialog_new(menu_to_use, WT_DLG_GPGME, GpgmeHelp);
698
699 struct Menu *menu = dlg->wdata;
700 menu->max = i;
702 menu->mdata = key_table;
704
705 struct GpgmeData gd = { false, menu, key_table, NULL, forced_valid };
706 dlg->wdata = &gd;
707
708 // NT_COLOR is handled by the SimpleDialog
711
712 const char *ts = NULL;
713
714 if ((app & APPLICATION_PGP) && (app & APPLICATION_SMIME))
715 ts = _("PGP and S/MIME keys matching");
716 else if ((app & APPLICATION_PGP))
717 ts = _("PGP keys matching");
718 else if ((app & APPLICATION_SMIME))
719 ts = _("S/MIME keys matching");
720 else
721 ts = _("keys matching");
722
723 char buf[1024] = { 0 };
724 if (p)
725 {
726 /* L10N: 1$s is one of the previous four entries.
727 %2$s is an address.
728 e.g. "S/MIME keys matching <john.doe@example.com>" */
729 snprintf(buf, sizeof(buf), _("%s <%s>"), ts, buf_string(p->mailbox));
730 }
731 else
732 {
733 /* L10N: e.g. 'S/MIME keys matching "John Doe".' */
734 snprintf(buf, sizeof(buf), _("%s \"%s\""), ts, s);
735 }
736
737 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
738 sbar_set_title(sbar, buf);
739
741
742 struct MuttWindow *old_focus = window_set_focus(menu->win);
743 // ---------------------------------------------------------------------------
744 // Event Loop
745 int op = OP_NULL;
746 do
747 {
748 menu_tagging_dispatcher(menu->win, op);
749 window_redraw(NULL);
750
751 op = km_dokey(menu_to_use, GETCH_NO_FLAGS);
752 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
753 if (op < 0)
754 continue;
755 if (op == OP_NULL)
756 {
757 km_error_key(menu_to_use);
758 continue;
759 }
761
762 int rc = gpgme_function_dispatcher(dlg, op);
763
764 if (rc == FR_UNKNOWN)
765 rc = menu_function_dispatcher(menu->win, op);
766 if (rc == FR_UNKNOWN)
767 rc = global_function_dispatcher(NULL, op);
768 } while (!gd.done);
769 // ---------------------------------------------------------------------------
770
771 window_set_focus(old_focus);
772 simple_dialog_free(&dlg);
773 return gd.key;
774}
static const struct Mapping GpgmeHelp[]
Help Bar for the GPGME key selection dialog.
Definition: dlg_gpgme.c:93
int gpgme_function_dispatcher(struct MuttWindow *win, int op)
Perform a Gpgme function - Implements function_dispatcher_t -.
static void crypt_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a PGP Key for the Menu - Implements Menu::make_entry() -.
Definition: dlg_gpgme.c:542
static void gpgme_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_gpgme.c:560
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:568
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:597
static int crypt_sort_trust(const void *a, const void *b, void *sdata)
Compare two keys by their trust levels - Implements sort_t -.
Definition: dlg_gpgme.c:189
static int crypt_sort_address(const void *a, const void *b, void *sdata)
Compare two keys by their addresses - Implements sort_t -.
Definition: dlg_gpgme.c:115
static int crypt_sort_date(const void *a, const void *b, void *sdata)
Compare two keys by their dates - Implements sort_t -.
Definition: dlg_gpgme.c:153
static int crypt_sort_keyid(const void *a, const void *b, void *sdata)
Compare two keys by their IDs - Implements sort_t -.
Definition: dlg_gpgme.c:134
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
Definition: mutt_window.h:83
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:91
#define KEYFLAG_CANTUSE
Definition: lib.h:140
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:92
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
Definition: qsort_r.c:66
int(* sort_t)(const void *a, const void *b, void *sdata)
Definition: qsort_r.h:40
@ SORT_TRUST
Sort by encryption key's trust level.
Definition: sort2.h:52
@ SORT_KEYID
Sort by the encryption key's ID.
Definition: sort2.h:51
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:39
@ SORT_ADDRESS
Sort by email address.
Definition: sort2.h:50
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:75
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
A stored PGP key.
Definition: crypt_gpgme.h:44
struct CryptKeyInfo * next
Linked list.
Definition: crypt_gpgme.h:45
Data to pass to the Gpgme Functions.
bool * forced_valid
User insists on out-of-date key.
struct CryptKeyInfo * key
Selected Key.
struct CryptKeyInfo ** key_table
Array of Keys.
bool done
Should we close the Dialog?
struct Menu * menu
Gpgme Menu.
MenuType
Types of GUI selections.
Definition: type.h:36
@ MENU_KEY_SELECT_PGP
Select a PGP key.
Definition: type.h:48
@ MENU_KEY_SELECT_SMIME
Select a SMIME key.
Definition: type.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_pgp()

struct PgpKeyInfo * dlg_pgp ( struct PgpKeyInfo keys,
struct Address p,
const char *  s 
)

Let the user select a key to use -.

Parameters
keysList of PGP keys
pAddress to match
sString to match
Return values
ptrSelected PGP key

The Select PGP Key Dialog lets the user select an PGP Key to use.

Definition at line 531 of file dlg_pgp.c.

532{
533 struct PgpUid **key_table = NULL;
534 struct Menu *menu = NULL;
535 char buf[1024] = { 0 };
536 struct PgpUid *a = NULL;
537 bool unusable = false;
538 int keymax = 0;
539
540 const bool c_pgp_show_unusable = cs_subset_bool(NeoMutt->sub, "pgp_show_unusable");
541 int i = 0;
542 for (struct PgpKeyInfo *kp = keys; kp; kp = kp->next)
543 {
544 if (!c_pgp_show_unusable && (kp->flags & KEYFLAG_CANTUSE))
545 {
546 unusable = true;
547 continue;
548 }
549
550 for (a = kp->address; a; a = a->next)
551 {
552 if (!c_pgp_show_unusable && (a->flags & KEYFLAG_CANTUSE))
553 {
554 unusable = true;
555 continue;
556 }
557
558 if (i == keymax)
559 {
560 keymax += 5;
561 mutt_mem_realloc(&key_table, sizeof(struct PgpUid *) * keymax);
562 }
563
564 key_table[i++] = a;
565 }
566 }
567
568 if ((i == 0) && unusable)
569 {
570 mutt_error(_("All matching keys are expired, revoked, or disabled"));
571 return NULL;
572 }
573
574 sort_t f = NULL;
575 short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
576 switch (c_pgp_sort_keys & SORT_MASK)
577 {
578 case SORT_ADDRESS:
580 break;
581 case SORT_DATE:
582 f = pgp_sort_date;
583 break;
584 case SORT_KEYID:
585 f = pgp_sort_keyid;
586 break;
587 case SORT_TRUST:
588 default:
589 f = pgp_sort_trust;
590 break;
591 }
592
593 if (key_table)
594 {
595 bool sort_reverse = c_pgp_sort_keys & SORT_REVERSE;
596 mutt_qsort_r(key_table, i, sizeof(struct PgpUid *), f, &sort_reverse);
597 }
598
600
601 menu = dlg->wdata;
602 menu->max = i;
604 menu->mdata = key_table;
606
607 struct PgpData pd = { false, menu, key_table, NULL };
608 dlg->wdata = &pd;
609
610 // NT_COLOR is handled by the SimpleDialog
613
614 if (p)
615 snprintf(buf, sizeof(buf), _("PGP keys matching <%s>"), buf_string(p->mailbox));
616 else
617 snprintf(buf, sizeof(buf), _("PGP keys matching \"%s\""), s);
618
619 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
620 sbar_set_title(sbar, buf);
621
623
624 struct MuttWindow *old_focus = window_set_focus(menu->win);
625 // ---------------------------------------------------------------------------
626 // Event Loop
627 int op = OP_NULL;
628 do
629 {
630 menu_tagging_dispatcher(menu->win, op);
631 window_redraw(NULL);
632
634 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
635 if (op < 0)
636 continue;
637 if (op == OP_NULL)
638 {
640 continue;
641 }
643
644 int rc = pgp_function_dispatcher(dlg, op);
645
646 if (rc == FR_UNKNOWN)
647 rc = menu_function_dispatcher(menu->win, op);
648 if (rc == FR_UNKNOWN)
649 rc = global_function_dispatcher(NULL, op);
650 } while (!pd.done);
651 // ---------------------------------------------------------------------------
652
653 window_set_focus(old_focus);
654 simple_dialog_free(&dlg);
655 return pd.key;
656}
static const struct Mapping PgpHelp[]
Help Bar for the PGP key selection dialog.
Definition: dlg_pgp.c:93
int pgp_function_dispatcher(struct MuttWindow *win, int op)
Perform a Pgp function - Implements function_dispatcher_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() -.
Definition: dlg_pgp.c:443
static void pgp_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_pgp.c:462
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:499
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:470
static int pgp_sort_trust(const void *a, const void *b, void *sdata)
Compare two keys by their trust levels - Implements sort_t -.
Definition: dlg_pgp.c:166
static int pgp_sort_keyid(const void *a, const void *b, void *sdata)
Compare two keys by their IDs - Implements sort_t -.
Definition: dlg_pgp.c:147
static int pgp_sort_date(const void *a, const void *b, void *sdata)
Compare two keys by their dates - Implements sort_t -.
Definition: dlg_pgp.c:128
static int pgp_sort_address(const void *a, const void *b, void *sdata)
Compare two keys by their addresses - Implements sort_t -.
Definition: dlg_pgp.c:109
@ WT_DLG_PGP
Pgp Dialog, dlg_pgp()
Definition: mutt_window.h:88
Data to pass to the Pgp Functions.
Definition: pgp_functions.h:34
struct PgpUid ** key_table
Array of Keys.
Definition: pgp_functions.h:37
struct Menu * menu
Pgp Menu.
Definition: pgp_functions.h:36
bool done
Should we close the Dialog?
Definition: pgp_functions.h:35
struct PgpKeyInfo * key
Selected Key.
Definition: pgp_functions.h:38
Information about a PGP key.
Definition: pgplib.h:47
struct PgpKeyInfo * next
Definition: pgplib.h:57
PGP User ID.
Definition: pgplib.h:35
int flags
Definition: pgplib.h:38
struct PgpUid * next
Linked list.
Definition: pgplib.h:40
@ MENU_PGP
PGP encryption menu.
Definition: type.h:56
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_smime()

struct SmimeKey * dlg_smime ( struct SmimeKey keys,
const char *  query 
)

Get the user to select a key -.

Parameters
keysList of keys to select from
queryString to match
Return values
ptrKey selected by user

The Select SMIME Key Dialog lets the user select an SMIME Key to use.

Definition at line 195 of file dlg_smime.c.

196{
197 struct SmimeKey **table = NULL;
198 int table_size = 0;
199 int table_index = 0;
200 struct SmimeKey *key = NULL;
201
202 for (table_index = 0, key = keys; key; key = key->next)
203 {
204 if (table_index == table_size)
205 {
206 table_size += 5;
207 mutt_mem_realloc(&table, sizeof(struct SmimeKey *) * table_size);
208 }
209
210 table[table_index++] = key;
211 }
212
214
215 struct Menu *menu = dlg->wdata;
216 menu->max = table_index;
218 menu->mdata = table;
220 /* sorting keys might be done later - TODO */
221
222 struct SmimeData sd = { false, menu, table, NULL };
223 dlg->wdata = &sd;
224
225 char title[256] = { 0 };
226 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
227 snprintf(title, sizeof(title), _("S/MIME certificates matching \"%s\""), query);
228 sbar_set_title(sbar, title);
229
231
232 struct MuttWindow *old_focus = window_set_focus(menu->win);
233 // ---------------------------------------------------------------------------
234 // Event Loop
235 int op = OP_NULL;
236 do
237 {
238 menu_tagging_dispatcher(menu->win, op);
239 window_redraw(NULL);
240
242 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
243 if (op < 0)
244 continue;
245 if (op == OP_NULL)
246 {
248 continue;
249 }
251
252 int rc = smime_function_dispatcher(dlg, op);
253
254 if (rc == FR_UNKNOWN)
255 rc = menu_function_dispatcher(menu->win, op);
256 if (rc == FR_UNKNOWN)
257 rc = global_function_dispatcher(NULL, op);
258 } while (!sd.done);
259
260 window_set_focus(old_focus);
261 simple_dialog_free(&dlg);
262 return sd.key;
263}
static const struct Mapping SmimeHelp[]
Help Bar for the Smime key selection dialog.
Definition: dlg_smime.c:72
int smime_function_dispatcher(struct MuttWindow *win, int op)
Perform a Smime function - Implements function_dispatcher_t -.
static void smime_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format an S/MIME Key for the Menu - Implements Menu::make_entry() -.
Definition: dlg_smime.c:110
static void smime_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_smime.c:182
@ WT_DLG_SMIME
Smime Dialog, dlg_smime()
Definition: mutt_window.h:92
Data to pass to the Smime Functions.
struct SmimeKey * key
Selected Key.
bool done
Should we close the Dialog?
struct Menu * menu
Smime Menu.
struct SmimeKey ** table
Array of Keys.
An SIME key.
Definition: smime.h:44
struct SmimeKey * next
Definition: smime.h:51
@ MENU_SMIME
SMIME encryption menu.
Definition: type.h:59
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_pager()

int dlg_pager ( struct PagerView pview)

Display an email, attachment, or help, in a window -.

Parameters
pviewPager view settings
Return values
0Success
-1Error

The Pager Dialog displays an Email to the user.

They can navigate through the Email, search through it and user color commands to highlight it.

From the Pager, the user can also use some Index functions, such as <next-entry> or <delete>.

This pager is actually not so simple as it once was. But it will be again. Currently it operates in 3 modes:

  • viewing messages. (PAGER_MODE_EMAIL)
  • viewing attachments. (PAGER_MODE_ATTACH)
  • viewing other stuff (e.g. help). (PAGER_MODE_OTHER) These can be distinguished by PagerMode in PagerView. Data is not yet polymorphic and is fused into a single struct (PagerData). Different elements of PagerData are expected to be present depending on the mode:
  • PAGER_MODE_EMAIL expects data->email and not expects data->body
  • PAGER_MODE_ATTACH expects data->email and data->body special sub-case of this mode is viewing attached email message it is recognized by presence of data->fp and data->body->email
  • PAGER_MODE_OTHER does not expect data->email or data->body

Definition at line 215 of file dlg_pager.c.

216{
217 //===========================================================================
218 // ACT 1 - Ensure sanity of the caller and determine the mode
219 //===========================================================================
220 assert(pview);
221 assert((pview->mode > PAGER_MODE_UNKNOWN) && (pview->mode < PAGER_MODE_MAX));
222 assert(pview->pdata); // view can't exist in a vacuum
223 assert(pview->win_pager);
224 assert(pview->win_pbar);
225
226 struct MuttWindow *dlg = dialog_find(pview->win_pager);
227 struct IndexSharedData *shared = dlg->wdata;
228 struct MuttWindow *win_sidebar = window_find_child(dlg, WT_SIDEBAR);
229
230 switch (pview->mode)
231 {
232 case PAGER_MODE_EMAIL:
233 // This case was previously identified by IsEmail macro
234 // we expect data to contain email and not contain body
235 // We also expect email to always belong to some mailbox
236 assert(shared->mailbox_view);
237 assert(shared->mailbox);
238 assert(shared->email);
239 assert(!pview->pdata->body);
240 break;
241
243 // this case was previously identified by IsAttach and IsMsgAttach
244 // macros, we expect data to contain:
245 // - body (viewing regular attachment)
246 // - fp and body->email in special case of viewing an attached email.
247 assert(pview->pdata->body);
248 if (pview->pdata->fp && pview->pdata->body->email)
249 {
250 // Special case: attachment is a full-blown email message.
251 // Yes, emails can contain other emails.
252 pview->mode = PAGER_MODE_ATTACH_E;
253 }
254 break;
255
256 case PAGER_MODE_HELP:
257 case PAGER_MODE_OTHER:
258 assert(!shared->mailbox_view);
259 assert(!shared->email);
260 assert(!pview->pdata->body);
261 break;
262
264 case PAGER_MODE_MAX:
265 default:
266 // Unexpected mode. Catch fire and explode.
267 // This *should* happen if mode is PAGER_MODE_ATTACH_E, since
268 // we do not expect any caller to pass it to us.
269 assert(false);
270 break;
271 }
272
273 //===========================================================================
274 // ACT 2 - Declare, initialize local variables, read config, etc.
275 //===========================================================================
276
277 //---------- local variables ------------------------------------------------
278 int op = 0;
279 enum MailboxType mailbox_type = shared->mailbox ? shared->mailbox->type : MUTT_UNKNOWN;
280 struct PagerPrivateData *priv = pview->win_pager->parent->wdata;
281 priv->rc = -1;
282 priv->searchctx = 0;
283 priv->first = true;
284 priv->wrapped = false;
285 priv->delay_read_timestamp = 0;
286 priv->pager_redraw = false;
287
288 // Wipe any previous state info
289 struct Notify *notify = priv->notify;
290 int prc = priv->rc;
291 memset(priv, 0, sizeof(*priv));
292 priv->rc = prc;
293 priv->notify = notify;
294 TAILQ_INIT(&priv->ansi_list);
295
296 //---------- setup flags ----------------------------------------------------
297 if (!(pview->flags & MUTT_SHOWCOLOR))
298 pview->flags |= MUTT_SHOWFLAT;
299
300 if ((pview->mode == PAGER_MODE_EMAIL) && !shared->email->read)
301 {
302 if (shared->mailbox_view)
303 shared->mailbox_view->msg_in_pager = shared->email->msgno;
304 const short c_pager_read_delay = cs_subset_number(NeoMutt->sub, "pager_read_delay");
305 if (c_pager_read_delay == 0)
306 {
307 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
308 }
309 else
310 {
311 priv->delay_read_timestamp = mutt_date_now_ms() + (1000 * c_pager_read_delay);
312 }
313 }
314 //---------- setup help menu ------------------------------------------------
315 pview->win_pager->help_data = pager_resolve_help_mapping(pview->mode, mailbox_type);
317
318 //---------- initialize redraw pdata -----------------------------------------
320 priv->lines_max = LINES; // number of lines on screen, from curses
321 priv->lines = mutt_mem_calloc(priv->lines_max, sizeof(struct Line));
322 priv->fp = fopen(pview->pdata->fname, "r");
323 priv->has_types = ((pview->mode == PAGER_MODE_EMAIL) || (pview->flags & MUTT_SHOWCOLOR)) ?
324 MUTT_TYPES :
325 0; // main message or rfc822 attachment
326
327 for (size_t i = 0; i < priv->lines_max; i++)
328 {
329 priv->lines[i].cid = -1;
330 priv->lines[i].search_arr_size = -1;
331 priv->lines[i].syntax = mutt_mem_calloc(1, sizeof(struct TextSyntax));
332 (priv->lines[i].syntax)[0].first = -1;
333 (priv->lines[i].syntax)[0].last = -1;
334 }
335
336 // ---------- try to open the pdata file -------------------------------------
337 if (!priv->fp)
338 {
339 mutt_perror("%s", pview->pdata->fname);
340 return -1;
341 }
342
343 if (stat(pview->pdata->fname, &priv->st) != 0)
344 {
345 mutt_perror("%s", pview->pdata->fname);
346 mutt_file_fclose(&priv->fp);
347 return -1;
348 }
349 unlink(pview->pdata->fname);
350 priv->pview = pview;
351
352 //---------- show windows, set focus and visibility --------------------------
353 window_set_visible(pview->win_pager->parent, true);
356
357 struct MuttWindow *old_focus = window_set_focus(pview->win_pager);
358
359 //---------- jump to the bottom if requested ------------------------------
360 if (pview->flags & MUTT_PAGER_BOTTOM)
361 {
362 jump_to_bottom(priv, pview);
363 }
364
365 //-------------------------------------------------------------------------
366 // ACT 3: Read user input and decide what to do with it
367 // ...but also do a whole lot of other things.
368 //-------------------------------------------------------------------------
369
370 // Force an initial paint, which will populate priv->lines
372 window_redraw(NULL);
373
375 do
376 {
379 window_redraw(NULL);
380
381 const bool c_braille_friendly = cs_subset_bool(NeoMutt->sub, "braille_friendly");
382 if (c_braille_friendly)
383 {
384 if (BrailleRow != -1)
385 {
387 BrailleRow = -1;
388 }
389 }
390 else
391 {
392 mutt_window_move(priv->pview->win_pbar, priv->pview->win_pager->state.cols - 1, 0);
393 }
394
395 // force redraw of the screen at every iteration of the event loop
396 mutt_refresh();
397
398 //-------------------------------------------------------------------------
399 // Check if information in the status bar needs an update
400 // This is done because pager is a single-threaded application, which
401 // tries to emulate concurrency.
402 //-------------------------------------------------------------------------
403 bool do_new_mail = false;
404 if (shared->mailbox && !shared->attach_msg)
405 {
406 int oldcount = shared->mailbox->msg_count;
407 /* check for new mail */
408 enum MxStatus check = mx_mbox_check(shared->mailbox);
409 if (check == MX_STATUS_ERROR)
410 {
411 if (!shared->mailbox || buf_is_empty(&shared->mailbox->pathbuf))
412 {
413 /* fatal error occurred */
415 break;
416 }
417 }
418 else if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED) ||
419 (check == MX_STATUS_FLAGS))
420 {
421 /* notify user of newly arrived mail */
422 if (check == MX_STATUS_NEW_MAIL)
423 {
424 for (size_t i = oldcount; i < shared->mailbox->msg_count; i++)
425 {
426 struct Email *e = shared->mailbox->emails[i];
427
428 if (e && !e->read)
429 {
430 mutt_message(_("New mail in this mailbox"));
431 do_new_mail = true;
432 break;
433 }
434 }
435 }
436
437 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
438 {
441 }
442 }
443
444 if (mutt_mailbox_notify(shared->mailbox) || do_new_mail)
445 {
446 const bool c_beep_new = cs_subset_bool(NeoMutt->sub, "beep_new");
447 if (c_beep_new)
448 mutt_beep(true);
449 const char *const c_new_mail_command = cs_subset_string(NeoMutt->sub, "new_mail_command");
450 if (c_new_mail_command)
451 {
452 char cmd[1024] = { 0 };
453 menu_status_line(cmd, sizeof(cmd), shared, NULL, sizeof(cmd),
454 NONULL(c_new_mail_command));
455 if (mutt_system(cmd) != 0)
456 mutt_error(_("Error running \"%s\""), cmd);
457 }
458 }
459 }
460 //-------------------------------------------------------------------------
461
462 if (priv->pager_redraw)
463 {
464 priv->pager_redraw = false;
466 clearok(stdscr, true); /* force complete redraw */
467 msgwin_clear_text(NULL);
468
470 if (pview->flags & MUTT_PAGER_RETWINCH)
471 {
472 /* Store current position. */
473 priv->win_height = -1;
474 for (size_t i = 0; i <= priv->top_line; i++)
475 if (!priv->lines[i].cont_line)
476 priv->win_height++;
477
478 op = OP_ABORT;
479 priv->rc = OP_REFORMAT_WINCH;
480 break;
481 }
482 else
483 {
484 /* note: mutt_resize_screen() -> mutt_window_reflow() sets
485 * PAGER_REDRAW_PAGER and PAGER_REDRAW_FLOW */
486 op = OP_NULL;
487 }
488 continue;
489 }
490
491 dump_pager(priv);
492
493 //-------------------------------------------------------------------------
494 // Finally, read user's key press
495 //-------------------------------------------------------------------------
496 // km_dokey() reads not only user's key strokes, but also a MacroBuffer
497 // MacroBuffer may contain OP codes of the operations.
498 // MacroBuffer is global
499 // OP codes inserted into the MacroBuffer by various functions.
500 // One of such functions is `mutt_enter_command()`
501 // Some OP codes are not handled by pager, they cause pager to quit returning
502 // OP code to index. Index handles the operation and then restarts pager
504
505 // km_dokey() can block, so recheck the timer.
506 // Note: This check must occur before handling the operations of the index
507 // as those can change the currently selected message/entry yielding to
508 // marking the wrong message as read.
510 {
511 mutt_set_flag(shared->mailbox, shared->email, MUTT_READ, true, true);
512 }
513
514 if (SigWinch)
515 priv->pager_redraw = true;
516
517 if (op >= OP_NULL)
519
520 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
521
522 if (op < OP_NULL)
523 {
524 op = OP_NULL;
525 continue;
526 }
527
528 if (op == OP_NULL)
529 {
531 continue;
532 }
533
534 int rc = pager_function_dispatcher(priv->pview->win_pager, op);
535
536 if (pview->mode == PAGER_MODE_EMAIL)
537 {
538 if ((rc == FR_UNKNOWN) && priv->pview->win_index)
540 if (rc == FR_UNKNOWN)
541 rc = sb_function_dispatcher(win_sidebar, op);
542 }
543 if (rc == FR_UNKNOWN)
544 rc = global_function_dispatcher(NULL, op);
545
546 if ((rc == FR_UNKNOWN) &&
547 ((pview->mode == PAGER_MODE_ATTACH) || (pview->mode == PAGER_MODE_ATTACH_E)))
548 {
549 // Some attachment functions still need to be delegated
550 priv->rc = op;
551 break;
552 }
553
554 if ((pview->mode != PAGER_MODE_EMAIL) && (rc == FR_UNKNOWN))
556
557 } while (priv->loop == PAGER_LOOP_CONTINUE);
558 window_set_focus(old_focus);
559
560 //-------------------------------------------------------------------------
561 // END OF ACT 3: Read user input loop - while (op != OP_ABORT)
562 //-------------------------------------------------------------------------
563
564 mutt_file_fclose(&priv->fp);
565 if (pview->mode == PAGER_MODE_EMAIL)
566 {
567 if (shared->mailbox_view)
568 shared->mailbox_view->msg_in_pager = -1;
569 }
570
572
573 for (size_t i = 0; i < priv->lines_max; i++)
574 {
575 FREE(&(priv->lines[i].syntax));
576 if (priv->search_compiled && priv->lines[i].search)
577 FREE(&(priv->lines[i].search));
578 }
579 if (priv->search_compiled)
580 {
581 regfree(&priv->search_re);
582 priv->search_compiled = false;
583 }
584 FREE(&priv->lines);
586 {
587 struct AttrColor *ac = NULL;
588 int count = 0;
589 TAILQ_FOREACH(ac, &priv->ansi_list, entries)
590 {
591 count++;
592 }
593 color_debug(LL_DEBUG5, "AnsiColors %d\n", count);
594 }
595
596 priv->pview = NULL;
597
598 if (priv->loop == PAGER_LOOP_RELOAD)
599 return PAGER_LOOP_RELOAD;
600
601 return (priv->rc != -1) ? priv->rc : 0;
602}
void attr_color_list_clear(struct AttrColorList *acl)
Free the contents of an AttrColorList.
Definition: attr.c:118
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
Definition: helpers.c:144
void mutt_flushinp(void)
Empty all the keyboard buffers.
Definition: get.c:57
void dump_pager(struct PagerPrivateData *priv)
Definition: pager.c:101
static int color_debug(enum LogLevel level, const char *format,...)
Definition: debug.h:53
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:89
int BrailleRow
Braille display: row to leave the cursor.
Definition: dlg_pager.c:67
int BrailleCol
Braille display: column to leave the cursor.
Definition: dlg_pager.c:69
static bool check_read_delay(uint64_t *timestamp)
Is it time to mark the message read?
Definition: dlg_pager.c:176
void pager_queue_redraw(struct PagerPrivateData *priv, PagerRedrawFlags redraw)
Queue a request for a redraw.
Definition: dlg_pager.c:127
static const struct Mapping * pager_resolve_help_mapping(enum PagerMode mode, enum MailboxType type)
Determine help mapping based on pager mode and mailbox type.
Definition: dlg_pager.c:139
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
Definition: file.c:152
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
Definition: flags.c:53
SIG_ATOMIC_VOLATILE_T SigWinch
true after SIGWINCH is received
Definition: globals.c:60
int pager_function_dispatcher(struct MuttWindow *win, int op)
Perform a Pager function - Implements function_dispatcher_t -.
Definition: functions.c:1125
#define mutt_perror(...)
Definition: logging2.h:93
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
MailboxType
Supported mailbox formats.
Definition: mailbox.h:41
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition: mailbox.h:44
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define FREE(x)
Definition: memory.h:45
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
Definition: date.c:455
@ MUTT_READ
Messages that have been read.
Definition: mutt.h:72
void mutt_resize_screen(void)
Update NeoMutt's opinion about the window size.
Definition: resize.c:74
void window_set_visible(struct MuttWindow *win, bool visible)
Set a Window visible or hidden.
Definition: mutt_window.c:165
void window_invalidate_all(void)
Mark all windows as in need of repaint.
Definition: mutt_window.c:767
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition: mutt_window.h:48
@ NT_PAGER
Pager data has changed, NotifyPager, PagerPrivateData.
Definition: notify_type.h:53
#define OP_ABORT
$abort_key pressed (Ctrl-G)
Definition: opcodes.h:35
bool jump_to_bottom(struct PagerPrivateData *priv, struct PagerView *pview)
Make sure the bottom line is displayed.
Definition: functions.c:376
@ PAGER_LOOP_RELOAD
Reload the Pager from scratch.
Definition: lib.h:153
@ PAGER_LOOP_CONTINUE
Stay in the Pager Event Loop.
Definition: lib.h:151
#define MUTT_PAGER_RETWINCH
Need reformatting on SIGWINCH.
Definition: lib.h:70
#define NT_PAGER_VIEW
Pager View has changed.
Definition: lib.h:186
#define MUTT_TYPES
Compute line's type.
Definition: lib.h:64
#define MUTT_SHOWCOLOR
Show characters in color otherwise don't show characters.
Definition: lib.h:61
#define PAGER_REDRAW_FLOW
Reflow the pager.
Definition: lib.h:191
#define MUTT_PAGER_BOTTOM
Start at the bottom.
Definition: lib.h:74
@ PAGER_MODE_OTHER
Pager is invoked via 3rd path. Non-email content is likely to be shown.
Definition: lib.h:141
@ PAGER_MODE_HELP
Pager is invoked via 3rd path to show help.
Definition: lib.h:140
@ PAGER_MODE_ATTACH
Pager is invoked via 2nd path. A user-selected attachment (mime part or a nested email) will be shown...
Definition: lib.h:138
@ PAGER_MODE_EMAIL
Pager is invoked via 1st path. The mime part is selected automatically.
Definition: lib.h:137
@ PAGER_MODE_ATTACH_E
A special case of PAGER_MODE_ATTACH - attachment is a full-blown email message.
Definition: lib.h:139
@ PAGER_MODE_UNKNOWN
A default and invalid mode, should never be used.
Definition: lib.h:135
@ PAGER_MODE_MAX
Another invalid mode, should never be used.
Definition: lib.h:143
#define PAGER_REDRAW_PAGER
Redraw the pager.
Definition: lib.h:190
#define MUTT_SHOWFLAT
Show characters (used for displaying help)
Definition: lib.h:60
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define TAILQ_INIT(head)
Definition: queue.h:765
void qstyle_free_tree(struct QuoteStyle **quote_list)
Free an entire tree of QuoteStyle.
Definition: quoted.c:215
A curses colour and its attributes.
Definition: attr.h:66
struct Email * email
header information for message/rfc822
Definition: body.h:73
int msgno
Number displayed to the user.
Definition: email.h:112
struct Email * email
Currently selected Email.
Definition: shared_data.h:42
A line of text in the pager.
Definition: display.h:51
short search_arr_size
Number of items in search array.
Definition: display.h:60
struct TextSyntax * search
Array of search text in the line.
Definition: display.h:61
bool cont_line
Continuation of a previous line (wrapped by NeoMutt)
Definition: display.h:54
short cid
Default line colour, e.g. MT_COLOR_QUOTED.
Definition: display.h:53
struct TextSyntax * syntax
Array of coloured text in the line.
Definition: display.h:58
int msg_in_pager
Message currently shown in the pager.
Definition: mview.h:44
struct MuttWindow * parent
Parent Window.
Definition: mutt_window.h:135
enum MuttWindowSize size
Type of Window, e.g. MUTT_WIN_SIZE_FIXED.
Definition: mutt_window.h:131
Notification API.
Definition: notify.c:53
const char * fname
Name of the file to read.
Definition: lib.h:164
FILE * fp
Source stream.
Definition: lib.h:162
struct Body * body
Current attachment.
Definition: lib.h:161
Private state data for the Pager.
Definition: private_data.h:41
int rc
Return code from functions.
Definition: private_data.h:73
bool wrapped
Has the search/next wrapped around?
Definition: private_data.h:76
bool pager_redraw
Force a complete redraw.
Definition: private_data.h:78
int lines_max
Capacity of lines array (total entries)
Definition: private_data.h:50
uint64_t delay_read_timestamp
Time that email was first shown.
Definition: private_data.h:77
enum PagerLoopMode loop
What the Event Loop should do next, e.g. PAGER_LOOP_CONTINUE.
Definition: private_data.h:79
struct Line * lines
Array of text lines in pager.
Definition: private_data.h:48
int has_types
Set to MUTT_TYPES for PAGER_MODE_EMAIL or MUTT_SHOWCOLOR.
Definition: private_data.h:56
struct Notify * notify
Notifications: NotifyPager, PagerPrivateData.
Definition: private_data.h:71
int top_line
First visible line on screen.
Definition: private_data.h:55
struct stat st
Stats about Email file.
Definition: private_data.h:45
bool first
First time flag for toggle-new.
Definition: private_data.h:75
struct QuoteStyle * quote_list
Tree of quoting levels.
Definition: private_data.h:58
struct PagerView * pview
Object to view in the pager.
Definition: private_data.h:42
struct AttrColorList ansi_list
List of ANSI colours used in the Pager.
Definition: private_data.h:70
int searchctx
Space to show around search matches.
Definition: private_data.h:74
regex_t search_re
Compiled search string.
Definition: private_data.h:65
int win_height
Number of lines in the Window.
Definition: private_data.h:54
FILE * fp
File containing decrypted/decoded/weeded Email.
Definition: private_data.h:44
bool search_compiled
Search regex is in use.
Definition: private_data.h:64
struct MuttWindow * win_index
Index Window.
Definition: lib.h:177
struct PagerData * pdata
Data that pager displays. NOTNULL.
Definition: lib.h:172
enum PagerMode mode
Pager mode.
Definition: lib.h:173
PagerFlags flags
Additional settings to tweak pager's function.
Definition: lib.h:174
struct MuttWindow * win_pbar
Pager Bar Window.
Definition: lib.h:178
struct MuttWindow * win_pager
Pager Window.
Definition: lib.h:179
Highlighting for a piece of text.
Definition: display.h:40
@ MENU_PAGER
Pager pager (email viewer)
Definition: type.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_pattern()

bool dlg_pattern ( char *  buf,
size_t  buflen 
)

Show menu to select a Pattern -.

Parameters
bufBuffer for the selected Pattern
buflenLength of buffer
Return values
trueA selection was made

The Select Pattern Dialog shows the user a help page of Patterns. They can select one to auto-complete some functions, e.g. <limit>

Definition at line 337 of file dlg_pattern.c.

338{
340 struct Menu *menu = create_pattern_menu(dlg);
341
342 struct PatternData pd = { false, false, buf, buflen, menu };
343 dlg->wdata = &pd;
344
345 // NT_COLOR is handled by the SimpleDialog
348
349 struct MuttWindow *old_focus = window_set_focus(menu->win);
350 // ---------------------------------------------------------------------------
351 // Event Loop
352 int op = OP_NULL;
353 do
354 {
355 menu_tagging_dispatcher(menu->win, op);
356 window_redraw(NULL);
357
359 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
360 if (op < 0)
361 continue;
362 if (op == OP_NULL)
363 {
365 continue;
366 }
368
369 int rc = pattern_function_dispatcher(dlg, op);
370 if (rc == FR_UNKNOWN)
371 rc = menu_function_dispatcher(menu->win, op);
372 if (rc == FR_UNKNOWN)
373 rc = global_function_dispatcher(NULL, op);
374 } while (!pd.done);
375 // ---------------------------------------------------------------------------
376
377 window_set_focus(old_focus);
378 simple_dialog_free(&dlg);
379 return pd.selection;
380}
static const struct Mapping PatternHelp[]
Help Bar for the Pattern selection dialog.
Definition: dlg_pattern.c:88
static struct Menu * create_pattern_menu(struct MuttWindow *dlg)
Create the Pattern Completion menu.
Definition: dlg_pattern.c:169
int pattern_function_dispatcher(struct MuttWindow *win, int op)
Perform a Pattern function - Implements function_dispatcher_t -.
Definition: functions.c:77
static int pattern_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pattern.c:305
static int pattern_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pattern.c:279
@ WT_DLG_PATTERN
Pattern Dialog, dlg_pattern()
Definition: mutt_window.h:87
Data to pass to the Pattern Functions.
Definition: functions.h:35
char * buf
Buffer for the results.
Definition: functions.h:38
struct Menu * menu
Pattern Menu.
Definition: functions.h:40
bool done
Should we close the Dialog?
Definition: functions.h:36
size_t buflen
Length of the results buffer.
Definition: functions.h:39
bool selection
Was a selection made?
Definition: functions.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dlg_postponed()

struct Email * dlg_postponed ( struct Mailbox m)

Create a Menu to select a postponed message -.

Parameters
mMailbox
Return values
ptrEmail

The Select Postponed Email Dialog shows the user a list of draft emails. They can select one to use in the Compose Dialog.

This dialog is only shown if there are two or more postponed emails.

Definition at line 202 of file dlg_postpone.c.

203{
205 // Required to number the emails
206 struct MailboxView *mv = mview_new(m, NeoMutt->notify);
207
208 struct Menu *menu = dlg->wdata;
210 menu->color = post_color;
211 menu->max = m->msg_count;
212 menu->mdata = mv;
213 menu->mdata_free = NULL; // Menu doesn't own the data
214
215 struct PostponeData pd = { mv, menu, NULL, false, search_state_new() };
216 dlg->wdata = &pd;
217
218 // NT_COLOR is handled by the SimpleDialog
221
222 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
223 sbar_set_title(sbar, _("Postponed Messages"));
224
225 /* The postponed mailbox is setup to have sorting disabled, but the global
226 * `$sort` variable may indicate something different. Sorting has to be
227 * disabled while the postpone menu is being displayed. */
228 const enum SortType c_sort = cs_subset_sort(NeoMutt->sub, "sort");
230
231 struct MuttWindow *old_focus = window_set_focus(menu->win);
232 // ---------------------------------------------------------------------------
233 // Event Loop
234 int op = OP_NULL;
235 do
236 {
237 menu_tagging_dispatcher(menu->win, op);
238 window_redraw(NULL);
239
241 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
242 if (op < 0)
243 continue;
244 if (op == OP_NULL)
245 {
247 continue;
248 }
250
251 int rc = postpone_function_dispatcher(dlg, op);
252
253 if (rc == FR_UNKNOWN)
254 rc = menu_function_dispatcher(menu->win, op);
255 if (rc == FR_UNKNOWN)
256 rc = global_function_dispatcher(NULL, op);
257 } while (!pd.done);
258 // ---------------------------------------------------------------------------
259
260 mview_free(&mv);
261 cs_subset_str_native_set(NeoMutt->sub, "sort", c_sort, NULL);
263 window_set_focus(old_focus);
264 simple_dialog_free(&dlg);
265
266 return pd.email;
267}
static const struct Mapping PostponedHelp[]
Help Bar for the Postponed email selection dialog.
Definition: dlg_postpone.c:89
int postpone_function_dispatcher(struct MuttWindow *win, int op)
Perform a Postpone function - Implements function_dispatcher_t -.
Definition: functions.c:176
static const struct AttrColor * post_color(struct Menu *menu, int line)
Calculate the colour for a line of the postpone index - Implements Menu::color() -.
Definition: dlg_postpone.c:171
static void post_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format an Email for the Menu - Implements Menu::make_entry() -.
Definition: dlg_postpone.c:104
static int postponed_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_postpone.c:145
static int postponed_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_postpone.c:119
@ WT_DLG_POSTPONED
Postponed Dialog, dlg_postponed()
Definition: mutt_window.h:89
void search_state_free(struct SearchState **ptr)
Free a SearchState.
Definition: search_state.c:50
struct SearchState * search_state_new(void)
Create a new SearchState.
Definition: search_state.c:38
View of a Mailbox.
Definition: mview.h:39
Data to pass to the Postpone Functions.
Definition: functions.h:34
struct Email * email
Selected Email.
Definition: functions.h:37
struct SearchState * search_state
State of the current search.
Definition: functions.h:39
bool done
Should we close the Dialog?
Definition: functions.h:38
struct Menu * menu
Postponed Menu.
Definition: functions.h:36
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
Definition: subset.c:304
@ MENU_POSTPONED
Select a postponed email.
Definition: type.h:57
+ Here is the call graph for this function:
+ Here is the caller graph for this function: