NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_alias.c
Go to the documentation of this file.
1
27
76
77#include "config.h"
78#include <stdbool.h>
79#include <stdio.h>
80#include "mutt/lib.h"
81#include "address/lib.h"
82#include "config/lib.h"
83#include "email/lib.h"
84#include "core/lib.h"
85#include "gui/lib.h"
86#include "lib.h"
87#include "expando/lib.h"
88#include "key/lib.h"
89#include "menu/lib.h"
90#include "pattern/lib.h"
91#include "send/lib.h"
92#include "alias.h"
93#include "expando.h"
94#include "functions.h"
95#include "gui.h"
96#include "module_data.h"
97#include "mutt_logging.h"
98
100static const struct Mapping AliasHelp[] = {
101 // clang-format off
102 { N_("Exit"), OP_EXIT },
103 { N_("Del"), OP_DELETE },
104 { N_("Undel"), OP_UNDELETE },
105 { N_("Sort"), OP_SORT },
106 { N_("Rev-Sort"), OP_SORT_REVERSE },
107 { N_("Select"), OP_GENERIC_SELECT_ENTRY },
108 { N_("Help"), OP_HELP },
109 { NULL, 0 },
110 // clang-format on
111};
112
118static int alias_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
119{
120 const struct AliasMenuData *mdata = menu->mdata;
121 const struct AliasViewArray *ava = &mdata->ava;
122 struct AliasView *av = ARRAY_GET(ava, line);
123
124 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
125 if (c_arrow_cursor)
126 {
127 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
128 if (max_cols > 0)
129 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
130 }
131
132 const struct Expando *c_alias_format = cs_subset_expando(mdata->sub, "alias_format");
133 return expando_filter(c_alias_format, AliasRenderCallbacks, av,
134 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
135}
136
140static int alias_tag(struct Menu *menu, int sel, int act)
141{
142 const struct AliasMenuData *mdata = menu->mdata;
143 const struct AliasViewArray *ava = &mdata->ava;
144 struct AliasView *av = ARRAY_GET(ava, sel);
145
146 bool ot = av->is_tagged;
147
148 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
149
150 return av->is_tagged - ot;
151}
152
157{
158 if (nc->event_type != NT_ALIAS)
159 return 0;
160 if (!nc->global_data || !nc->event_data)
161 return -1;
162
163 struct EventAlias *ev_a = nc->event_data;
164 struct Menu *menu = nc->global_data;
165 struct AliasMenuData *mdata = menu->mdata;
166 struct Alias *alias = ev_a->alias;
167
168 if (nc->event_subtype == NT_ALIAS_ADD)
169 {
170 alias_array_alias_add(&mdata->ava, alias);
171
172 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
173 {
174 mutt_pattern_alias_func(NULL, mdata, PAA_VISIBLE, menu);
175 }
176 }
177 else if (nc->event_subtype == NT_ALIAS_DELETE)
178 {
179 alias_array_alias_delete(&mdata->ava, alias);
180
181 int vcount = alias_array_count_visible(&mdata->ava);
182 int index = menu_get_index(menu);
183 if ((index > (vcount - 1)) && (index > 0))
184 menu_set_index(menu, index - 1);
185 }
186
187 alias_array_sort(&mdata->ava, mdata->sub);
188
189 menu->max = alias_array_count_visible(&mdata->ava);
191 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
192
193 return 0;
194}
195
204{
205 if (nc->event_type != NT_WINDOW)
206 return 0;
207 if (!nc->global_data || !nc->event_data)
208 return -1;
210 return 0;
211
212 struct MuttWindow *win_menu = nc->global_data;
213 struct EventWindow *ev_w = nc->event_data;
214 if (ev_w->win != win_menu)
215 return 0;
216
217 struct Menu *menu = win_menu->wdata;
218
222
223 mutt_debug(LL_DEBUG5, "window delete done\n");
224 return 0;
225}
226
233{
235 ASSERT(mod_data);
236
237 struct SimpleDialogWindows sdw = simple_dialog_new(mod_data->menu_alias,
239
240 struct Menu *menu = sdw.menu;
241
243 menu->tag = alias_tag;
244 menu->max = alias_array_count_visible(&mdata->ava);
245 menu->mdata = mdata;
246 menu->mdata_free = NULL; // Menu doesn't own the data
247
248 struct MuttWindow *win_menu = menu->win;
249
250 // Override the Simple Dialog's recalc()
251 win_menu->recalc = alias_recalc;
252
253 alias_set_title(sdw.sbar, mdata->title, mdata->limit);
254
255 // NT_COLOR is handled by the SimpleDialog
259
260 return sdw;
261}
262
271static bool dlg_alias(struct AliasMenuData *mdata)
272{
274 ASSERT(mod_data);
275
276 if (ARRAY_EMPTY(&mdata->ava))
277 {
278 mutt_warning(_("You have no aliases"));
279 return false;
280 }
281
282 mdata->title = mutt_str_dup(_("Aliases"));
283
284 struct SimpleDialogWindows sdw = alias_dialog_new(mdata);
285 struct Menu *menu = sdw.menu;
286 mdata->menu = menu;
287 mdata->sbar = sdw.sbar;
288
289 alias_array_sort(&mdata->ava, mdata->sub);
290
291 struct AliasView *avp = NULL;
292 ARRAY_FOREACH(avp, &mdata->ava)
293 {
294 avp->num = ARRAY_FOREACH_IDX_avp;
295 }
296
297 struct MuttWindow *old_focus = window_set_focus(menu->win);
298 // ---------------------------------------------------------------------------
299 // Event Loop
300 int rc = 0;
301 int op = OP_NULL;
302 struct KeyEvent event = { 0, OP_NULL };
303 do
304 {
305 menu_tagging_dispatcher(menu->win, &event);
306 window_redraw(NULL);
307
308 event = km_dokey(mod_data->menu_alias, GETCH_NO_FLAGS);
309 op = event.op;
310 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
311 if (op < 0)
312 continue;
313 if (op == OP_NULL)
314 {
315 km_error_key(mod_data->menu_alias);
316 continue;
317 }
319
320 rc = alias_function_dispatcher(sdw.dlg, &event);
321 if (rc == FR_UNKNOWN)
322 rc = menu_function_dispatcher(menu->win, &event);
323 if (rc == FR_UNKNOWN)
324 rc = global_function_dispatcher(menu->win, &event);
325 } while ((rc != FR_DONE) && (rc != FR_CONTINUE));
326 // ---------------------------------------------------------------------------
327
328 window_set_focus(old_focus);
330 window_redraw(NULL);
331 return (rc == FR_CONTINUE); // Was a selection made?
332}
333
345int alias_complete(struct Buffer *buf, struct ConfigSubset *sub)
346{
347 char bestname[8192] = { 0 };
348 struct Alias *a_best = NULL;
349 int count = 0;
350
351 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
352 mdata.limit = buf_strdup(buf);
353 mdata.search_state = search_state_new();
354
356 ASSERT(mod_data);
357
358 if (buf_at(buf, 0) != '\0')
359 {
360 struct Alias **ap = NULL;
361 ARRAY_FOREACH(ap, &mod_data->aliases)
362 {
363 struct Alias *a = *ap;
364 if (a->name && mutt_strn_equal(a->name, buf_string(buf), buf_len(buf)))
365 {
366 a_best = a;
367 count++;
368
369 if (bestname[0] == '\0') /* init */
370 {
371 mutt_str_copy(bestname, a->name, MIN(mutt_str_len(a->name) + 1, sizeof(bestname)));
372 }
373 else
374 {
375 int i;
376 for (i = 0; a->name[i] && (a->name[i] == bestname[i]); i++)
377 ; // do nothing
378
379 bestname[i] = '\0';
380 }
381 }
382 }
383
384 // Exactly one match, so expand the Alias and return
385 if (count == 1)
386 {
387 buf_reset(buf);
388 mutt_addrlist_write(&a_best->addr, buf, true);
389 buf_addstr(buf, ", ");
390 FREE(&mdata.limit);
392 return 1;
393 }
394
395 if (bestname[0] == '\0')
396 {
397 // Create a View Array of all the Aliases
398 FREE(&mdata.limit);
399 ARRAY_FOREACH(ap, &mod_data->aliases)
400 {
401 alias_array_alias_add(&mdata.ava, *ap);
402 }
403 }
404 else
405 {
406 /* fake the pattern for menu title */
407 char *mtitle = NULL;
408 mutt_str_asprintf(&mtitle, "~f ^%s", buf_string(buf));
409 FREE(&mdata.limit);
410 mdata.limit = mtitle;
411
412 if (!mutt_str_equal(bestname, buf_string(buf)))
413 {
414 /* we are adding something to the completion */
415 buf_strcpy_n(buf, bestname, mutt_str_len(bestname) + 1);
416 FREE(&mdata.limit);
418 return 1;
419 }
420
421 /* build alias list and show it */
422 ARRAY_FOREACH(ap, &mod_data->aliases)
423 {
424 struct Alias *a = *ap;
425 int aasize = alias_array_alias_add(&mdata.ava, a);
426
427 struct AliasView *av = ARRAY_GET(&mdata.ava, aasize - 1);
428
429 if (a->name && !mutt_strn_equal(a->name, buf_string(buf), buf_len(buf)))
430 {
431 av->is_visible = false;
432 }
433 }
434 }
435 }
436
437 if (ARRAY_EMPTY(&mdata.ava))
438 {
439 struct Alias **ap = NULL;
440 ARRAY_FOREACH(ap, &mod_data->aliases)
441 {
442 alias_array_alias_add(&mdata.ava, *ap);
443 }
444
445 mutt_pattern_alias_func(NULL, &mdata, PAA_VISIBLE, NULL);
446 }
447
448 if (!dlg_alias(&mdata))
449 goto done;
450
451 buf_reset(buf);
452
453 // Extract the selected aliases
454 struct Buffer *tmpbuf = buf_pool_get();
455 struct AliasView *avp = NULL;
456 ARRAY_FOREACH(avp, &mdata.ava)
457 {
458 if (!avp->is_tagged)
459 continue;
460
461 mutt_addrlist_write(&avp->alias->addr, tmpbuf, true);
462 buf_addstr(tmpbuf, ", ");
463 }
464 buf_copy(buf, tmpbuf);
465 buf_pool_release(&tmpbuf);
466
467done:
468 // Process any deleted aliases
469 ARRAY_FOREACH(avp, &mdata.ava)
470 {
471 if (!avp->is_deleted)
472 continue;
473
474 // Find and remove the alias from the Aliases array
475 struct Alias **ap = NULL;
476 ARRAY_FOREACH(ap, &mod_data->aliases)
477 {
478 if (*ap == avp->alias)
479 {
480 ARRAY_REMOVE(&mod_data->aliases, ap);
481 break;
482 }
483 }
484 alias_free(&avp->alias);
485 }
486
487 ARRAY_FREE(&mdata.ava);
488 FREE(&mdata.limit);
489 FREE(&mdata.title);
491
492 return 0;
493}
494
500void alias_dialog(struct Mailbox *m, struct ConfigSubset *sub)
501{
502 struct Alias **ap = NULL;
503
504 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
506
508 ASSERT(mod_data);
509
510 // Create a View Array of all the Aliases
511 ARRAY_FOREACH(ap, &mod_data->aliases)
512 {
513 alias_array_alias_add(&mdata.ava, *ap);
514 }
515
516 if (!dlg_alias(&mdata))
517 goto done;
518
519 // Prepare the "To:" field of a new email
520 struct Email *e = email_new();
521 e->env = mutt_env_new();
522
523 struct AliasView *avp = NULL;
524 ARRAY_FOREACH(avp, &mdata.ava)
525 {
526 if (!avp->is_tagged)
527 continue;
528
529 struct AddressList al_copy = TAILQ_HEAD_INITIALIZER(al_copy);
530 if (alias_to_addrlist(&al_copy, avp->alias))
531 {
532 mutt_addrlist_copy(&e->env->to, &al_copy, false);
533 mutt_addrlist_clear(&al_copy);
534 }
535 }
536
537 mutt_send_message(SEND_REVIEW_TO, e, NULL, m, NULL, sub);
538
539done:
540 // Process any deleted aliases
541 ARRAY_FOREACH(avp, &mdata.ava)
542 {
543 if (avp->is_deleted)
544 {
545 // Find and remove the alias from the Aliases array
546 ARRAY_FOREACH(ap, &mod_data->aliases)
547 {
548 if (*ap == avp->alias)
549 {
550 ARRAY_REMOVE(&mod_data->aliases, ap);
551 break;
552 }
553 }
554 alias_free(&avp->alias);
555 }
556 }
557
558 ARRAY_FREE(&mdata.ava);
559 FREE(&mdata.limit);
560 FREE(&mdata.title);
562}
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
Definition address.c:774
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition address.c:1469
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition address.c:1215
Email Address Handling.
const struct ExpandoRenderCallback AliasRenderCallbacks[]
Callbacks for Alias Expandos.
Definition expando.c:187
Alias Expando definitions.
Alias functions.
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition sort.c:235
Email Aliases.
Alias private Module data.
void alias_free(struct Alias **ptr)
Free an Alias.
Definition alias.c:673
Representation of a single alias to an email address.
@ NT_ALIAS_ADD
Alias has been added.
Definition alias.h:55
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition alias.h:56
int alias_array_count_visible(struct AliasViewArray *ava)
Count number of visible Aliases.
Definition array.c:95
int alias_array_alias_delete(struct AliasViewArray *ava, const struct Alias *alias)
Delete an Alias from the AliasViewArray.
Definition array.c:73
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition array.c:47
#define ARRAY_REMOVE(head, elem)
Remove an entry from the array, shifting down the subsequent entries.
Definition array.h:355
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_EMPTY(head)
Check if an array is empty.
Definition array.h:74
#define ARRAY_SIZE(head)
The number of elements stored.
Definition array.h:87
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition array.h:58
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
Definition buffer.c:491
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
Definition buffer.c:668
size_t buf_strcpy_n(struct Buffer *buf, const char *s, size_t len)
Copy a string into a Buffer.
Definition buffer.c:416
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition buffer.c:601
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition buffer.c:571
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:446
@ FR_DONE
Exit the Dialog.
Definition dispatcher.h:36
@ FR_UNKNOWN
Unknown function.
Definition dispatcher.h:34
@ FR_CONTINUE
Remain in the Dialog.
Definition dispatcher.h:35
int alias_complete(struct Buffer *buf, struct ConfigSubset *sub)
Alias completion routine.
Definition dlg_alias.c:345
static struct SimpleDialogWindows alias_dialog_new(struct AliasMenuData *mdata)
Create an Alias Selection Dialog.
Definition dlg_alias.c:232
static const struct Mapping AliasHelp[]
Help Bar for the Alias dialog (address book)
Definition dlg_alias.c:100
void alias_dialog(struct Mailbox *m, struct ConfigSubset *sub)
Open the aliases dialog.
Definition dlg_alias.c:500
bool alias_to_addrlist(struct AddressList *al, struct Alias *alias)
Turn an Alias into an AddressList.
Definition dlg_query.c:119
struct Email * email_new(void)
Create a new Email.
Definition email.c:77
Structs that make up an email.
struct Envelope * mutt_env_new(void)
Create a new Envelope.
Definition envelope.c:45
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, char **env_list, struct Buffer *buf)
Render an Expando and run the result through a filter.
Definition filter.c:139
Parse Expando string.
struct KeyEvent km_dokey(const struct MenuDefinition *md, GetChFlags flags)
Determine what a keypress should do.
Definition get.c:437
void km_error_key(const struct MenuDefinition *md)
Handle an unbound key sequence.
Definition get.c:287
#define GETCH_NO_FLAGS
No flags are set.
Definition get.h:34
int alias_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Alias function - Implements function_dispatcher_t -.
Definition functions.c:509
int menu_tagging_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition tagging.c:230
int global_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Global function - Implements function_dispatcher_t -.
Definition global.c:182
int menu_function_dispatcher(struct MuttWindow *win, const struct KeyEvent *event)
Perform a Menu function - Implements function_dispatcher_t -.
Definition functions.c:324
static bool dlg_alias(struct AliasMenuData *mdata)
Display a menu of Aliases -.
Definition dlg_alias.c:271
#define mutt_warning(...)
Definition logging2.h:92
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
static int alias_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Format an Alias for the Menu - Implements Menu::make_entry() -.
Definition dlg_alias.c:118
static int alias_tag(struct Menu *menu, int sel, int act)
Tag some aliases - Implements Menu::tag() -.
Definition dlg_alias.c:140
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_alias.c:203
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition dlg_alias.c:156
int alias_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition gui.c:43
int alias_recalc(struct MuttWindow *win)
Recalculate the display of the Alias Window - Implements MuttWindow::recalc() -.
Definition gui.c:96
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition simple.c:169
struct SimpleDialogWindows simple_dialog_new(const struct MenuDefinition *md, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition simple.c:132
void alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit)
Create a title string for the Menu.
Definition gui.c:72
Shared code for the Alias and Query Dialogs.
Manage keymappings.
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ LL_DEBUG1
Log at debug level 1.
Definition logging2.h:45
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MIN(a, b)
Return the minimum of two values.
Definition memory.h:40
GUI present the user with a selectable list.
#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:189
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:165
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:179
@ MODULE_ID_ALIAS
ModuleAlias, Alias
Definition module_api.h:48
Convenience wrapper for the library headers.
#define N_(a)
Definition message.h:32
#define _(a)
Definition message.h:28
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition notify.c:230
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
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
int mutt_str_asprintf(char **strp, const char *fmt,...)
Definition string.c:808
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:665
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
Definition string.c:429
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition string.c:503
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
Definition string.c:586
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
NeoMutt Logging.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
@ WT_DLG_ALIAS
Alias Dialog, dlg_alias()
Definition mutt_window.h:77
@ NT_WINDOW_DELETE
Window is about to be deleted.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:665
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:57
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition notify_type.h:43
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition notify_type.h:37
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
Match patterns to emails.
@ PAA_VISIBLE
Set AliasView.is_visible and hide the rest.
Definition lib.h:191
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, enum PatternAlias action, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition pattern.c:170
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
#define TAILQ_HEAD_INITIALIZER(head)
Definition queue.h:694
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition render.h:37
void search_state_free(struct SearchState **ptr)
Free a SearchState.
struct SearchState * search_state_new(void)
Create a new SearchState.
Convenience wrapper for the send headers.
int mutt_send_message(SendFlags flags, struct Email *e_templ, const char *tempfile, struct Mailbox *m, struct EmailArray *ea, struct ConfigSubset *sub)
Send an email.
Definition send.c:2032
#define SEND_REVIEW_TO
Allow the user to edit the To field.
Definition send.h:56
#define ASSERT(COND)
Definition signal2.h:59
AliasView array wrapper with Pattern information -.
Definition gui.h:54
char * limit
Limit being used.
Definition gui.h:60
struct AliasViewArray ava
All Aliases/Queries.
Definition gui.h:55
struct SearchState * search_state
State of the current search.
Definition gui.h:63
struct Menu * menu
Menu.
Definition gui.h:58
char * title
Title for the status bar.
Definition gui.h:62
struct ConfigSubset * sub
Config items.
Definition gui.h:57
Alias private Module data.
Definition module_data.h:33
struct AliasArray aliases
User's email aliases.
Definition module_data.h:35
struct MenuDefinition * menu_alias
Alias menu definition.
Definition module_data.h:42
GUI data wrapping an Alias.
Definition gui.h:38
bool is_visible
Is visible?
Definition gui.h:45
struct Alias * alias
Alias.
Definition gui.h:46
bool is_deleted
Is it deleted?
Definition gui.h:44
bool is_tagged
Is it tagged?
Definition gui.h:43
int num
Index number in list.
Definition gui.h:39
A shortcut for an email address or addresses.
Definition alias.h:35
char * name
Short name.
Definition alias.h:36
struct AddressList addr
List of Addresses the Alias expands to.
Definition alias.h:37
String manipulation buffer.
Definition buffer.h:36
A set of inherited config items.
Definition subset.h:46
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition subset.h:51
The envelope/body of an email.
Definition email.h:39
struct Envelope * env
Envelope information.
Definition email.h:68
struct AddressList to
Email's 'To' list.
Definition envelope.h:60
An alias-change event.
Definition alias.h:65
struct Alias * alias
Alias that changed.
Definition alias.h:66
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
Parsed Expando trees.
Definition expando.h:41
An event such as a keypress.
Definition get.h:50
int op
Function opcode, e.g. OP_HELP.
Definition get.h:52
A mailbox.
Definition mailbox.h:78
Mapping between user-readable string and a constant.
Definition mapping.h:33
Definition lib.h:80
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:88
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition lib.h:163
int(* tag)(struct Menu *menu, int sel, int act)
Definition lib.h:133
int(* make_entry)(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
Definition lib.h:108
struct ConfigSubset * sub
Inherited config items.
Definition lib.h:89
void * mdata
Private data.
Definition lib.h:149
int max
Number of entries in the menu.
Definition lib.h:82
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
int(* recalc)(struct MuttWindow *win)
Container for Accounts, Notifications.
Definition neomutt.h:41
char ** env
Private copy of the environment variables.
Definition neomutt.h:57
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Data passed to a notification function.
Definition observer.h:34
void * event_data
Data from notify_send()
Definition observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition observer.h:36
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition observer.h:37
void * global_data
Data from notify_observer_add()
Definition observer.h:39
Tuple for the results of simple_dialog_new()
Definition simple.h:35
struct MuttWindow * sbar
Simple Bar.
Definition simple.h:37
struct Menu * menu
Menu.
Definition simple.h:38
struct MuttWindow * dlg
Main Dialog Window.
Definition simple.h:36