NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_alias.c
Go to the documentation of this file.
1
74#include "config.h"
75#include <stdbool.h>
76#include <stdint.h>
77#include <stdio.h>
78#include "mutt/lib.h"
79#include "address/lib.h"
80#include "config/lib.h"
81#include "email/lib.h"
82#include "core/lib.h"
83#include "gui/lib.h"
84#include "lib.h"
85#include "key/lib.h"
86#include "menu/lib.h"
87#include "pattern/lib.h"
88#include "send/lib.h"
89#include "alias.h"
90#include "format_flags.h"
91#include "functions.h"
92#include "gui.h"
93#include "mutt_logging.h"
94#include "muttlib.h"
95
97static const struct Mapping AliasHelp[] = {
98 // clang-format off
99 { N_("Exit"), OP_EXIT },
100 { N_("Del"), OP_DELETE },
101 { N_("Undel"), OP_UNDELETE },
102 { N_("Sort"), OP_SORT },
103 { N_("Rev-Sort"), OP_SORT_REVERSE },
104 { N_("Select"), OP_GENERIC_SELECT_ENTRY },
105 { N_("Help"), OP_HELP },
106 { NULL, 0 },
107 // clang-format on
108};
109
122static const char *alias_format_str(char *buf, size_t buflen, size_t col, int cols,
123 char op, const char *src, const char *prec,
124 const char *if_str, const char *else_str,
125 intptr_t data, MuttFormatFlags flags)
126{
127 char tmp[1024];
128 struct AliasView *av = (struct AliasView *) data;
129 struct Alias *alias = av->alias;
130
131 switch (op)
132 {
133 case 'a':
134 mutt_format_s(buf, buflen, prec, alias->name);
135 break;
136 case 'c':
137 mutt_format_s(buf, buflen, prec, alias->comment);
138 break;
139 case 'f':
140 snprintf(tmp, sizeof(tmp), "%%%ss", prec);
141 snprintf(buf, buflen, tmp, av->is_deleted ? "D" : " ");
142 break;
143 case 'n':
144 snprintf(tmp, sizeof(tmp), "%%%sd", prec);
145 snprintf(buf, buflen, tmp, av->num + 1);
146 break;
147 case 'r':
148 {
149 struct Buffer *tmpbuf = buf_pool_get();
150 mutt_addrlist_write(&alias->addr, tmpbuf, true);
151 mutt_str_copy(tmp, buf_string(tmpbuf), sizeof(tmp));
152 buf_pool_release(&tmpbuf);
153 mutt_format_s(buf, buflen, prec, tmp);
154 break;
155 }
156 case 't':
157 buf[0] = av->is_tagged ? '*' : ' ';
158 buf[1] = '\0';
159 break;
160 }
161
162 return src;
163}
164
170static void alias_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
171{
172 const struct AliasMenuData *mdata = menu->mdata;
173 const struct AliasViewArray *ava = &mdata->ava;
174 const struct AliasView *av = ARRAY_GET(ava, line);
175
176 const char *const c_alias_format = cs_subset_string(mdata->sub, "alias_format");
177
178 mutt_expando_format(buf, buflen, 0, menu->win->state.cols, NONULL(c_alias_format),
180}
181
185static int alias_tag(struct Menu *menu, int sel, int act)
186{
187 const struct AliasMenuData *mdata = menu->mdata;
188 const struct AliasViewArray *ava = &mdata->ava;
189 struct AliasView *av = ARRAY_GET(ava, sel);
190
191 bool ot = av->is_tagged;
192
193 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
194
195 return av->is_tagged - ot;
196}
197
202{
203 if (nc->event_type != NT_ALIAS)
204 return 0;
205 if (!nc->global_data || !nc->event_data)
206 return -1;
207
208 struct EventAlias *ev_a = nc->event_data;
209 struct Menu *menu = nc->global_data;
210 struct AliasMenuData *mdata = menu->mdata;
211 struct Alias *alias = ev_a->alias;
212
213 if (nc->event_subtype == NT_ALIAS_ADD)
214 {
215 alias_array_alias_add(&mdata->ava, alias);
216
217 if (alias_array_count_visible(&mdata->ava) != ARRAY_SIZE(&mdata->ava))
218 {
219 mutt_pattern_alias_func(NULL, mdata, menu);
220 }
221 }
222 else if (nc->event_subtype == NT_ALIAS_DELETE)
223 {
224 alias_array_alias_delete(&mdata->ava, alias);
225
226 int vcount = alias_array_count_visible(&mdata->ava);
227 int index = menu_get_index(menu);
228 if ((index > (vcount - 1)) && (index > 0))
229 menu_set_index(menu, index - 1);
230 }
231
232 alias_array_sort(&mdata->ava, mdata->sub);
233
234 menu->max = alias_array_count_visible(&mdata->ava);
236 mutt_debug(LL_DEBUG5, "alias done, request WA_RECALC, MENU_REDRAW_FULL\n");
237
238 return 0;
239}
240
249{
250 if (nc->event_type != NT_WINDOW)
251 return 0;
252 if (!nc->global_data || !nc->event_data)
253 return -1;
255 return 0;
256
257 struct MuttWindow *win_menu = nc->global_data;
258 struct EventWindow *ev_w = nc->event_data;
259 if (ev_w->win != win_menu)
260 return 0;
261
262 struct Menu *menu = win_menu->wdata;
263
267
268 mutt_debug(LL_DEBUG5, "window delete done\n");
269 return 0;
270}
271
277static struct MuttWindow *alias_dialog_new(struct AliasMenuData *mdata)
278{
280
281 struct Menu *menu = dlg->wdata;
282
284 menu->tag = alias_tag;
285 menu->max = alias_array_count_visible(&mdata->ava);
286 menu->mdata = mdata;
287 menu->mdata_free = NULL; // Menu doesn't own the data
288
289 struct MuttWindow *win_menu = menu->win;
290
291 // Override the Simple Dialog's recalc()
292 win_menu->recalc = alias_recalc;
293
294 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
295 alias_set_title(sbar, mdata->title, mdata->limit);
296
297 // NT_COLOR is handled by the SimpleDialog
301
302 return dlg;
303}
304
314static bool dlg_alias(struct Buffer *buf, struct AliasMenuData *mdata)
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}
373
385int alias_complete(struct Buffer *buf, struct ConfigSubset *sub)
386{
387 struct Alias *np = NULL;
388 char bestname[8192] = { 0 };
389
390 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
391 mdata.limit = buf_strdup(buf);
392 mdata.search_state = search_state_new();
393
394 if (buf_at(buf, 0) != '\0')
395 {
396 TAILQ_FOREACH(np, &Aliases, entries)
397 {
398 if (np->name && mutt_strn_equal(np->name, buf_string(buf), buf_len(buf)))
399 {
400 if (bestname[0] == '\0') /* init */
401 {
402 mutt_str_copy(bestname, np->name,
403 MIN(mutt_str_len(np->name) + 1, sizeof(bestname)));
404 }
405 else
406 {
407 int i;
408 for (i = 0; np->name[i] && (np->name[i] == bestname[i]); i++)
409 ; // do nothing
410
411 bestname[i] = '\0';
412 }
413 }
414 }
415
416 if (bestname[0] == '\0')
417 {
418 // Create a View Array of all the Aliases
419 FREE(&mdata.limit);
420 TAILQ_FOREACH(np, &Aliases, entries)
421 {
423 }
424 }
425 else
426 {
427 /* fake the pattern for menu title */
428 char *mtitle = NULL;
429 mutt_str_asprintf(&mtitle, "~f ^%s", buf_string(buf));
430 FREE(&mdata.limit);
431 mdata.limit = mtitle;
432
433 if (!mutt_str_equal(bestname, buf_string(buf)))
434 {
435 /* we are adding something to the completion */
436 buf_strcpy_n(buf, bestname, mutt_str_len(bestname) + 1);
437 FREE(&mdata.limit);
438 return 1;
439 }
440
441 /* build alias list and show it */
442 TAILQ_FOREACH(np, &Aliases, entries)
443 {
444 int aasize = alias_array_alias_add(&mdata.ava, np);
445
446 struct AliasView *av = ARRAY_GET(&mdata.ava, aasize - 1);
447
448 if (np->name && !mutt_strn_equal(np->name, buf_string(buf), buf_len(buf)))
449 {
450 av->is_visible = false;
451 }
452 }
453 }
454 }
455
456 if (ARRAY_EMPTY(&mdata.ava))
457 {
458 TAILQ_FOREACH(np, &Aliases, entries)
459 {
460 alias_array_alias_add(&mdata.ava, np);
461 }
462
463 mutt_pattern_alias_func(NULL, &mdata, NULL);
464 }
465
466 if (!dlg_alias(NULL, &mdata))
467 goto done;
468
469 buf_reset(buf);
470
471 // Extract the selected aliases
472 struct Buffer *tmpbuf = buf_pool_get();
473 struct AliasView *avp = NULL;
474 ARRAY_FOREACH(avp, &mdata.ava)
475 {
476 if (!avp->is_tagged)
477 continue;
478
479 mutt_addrlist_write(&avp->alias->addr, tmpbuf, true);
480 buf_addstr(tmpbuf, ", ");
481 }
482 buf_copy(buf, tmpbuf);
483 buf_pool_release(&tmpbuf);
484
485done:
486 // Process any deleted aliases
487 ARRAY_FOREACH(avp, &mdata.ava)
488 {
489 if (!avp->is_deleted)
490 continue;
491
492 TAILQ_REMOVE(&Aliases, avp->alias, entries);
493 alias_free(&avp->alias);
494 }
495
496 ARRAY_FREE(&mdata.ava);
497 FREE(&mdata.limit);
498 FREE(&mdata.title);
500
501 return 0;
502}
503
509void alias_dialog(struct Mailbox *m, struct ConfigSubset *sub)
510{
511 struct Alias *np = NULL;
512
513 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
514 mdata.search_state = search_state_new();
515
516 // Create a View Array of all the Aliases
517 TAILQ_FOREACH(np, &Aliases, entries)
518 {
520 }
521
522 if (!dlg_alias(NULL, &mdata))
523 goto done;
524
525 // Prepare the "To:" field of a new email
526 struct Email *e = email_new();
527 e->env = mutt_env_new();
528
529 struct AliasView *avp = NULL;
530 ARRAY_FOREACH(avp, &mdata.ava)
531 {
532 if (!avp->is_tagged)
533 continue;
534
535 struct AddressList al_copy = TAILQ_HEAD_INITIALIZER(al_copy);
536 if (alias_to_addrlist(&al_copy, avp->alias))
537 {
538 mutt_addrlist_copy(&e->env->to, &al_copy, false);
539 mutt_addrlist_clear(&al_copy);
540 }
541 }
542
543 mutt_send_message(SEND_REVIEW_TO, e, NULL, m, NULL, sub);
544
545done:
546 // Process any deleted aliases
547 ARRAY_FOREACH(avp, &mdata.ava)
548 {
549 if (avp->is_deleted)
550 {
551 TAILQ_REMOVE(&Aliases, avp->alias, entries);
552 alias_free(&avp->alias);
553 }
554 }
555
556 ARRAY_FREE(&mdata.ava);
557 FREE(&mdata.limit);
558 FREE(&mdata.title);
560}
void mutt_addrlist_copy(struct AddressList *dst, const struct AddressList *src, bool prune)
Copy a list of addresses into another list.
Definition: address.c:762
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1461
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition: address.c:1207
Email Address Handling.
void alias_array_sort(struct AliasViewArray *ava, const struct ConfigSubset *sub)
Sort and reindex an AliasViewArray.
Definition: sort.c:166
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:641
struct AliasList Aliases
List of all the user's email aliases.
Definition: alias.c:60
Representation of a single alias to an email address.
@ NT_ALIAS_ADD
Alias has been added.
Definition: alias.h:54
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition: alias.h:55
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_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
#define ARRAY_SIZE(head)
The number of elements stored.
Definition: array.h:86
#define ARRAY_FREE(head)
Release all memory.
Definition: array.h:203
#define ARRAY_GET(head, idx)
Return the element at index.
Definition: array.h:108
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
Definition: array.h:57
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
char buf_at(const struct Buffer *buf, size_t offset)
Return the character at the given offset.
Definition: buffer.c:638
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_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition: buffer.c:238
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition: buffer.c:572
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
Definition: buffer.c:542
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
@ 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
int alias_complete(struct Buffer *buf, struct ConfigSubset *sub)
Alias completion routine.
Definition: dlg_alias.c:385
static const struct Mapping AliasHelp[]
Help Bar for the Alias dialog (address book)
Definition: dlg_alias.c:97
void alias_dialog(struct Mailbox *m, struct ConfigSubset *sub)
Open the aliases dialog.
Definition: dlg_alias.c:509
static struct MuttWindow * alias_dialog_new(struct AliasMenuData *mdata)
Create an Alias Selection Dialog.
Definition: dlg_alias.c:277
bool alias_to_addrlist(struct AddressList *al, struct Alias *alias)
Turn an Alias into an AddressList.
Definition: dlg_query.c:120
struct Email * email_new(void)
Create a new Email.
Definition: email.c:78
Structs that make up an email.
struct Envelope * mutt_env_new(void)
Create a new Envelope.
Definition: envelope.c:43
void mutt_format_s(char *buf, size_t buflen, const char *prec, const char *s)
Format a simple string.
Definition: format.c:215
Flags to control mutt_expando_format()
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
int km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
Definition: get.c:463
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:293
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
static const char * alias_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format a string for the alias list - Implements format_t -.
Definition: dlg_alias.c:122
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string -.
Definition: muttlib.c:739
static bool dlg_alias(struct Buffer *buf, struct AliasMenuData *mdata)
Display a menu of Aliases -.
Definition: dlg_alias.c:314
#define mutt_warning(...)
Definition: logging2.h:90
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
static void alias_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format an Alias for the Menu - Implements Menu::make_entry() -.
Definition: dlg_alias.c:170
static int alias_tag(struct Menu *menu, int sel, int act)
Tag some aliases - Implements Menu::tag() -.
Definition: dlg_alias.c:185
static int alias_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_alias.c:248
static int alias_alias_observer(struct NotifyCallback *nc)
Notification that an Alias has changed - Implements observer_t -.
Definition: dlg_alias.c:201
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:89
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:168
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 alias_set_title(struct MuttWindow *sbar, char *menu_name, char *limit)
Create a title string for the Menu.
Definition: gui.c:69
Shared code for the Alias and Query Dialogs.
Manage keymappings.
#define GETCH_NO_FLAGS
No flags are set.
Definition: lib.h:52
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
#define FREE(x)
Definition: memory.h:45
#define MIN(a, b)
Definition: memory.h:32
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: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
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:251
int mutt_str_asprintf(char **strp, const char *fmt,...)
Definition: string.c:966
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:763
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:497
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
Definition: string.c:568
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:653
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:73
NeoMutt Logging.
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_DLG_ALIAS
Alias Dialog, dlg_alias()
Definition: mutt_window.h:77
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
Some miscellaneous functions.
@ 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.
int mutt_pattern_alias_func(char *prompt, struct AliasMenuData *mdata, struct Menu *menu)
Perform some Pattern matching for Alias.
Definition: pattern.c:189
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition: pool.c:81
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition: pool.c:94
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:637
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
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:2099
#define SEND_REVIEW_TO
Allow the user to edit the To field.
Definition: send.h:54
Sidebar functions.
Key value store.
#define NONULL(x)
Definition: string2.h:37
AliasView array wrapper with Pattern information -.
Definition: gui.h:52
char * limit
Limit being used.
Definition: gui.h:58
struct AliasViewArray ava
All Aliases/Queries.
Definition: gui.h:53
struct SearchState * search_state
State of the current search.
Definition: gui.h:61
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
bool is_visible
Is visible?
Definition: gui.h:43
struct Alias * alias
Alias.
Definition: gui.h:44
bool is_deleted
Is it deleted?
Definition: gui.h:42
bool is_tagged
Is it tagged?
Definition: gui.h:41
int num
Index number in list.
Definition: gui.h:37
A shortcut for an email address or addresses.
Definition: alias.h:34
char * comment
Free-form comment string.
Definition: alias.h:37
char * name
Short name.
Definition: alias.h:35
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
String manipulation buffer.
Definition: buffer.h:34
A set of inherited config items.
Definition: subset.h:47
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
The envelope/body of an email.
Definition: email.h:37
struct Envelope * env
Envelope information.
Definition: email.h:66
struct AddressList to
Email's 'To' list.
Definition: envelope.h:60
An alias-change event.
Definition: alias.h:64
struct Alias * alias
Alias that changed.
Definition: alias.h:65
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
A mailbox.
Definition: mailbox.h:79
Mapping between user-readable string and a constant.
Definition: mapping.h:32
Definition: lib.h:70
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
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
int max
Number of entries in the menu.
Definition: lib.h:72
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
int(* recalc)(struct MuttWindow *win)
Definition: mutt_window.h:173
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
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
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
@ MENU_ALIAS
Select an email address by its alias.
Definition: type.h:37