NeoMutt  2022-04-29-215-gc12b98
Teaching an old dog new tricks
lib.h File Reference

GUI editor for an email's headers. More...

#include <stdint.h>
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.




int mutt_compose_menu (struct Email *e, struct Buffer *fcc, uint8_t flags, struct ConfigSubset *sub)
 Allow the user to edit the message envelope. More...

Detailed Description

GUI editor for an email's headers.

  • Richard Russon

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

You should have received a copy of the GNU General Public License along with this program. If not, see

Definition in file lib.h.

Macro Definition Documentation



Definition at line 50 of file lib.h.

Function Documentation

◆ mutt_compose_menu()

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

Allow the user to edit the message envelope.

eEmail to fill
fccBuffer to save FCC
Return values
1Message should be postponed
0Normal exit
-1Abort message

Definition at line 307 of file compose.c.

310 struct MuttWindow *dlg = compose_dlg_init(sub, e, fcc);
311 struct ComposeSharedData *shared = dlg->wdata;
312 shared->mailbox = get_current_mailbox();
313 shared->email = e;
314 shared->sub = sub;
315 shared->fcc = fcc;
316 shared->fcc_set = false;
317 shared->flags = flags;
318 shared->rc = -1;
323 dialog_push(dlg);
325#ifdef USE_NNTP
326 if (OptNewsSend)
328 else
330 dlg->help_data = ComposeHelp;
331 dlg->help_menu = MENU_COMPOSE;
333 struct Menu *menu = shared->adata->menu;
334 update_menu(shared->adata->actx, menu, true);
337 struct MuttWindow *win_env = window_find_child(dlg, WT_CUSTOM);
339 // ---------------------------------------------------------------------------
340 // Event Loop
341 int rc = 0;
342 int op = OP_NULL;
343 do
344 {
345#ifdef USE_NNTP
346 OptNews = false; /* for any case */
348 menu_tagging_dispatcher(menu->win, op);
349 window_redraw(NULL);
352 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
353 if (op < 0)
354 continue;
355 if (op == OP_NULL)
356 {
358 continue;
359 }
362 rc = compose_function_dispatcher(dlg, op);
363 if (rc == FR_UNKNOWN)
364 rc = env_function_dispatcher(win_env, op);
365 if (rc == FR_UNKNOWN)
366 rc = menu_function_dispatcher(menu->win, op);
367 if (rc == FR_UNKNOWN)
368 rc = global_function_dispatcher(NULL, op);
369 } while (rc != FR_DONE);
370 // ---------------------------------------------------------------------------
373 /* This is a fail-safe to make sure the bit isn't somehow turned
374 * on. The user could have disabled the option after setting SEC_AUTOCRYPT,
375 * or perhaps resuming or replying to an autocrypt message. */
376 const bool c_autocrypt = cs_subset_bool(sub, "autocrypt");
377 if (!c_autocrypt)
378 e->security &= ~SEC_AUTOCRYPT;
381 if (shared->adata->actx->idxlen)
382 e->body = shared->adata->actx->idx[0]->body;
383 else
384 e->body = NULL;
386 rc = shared->rc;
388 dialog_pop();
389 mutt_window_free(&dlg);
391 return rc;
void update_menu(struct AttachCtx *actx, struct Menu *menu, bool init)
Redraw the compose window.
Definition: compose.c:222
static const struct Mapping ComposeHelp[]
Help Bar for the Compose dialog.
Definition: compose.c:94
static const struct Mapping ComposeNewsHelp[]
Help Bar for the News Compose dialog.
Definition: compose.c:113
static struct MuttWindow * compose_dlg_init(struct ConfigSubset *sub, struct Email *e, struct Buffer *fcc)
Allocate the Windows for Compose.
Definition: compose.c:255
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
void dialog_push(struct MuttWindow *dlg)
Display a Window to the user.
Definition: dialog.c:103
void dialog_pop(void)
Hide a Window from the user.
Definition: dialog.c:137
Exit the Dialog.
Definition: dispatcher.h:35
Unknown function.
Definition: dispatcher.h:33
Email has changed.
Definition: email.h:150
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:223
int env_function_dispatcher(struct MuttWindow *win, int op)
Perform an Envelope function - Implements function_dispatcher_t -.
Definition: functions.c:559
int compose_function_dispatcher(struct MuttWindow *win, int op)
Perform a Compose function - Implements function_dispatcher_t -.
Definition: functions.c:1970
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:164
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:320
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static int compose_email_observer(struct NotifyCallback *nc)
Notification that an Email has changed - Implements observer_t -.
Definition: compose.c:151
static int compose_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: compose.c:130
static int compose_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: compose.c:170
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:624
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:795
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1061
Log at debug level 1.
Definition: logging.h:40
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:189
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:604
void mutt_window_free(struct MuttWindow **ptr)
Free a Window and its children.
Definition: mutt_window.c:201
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
Window with a custom drawing function.
Definition: mutt_window.h:95
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
Email has changed, NotifyEmail, EventEmail.
Definition: notify_type.h:44
Register for all notifications.
Definition: notify_type.h:35
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:46
bool OptNews
(pseudo) used to change reader mode
Definition: options.h:50
bool OptNewsSend
(pseudo) used to change behavior when posting
Definition: options.h:51
struct AttachPtr ** idx
Array of attachments.
Definition: attach.h:55
short idxlen
Number of attachmentes.
Definition: attach.h:56
struct Body * body
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:33
struct ConfigSubset * sub
Config set to use.
Definition: shared_data.h:34
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:35
int flags
Definition: shared_data.h:41
bool fcc_set
User has edited the Fcc: field.
Definition: shared_data.h:42
int rc
Return code to leave compose.
Definition: shared_data.h:43
struct ComposeAttachData * adata
Definition: shared_data.h:37
struct Email * email
Email being composed.
Definition: shared_data.h:36
struct Buffer * fcc
Buffer to save FCC.
Definition: shared_data.h:40
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
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
const struct Mapping * help_data
Data for the Help Bar.
Definition: mutt_window.h:142
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
int help_menu
Menu for key bindings, e.g. MENU_PAGER.
Definition: mutt_window.h:141
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
Compose an email.
Definition: type.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function: