NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_query.c
Go to the documentation of this file.
1
25
71
72#include "config.h"
73#include <stdbool.h>
74#include <stdio.h>
75#include <string.h>
76#include <sys/types.h>
77#include "mutt/lib.h"
78#include "address/lib.h"
79#include "config/lib.h"
80#include "email/lib.h"
81#include "core/lib.h"
82#include "gui/lib.h"
83#include "lib.h"
84#include "editor/lib.h"
85#include "expando/lib.h"
86#include "history/lib.h"
87#include "key/lib.h"
88#include "menu/lib.h"
89#include "pattern/lib.h"
90#include "send/lib.h"
91#include "alias.h"
92#include "expando.h"
93#include "functions.h"
94#include "gui.h"
95#include "module_data.h"
96#include "mutt_logging.h"
97
99static const struct Mapping QueryHelp[] = {
100 // clang-format off
101 { N_("Exit"), OP_EXIT },
102 { N_("Mail"), OP_MAIL },
103 { N_("New Query"), OP_QUERY },
104 { N_("Make Alias"), OP_CREATE_ALIAS },
105 { N_("Sort"), OP_SORT },
106 { N_("Rev-Sort"), OP_SORT_REVERSE },
107 { N_("Search"), OP_SEARCH },
108 { N_("Help"), OP_HELP },
109 { NULL, 0 },
110 // clang-format on
111};
112
119bool alias_to_addrlist(struct AddressList *al, struct Alias *alias)
120{
121 if (!al || !TAILQ_EMPTY(al) || !alias)
122 return false;
123
124 mutt_addrlist_copy(al, &alias->addr, false);
125 if (!TAILQ_EMPTY(al))
126 {
127 struct Address *first = TAILQ_FIRST(al);
128 struct Address *second = TAILQ_NEXT(first, entries);
129 if (!second && !first->personal)
130 {
131 first->personal = buf_new(alias->name);
132 }
133
134 mutt_addrlist_to_intl(al, NULL);
135 }
136
137 return true;
138}
139
145static int query_make_entry(struct Menu *menu, int line, int max_cols, struct Buffer *buf)
146{
147 const struct AliasMenuData *mdata = menu->mdata;
148 const struct AliasViewArray *ava = &mdata->ava;
149 struct AliasView *av = ARRAY_GET(ava, line);
150
151 const bool c_arrow_cursor = cs_subset_bool(menu->sub, "arrow_cursor");
152 if (c_arrow_cursor)
153 {
154 const char *const c_arrow_string = cs_subset_string(menu->sub, "arrow_string");
155 if (max_cols > 0)
156 max_cols -= (mutt_strwidth(c_arrow_string) + 1);
157 }
158
159 const struct Expando *c_query_format = cs_subset_expando(mdata->sub, "query_format");
160 return expando_filter(c_query_format, QueryRenderCallbacks, av,
161 MUTT_FORMAT_ARROWCURSOR, max_cols, NeoMutt->env, buf);
162}
163
167static int query_tag(struct Menu *menu, int sel, int act)
168{
169 const struct AliasMenuData *mdata = menu->mdata;
170 const struct AliasViewArray *ava = &mdata->ava;
171 struct AliasView *av = ARRAY_GET(ava, sel);
172
173 bool ot = av->is_tagged;
174
175 av->is_tagged = ((act >= 0) ? act : !av->is_tagged);
176 return av->is_tagged - ot;
177}
178
188int query_run(const char *s, bool verbose, struct AliasArray *aa,
189 const struct ConfigSubset *sub)
190{
191 FILE *fp = NULL;
192 char *buf = NULL;
193 size_t buflen;
194 char *msg = NULL;
195 size_t msglen = 0;
196 char *tok = NULL;
197 char *next_tok = NULL;
198 struct Buffer *cmd = buf_pool_get();
199
200 const char *const c_query_command = cs_subset_string(sub, "query_command");
201 buf_file_expand_fmt_quote(cmd, c_query_command, s);
202
203 pid_t pid = filter_create(buf_string(cmd), NULL, &fp, NULL, NeoMutt->env);
204 if (pid < 0)
205 {
206 mutt_debug(LL_DEBUG1, "unable to fork command: %s\n", buf_string(cmd));
207 buf_pool_release(&cmd);
208 return -1;
209 }
210 buf_pool_release(&cmd);
211
212 if (verbose)
213 mutt_message(_("Waiting for response..."));
214
215 struct Buffer *addr = buf_pool_get();
216 /* The query protocol first reads one NL-terminated line. If an error
217 * occurs, this is assumed to be an error message. Otherwise it's ignored. */
218 msg = mutt_file_read_line(msg, &msglen, fp, NULL, MUTT_RL_NO_FLAGS);
219 while ((buf = mutt_file_read_line(buf, &buflen, fp, NULL, MUTT_RL_NO_FLAGS)))
220 {
221 tok = buf;
222 next_tok = strchr(tok, '\t');
223 if (next_tok)
224 *next_tok++ = '\0';
225
226 if (*tok == '\0')
227 continue;
228
229 struct Alias *alias = alias_new();
230
231 if (next_tok)
232 {
233 tok = next_tok;
234 next_tok = strchr(tok, '\t');
235 if (next_tok)
236 *next_tok++ = '\0';
237
238 // The address shouldn't be wrapped with <>s, but historically, this was supported
239 if (buf[0] == '<')
240 buf_printf(addr, "\"%s\" %s", tok, buf);
241 else
242 buf_printf(addr, "\"%s\" <%s>", tok, buf);
243
245
246 parse_alias_comments(alias, next_tok);
247 }
248 else
249 {
250 mutt_addrlist_parse(&alias->addr, buf); // Email address
251 }
252
253 ARRAY_ADD(aa, alias);
254 }
256
257 FREE(&buf);
258 mutt_file_fclose(&fp);
259 if (filter_wait(pid))
260 {
261 mutt_debug(LL_DEBUG1, "Error: %s\n", NONULL(msg));
262 if (verbose)
263 mutt_error("%s", NONULL(msg));
264 }
265 else
266 {
267 if (verbose)
268 mutt_message("%s", NONULL(msg));
269 }
270 FREE(&msg);
271
272 return 0;
273}
274
279{
280 if (nc->event_type != NT_WINDOW)
281 return 0;
282 if (!nc->global_data || !nc->event_data)
283 return -1;
285 return 0;
286
287 struct MuttWindow *win_menu = nc->global_data;
288 struct EventWindow *ev_w = nc->event_data;
289 if (ev_w->win != win_menu)
290 return 0;
291
292 struct Menu *menu = win_menu->wdata;
293
296
297 mutt_debug(LL_DEBUG5, "window delete done\n");
298 return 0;
299}
300
308 const char *query)
309{
311 ASSERT(mod_data);
312
313 struct SimpleDialogWindows sdw = simple_dialog_new(mod_data->menu_query,
315
316 struct Menu *menu = sdw.menu;
317
319 menu->tag = query_tag;
320 menu->max = ARRAY_SIZE(&mdata->ava);
321 mdata->title = mutt_str_dup(_("Query"));
322 menu->mdata = mdata;
323 menu->mdata_free = NULL; // Menu doesn't own the data
324
325 struct MuttWindow *win_menu = menu->win;
326
327 // Override the Simple Dialog's recalc()
328 win_menu->recalc = alias_recalc;
329
330 char title[256] = { 0 };
331 snprintf(title, sizeof(title), "%s: %s", mdata->title, query);
332 sbar_set_title(sdw.sbar, title);
333
334 // NT_COLOR is handled by the SimpleDialog
337
338 return sdw;
339}
340
352static bool dlg_query(struct Buffer *buf, struct AliasMenuData *mdata)
353{
355 ASSERT(mod_data);
356
357 struct SimpleDialogWindows sdw = query_dialog_new(mdata, buf_string(buf));
358 struct Menu *menu = sdw.menu;
359 mdata->menu = menu;
360 mdata->sbar = sdw.sbar;
361 mdata->query = buf;
362
363 alias_array_sort(&mdata->ava, mdata->sub);
364
365 struct AliasView *avp = NULL;
366 ARRAY_FOREACH(avp, &mdata->ava)
367 {
368 avp->num = ARRAY_FOREACH_IDX_avp;
369 }
370
371 struct MuttWindow *old_focus = window_set_focus(menu->win);
372 // ---------------------------------------------------------------------------
373 // Event Loop
374 int rc = 0;
375 int op = OP_NULL;
376 struct KeyEvent event = { 0, OP_NULL };
377 do
378 {
379 menu_tagging_dispatcher(menu->win, &event);
380 window_redraw(NULL);
381
382 event = km_dokey(mod_data->menu_query, GETCH_NO_FLAGS);
383 op = event.op;
384 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
385 if (op < 0)
386 continue;
387 if (op == OP_NULL)
388 {
389 km_error_key(mod_data->menu_query);
390 continue;
391 }
393
394 rc = alias_function_dispatcher(sdw.dlg, &event);
395 if (rc == FR_UNKNOWN)
396 rc = menu_function_dispatcher(menu->win, &event);
397 if (rc == FR_UNKNOWN)
398 rc = global_function_dispatcher(menu->win, &event);
399 } while ((rc != FR_DONE) && (rc != FR_CONTINUE));
400 // ---------------------------------------------------------------------------
401
402 window_set_focus(old_focus);
404 window_redraw(NULL);
405 return (rc == FR_CONTINUE); // Was a selection made?
406}
407
414int query_complete(struct Buffer *buf, struct ConfigSubset *sub)
415{
416 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
418
419 struct AliasArray aa = ARRAY_HEAD_INITIALIZER;
420 const char *const c_query_command = cs_subset_string(sub, "query_command");
421 if (!c_query_command)
422 {
423 mutt_warning(_("Query command not defined"));
424 goto done;
425 }
426
427 query_run(buf_string(buf), true, &aa, sub);
428 if (ARRAY_EMPTY(&aa))
429 goto done;
430
431 mdata.aa = &aa;
432
433 struct Alias **a_first = ARRAY_FIRST(&aa);
434 if (ARRAY_SIZE(&aa) == 1) // only one response?
435 {
436 struct AddressList addr = TAILQ_HEAD_INITIALIZER(addr);
437 if (alias_to_addrlist(&addr, *a_first))
438 {
440 buf_reset(buf);
441 mutt_addrlist_write(&addr, buf, false);
442 mutt_addrlist_clear(&addr);
444 buf_addstr(buf, ", ");
445 }
446 goto done;
447 }
448
449 struct Alias **ap = NULL;
450 ARRAY_FOREACH(ap, mdata.aa)
451 {
452 alias_array_alias_add(&mdata.ava, *ap);
453 }
454
455 /* multiple results, choose from query menu */
456 if (!dlg_query(buf, &mdata))
457 goto done;
458
459 buf_reset(buf);
460 buf_alloc(buf, 8192);
461 struct AliasView *avp = NULL;
462 ARRAY_FOREACH(avp, &mdata.ava)
463 {
464 if (!avp->is_tagged)
465 continue;
466
467 struct AddressList al_copy = TAILQ_HEAD_INITIALIZER(al_copy);
468 if (alias_to_addrlist(&al_copy, avp->alias))
469 {
470 mutt_addrlist_to_local(&al_copy);
471 mutt_addrlist_write(&al_copy, buf, false);
472 mutt_addrlist_clear(&al_copy);
473 }
474 buf_addstr(buf, ", ");
475 }
476
477done:
478 ARRAY_FREE(&mdata.ava);
479 FREE(&mdata.title);
480 FREE(&mdata.limit);
482 aliaslist_clear(&aa);
483 return 0;
484}
485
491void query_index(struct Mailbox *m, struct ConfigSubset *sub)
492{
493 const char *const c_query_command = cs_subset_string(sub, "query_command");
494 if (!c_query_command)
495 {
496 mutt_warning(_("Query command not defined"));
497 return;
498 }
499
500 struct AliasArray aa = ARRAY_HEAD_INITIALIZER;
501 struct AliasMenuData mdata = { ARRAY_HEAD_INITIALIZER, NULL, sub };
502 mdata.aa = &aa;
503 mdata.search_state = search_state_new();
504
505 struct Buffer *buf = buf_pool_get();
506 if ((mw_get_field(_("Query: "), buf, MUTT_COMP_NO_FLAGS, HC_OTHER, NULL, NULL) != 0) ||
507 buf_is_empty(buf))
508 {
509 goto done;
510 }
511
512 query_run(buf_string(buf), false, &aa, sub);
513 if (ARRAY_EMPTY(&aa))
514 goto done;
515
516 struct Alias **ap = NULL;
517 ARRAY_FOREACH(ap, mdata.aa)
518 {
519 alias_array_alias_add(&mdata.ava, *ap);
520 }
521
522 if (!dlg_query(buf, &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 ARRAY_FREE(&mdata.ava);
547 FREE(&mdata.title);
548 FREE(&mdata.limit);
550 aliaslist_clear(&aa);
551 buf_pool_release(&buf);
552}
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
int mutt_addrlist_to_local(struct AddressList *al)
Convert an Address list from Punycode.
Definition address.c:1387
size_t mutt_addrlist_write(const struct AddressList *al, struct Buffer *buf, bool display)
Write an Address to a buffer.
Definition address.c:1215
int mutt_addrlist_parse(struct AddressList *al, const char *s)
Parse a list of email addresses.
Definition address.c:480
int mutt_addrlist_to_intl(struct AddressList *al, char **err)
Convert an Address list to Punycode.
Definition address.c:1302
Email Address Handling.
void parse_alias_comments(struct Alias *alias, const char *com)
Parse the alias/query comment field.
Definition commands.c:135
const struct ExpandoRenderCallback QueryRenderCallbacks[]
Callbacks for Query Expandos.
Definition expando.c:207
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 aliaslist_clear(struct AliasArray *aa)
Empty a List of Aliases.
Definition alias.c:698
struct Alias * alias_new(void)
Create a new Alias.
Definition alias.c:661
Representation of a single alias to an email address.
int alias_array_alias_add(struct AliasViewArray *ava, struct Alias *alias)
Add an Alias to the AliasViewArray.
Definition array.c:47
#define ARRAY_FIRST(head)
Convenience method to get the first element.
Definition array.h:136
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
Definition array.h:157
#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
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
struct Buffer * buf_new(const char *str)
Allocate a new Buffer.
Definition buffer.c:304
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
Definition buffer.c:337
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
static const struct Mapping QueryHelp[]
Help Bar for the Address Query dialog.
Definition dlg_query.c:99
static struct SimpleDialogWindows query_dialog_new(struct AliasMenuData *mdata, const char *query)
Create an Query Selection Dialog.
Definition dlg_query.c:307
int query_run(const char *s, bool verbose, struct AliasArray *aa, const struct ConfigSubset *sub)
Run an external program to find Addresses.
Definition dlg_query.c:188
bool alias_to_addrlist(struct AddressList *al, struct Alias *alias)
Turn an Alias into an AddressList.
Definition dlg_query.c:119
int query_complete(struct Buffer *buf, struct ConfigSubset *sub)
Perform auto-complete using an Address Query.
Definition dlg_query.c:414
void query_index(struct Mailbox *m, struct ConfigSubset *sub)
Perform an Alias Query and display the results.
Definition dlg_query.c:491
Edit a string.
#define MUTT_COMP_NO_FLAGS
No flags are set.
Definition wdata.h:42
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.
char * mutt_file_read_line(char *line, size_t *size, FILE *fp, int *line_num, ReadLineFlags flags)
Read a line from a file.
Definition file.c:678
void buf_file_expand_fmt_quote(struct Buffer *dest, const char *fmt, const char *src)
Replace s in a string with a filename.
Definition file.c:1351
#define mutt_file_fclose(FP)
Definition file.h:139
#define MUTT_RL_NO_FLAGS
No flags are set.
Definition file.h:40
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_query(struct Buffer *buf, struct AliasMenuData *mdata)
Get the user to enter an Address Query -.
Definition dlg_query.c:352
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
Definition window.c:467
#define mutt_warning(...)
Definition logging2.h:92
#define mutt_error(...)
Definition logging2.h:94
#define mutt_message(...)
Definition logging2.h:93
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
static int query_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_query.c:145
static int query_tag(struct Menu *menu, int sel, int act)
Tag an entry in the Query Menu - Implements Menu::tag() -.
Definition dlg_query.c:167
static int query_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition dlg_query.c:278
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
Shared code for the Alias and Query Dialogs.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
Definition lib.h:60
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
GUI present the user with a selectable list.
@ MODULE_ID_ALIAS
ModuleAlias, Alias
Definition module_api.h:48
int filter_wait(pid_t pid)
Wait for the exit of a process and return its status.
Definition filter.c:228
pid_t filter_create(const char *cmd, FILE **fp_in, FILE **fp_out, FILE **fp_err, char **envlist)
Set up filter program.
Definition filter.c:217
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
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_QUERY
Query Dialog, dlg_query()
Definition mutt_window.h:90
@ 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
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition opcodes.c:48
Match patterns to emails.
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_FIRST(head)
Definition queue.h:780
#define TAILQ_NEXT(elm, field)
Definition queue.h:889
#define TAILQ_HEAD_INITIALIZER(head)
Definition queue.h:694
#define TAILQ_EMPTY(head)
Definition queue.h:778
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition render.h:37
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition sbar.c:227
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
#define NONULL(x)
Definition string2.h:44
An email address.
Definition address.h:35
struct Buffer * personal
Real name of address.
Definition address.h:36
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 AliasArray * aa
Alias data.
Definition gui.h:56
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 MenuDefinition * menu_query
Query menu definition.
Definition module_data.h:43
GUI data wrapping an Alias.
Definition gui.h:38
struct Alias * alias
Alias.
Definition gui.h:46
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 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 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