NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
index.c
Go to the documentation of this file.
1
25
70
71#include "config.h"
72#include <stdbool.h>
73#include <stddef.h>
74#include "mutt/lib.h"
75#include "config/lib.h"
76#include "email/lib.h"
77#include "core/lib.h"
78#include "alias/lib.h"
79#include "gui/lib.h"
80#include "gui/module_data.h"
81#include "attach/lib.h"
82#include "color/lib.h"
83#include "index/lib.h"
84#include "menu/lib.h"
85#include "postpone/lib.h"
86#include "globals.h"
87#include "module_data.h"
88#include "muttlib.h"
89#include "private_data.h"
90#include "shared_data.h"
91#include "subjectrx.h"
92
96static void sort_use_threads_warn(void)
97{
98 static bool warned = false;
99 if (!warned)
100 {
101 mutt_warning(_("Changing threaded display should prefer $use_threads over $sort"));
102 warned = true;
103 mutt_sleep(0);
104 }
105}
106
113static int config_sort(const struct ConfigSubset *sub)
114{
115 const enum EmailSortType c_sort = cs_subset_sort(sub, "sort");
116 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
117
118 if (((c_sort & SORT_MASK) != EMAIL_SORT_THREADS) || (c_use_threads == UT_UNSET))
119 return 0;
120
122
123 /* Note: changing a config variable here kicks off a second round of
124 * observers before the first round has completed. Be careful that
125 * changes made here do not cause an infinite loop of toggling
126 * adjustments - the early exit above when $sort no longer uses
127 * EMAIL_SORT_THREADS ends the recursion.
128 */
129 int rc;
130 if ((c_use_threads == UT_FLAT) ||
131 (!(c_sort & SORT_REVERSE) == (c_use_threads == UT_REVERSE)))
132 {
133 /* If we were flat or the user wants to change thread
134 * directions, then leave $sort alone for now and change
135 * $use_threads to match the desired outcome. The 2nd-level
136 * observer for $use_threads will then adjust $sort, and our
137 * 3rd-level observer for $sort will be a no-op.
138 */
139 rc = cs_subset_str_native_set(sub, "use_threads",
140 (c_sort & SORT_REVERSE) ? UT_REVERSE : UT_THREADS, NULL);
141 }
142 else
143 {
144 /* We were threaded, and the user still wants the same thread
145 * direction. Adjust $sort based on $sort_aux, and the 2nd-level
146 * observer for $sort will be a no-op.
147 */
148 enum EmailSortType c_sort_aux = cs_subset_sort(sub, "sort_aux");
149 c_sort_aux ^= (c_sort & SORT_REVERSE);
150 rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
151 }
152 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
153}
154
161static int config_use_threads(const struct ConfigSubset *sub)
162{
163 const enum EmailSortType c_sort = cs_subset_sort(sub, "sort");
164 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
165
166 if (((c_sort & SORT_MASK) != EMAIL_SORT_THREADS) || (c_use_threads == UT_UNSET))
167 return 0;
168
170
171 /* Note: changing a config variable here kicks off a second round of
172 * observers before the first round has completed. But since we
173 * aren't setting $sort to threads, the 2nd-level observer will be a
174 * no-op.
175 */
176 const enum EmailSortType c_sort_aux = cs_subset_sort(sub, "sort_aux");
177 int rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
178 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
179}
180
186{
187 /* For lack of a better way, we fake a "set use_threads" */
189}
190
197static int config_reply_regex(struct MailboxView *mv)
198{
199 if (!mv || !mv->mailbox)
200 return 0;
201
202 struct Mailbox *m = mv->mailbox;
203
204 for (int i = 0; i < m->msg_count; i++)
205 {
206 struct Email *e = m->emails[i];
207 if (!e)
208 break;
209 struct Envelope *env = e->env;
210 if (!env || !env->subject)
211 continue;
212
213 mutt_env_set_subject(env, env->subject);
214 }
215
216 OptResortInit = true; /* trigger a redraw of the index */
217 return 0;
218}
219
224{
225 if (nc->event_type != NT_ALTERN)
226 return 0;
227 if (!nc->global_data)
228 return -1;
229
230 struct MuttWindow *win = nc->global_data;
231 struct MuttWindow *dlg = dialog_find(win);
232 struct IndexSharedData *shared = dlg->wdata;
233
235 mutt_debug(LL_DEBUG5, "alternates done\n");
236 return 0;
237}
238
243{
244 if (nc->event_type != NT_ATTACH)
245 return 0;
246 if (!nc->global_data)
247 return -1;
248
249 struct MuttWindow *win = nc->global_data;
250 struct MuttWindow *dlg = dialog_find(win);
251 struct IndexSharedData *shared = dlg->wdata;
252
254 mutt_debug(LL_DEBUG5, "attachments done\n");
255 return 0;
256}
257
262{
263 if (nc->event_type != NT_COLOR)
264 return 0;
265 if (!nc->global_data || !nc->event_data)
266 return -1;
267
268 struct EventColor *ev_c = nc->event_data;
269
270 const int cid = ev_c->cid;
271
272 // MT_COLOR_MAX is sent on `uncolor *`
273 if (!((cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
279 (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_TREE)))
280 {
281 // The changes aren't relevant to the index menu
282 return 0;
283 }
284
285 struct MuttWindow *win = nc->global_data;
286 struct MuttWindow *dlg = dialog_find(win);
287 struct IndexSharedData *shared = dlg->wdata;
288
289 struct Mailbox *m = shared->mailbox;
290 if (!m)
291 return 0;
292
293 // Force re-caching of index colours
294 for (int i = 0; i < m->msg_count; i++)
295 {
296 struct Email *e = m->emails[i];
297 if (!e)
298 break;
299 e->attr_color = NULL;
300 }
301
302 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
303 struct IndexPrivateData *priv = panel_index->wdata;
304 struct Menu *menu = priv->menu;
305 menu->redraw = MENU_REDRAW_FULL;
307 mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
308
309 return 0;
310}
311
317static bool config_check_sort(const char *option)
318{
319 const int R_RESORT = (1 << 0);
320 const int R_RESORT_INIT = (1 << 1);
321 const int R_RESORT_SUB = (1 << 2);
322
323 static const struct Mapping sort_options[] = {
324 // clang-format off
325 { "duplicate_threads", R_RESORT | R_RESORT_INIT },
326 { "reply_regex", R_RESORT },
327 { "sort", R_RESORT },
328 { "sort_aux", R_RESORT | R_RESORT_SUB },
329 { "sort_re", R_RESORT | R_RESORT_INIT },
330 { "strict_threads", R_RESORT | R_RESORT_INIT },
331 { "thread_received", R_RESORT | R_RESORT_INIT },
332 { "use_threads", R_RESORT },
333 { NULL, 0 },
334 // clang-format on
335 };
336
337 int flags = mutt_map_get_value(option, sort_options);
338 if (flags < 0)
339 return false;
340
341 if (flags & R_RESORT)
342 OptNeedResort = true;
343 if (flags & R_RESORT_INIT)
344 OptResortInit = true;
345 if (flags & R_RESORT_SUB)
346 OptSortSubthreads = true;
347
348 return true;
349}
350
356bool config_check_index(const char *option)
357{
358 static const char *index_options[] = {
359 "ascii_chars", "crypt_chars",
360 "flag_chars", "from_chars",
361 "group_index_format", "hide_limited",
362 "hide_missing", "hide_thread_subject",
363 "hide_top_limited", "hide_top_missing",
364 "imap_headers", "index_format",
365 "mark_old", "mbox",
366 "narrow_tree", "postponed",
367 "real_name", "reverse_alias",
368 "reverse_name", "reverse_real_name",
369 "status_chars", "status_format",
370 "to_chars", "ts_enabled",
371 "ts_icon_format", "ts_status_format"
372 };
373
374 for (size_t i = 0; i < countof(index_options); i++)
375 {
376 if (mutt_str_equal(option, index_options[i]))
377 return true;
378 }
379
380 return false;
381}
382
387{
388 if (nc->event_type != NT_CONFIG)
389 return 0;
390 if (!nc->global_data || !nc->event_data)
391 return -1;
392
393 struct EventConfig *ev_c = nc->event_data;
394 if (!ev_c->name || !ev_c->he)
395 return 0;
396
397 struct MuttWindow *win = nc->global_data;
398
399 if (!config_check_sort(ev_c->name) && !config_check_index(ev_c->name))
400 return 0;
401
402 if (mutt_str_equal(ev_c->name, "reply_regex"))
403 {
404 struct MuttWindow *dlg = dialog_find(win);
405 struct IndexSharedData *shared = dlg->wdata;
407 mutt_debug(LL_DEBUG5, "config done\n");
408 }
409 else if (mutt_str_equal(ev_c->name, "sort"))
410 {
411 config_sort(ev_c->sub);
412 mutt_debug(LL_DEBUG5, "config done\n");
413 }
414 else if (mutt_str_equal(ev_c->name, "use_threads"))
415 {
416 config_use_threads(ev_c->sub);
417 mutt_debug(LL_DEBUG5, "config done\n");
418 }
419 else if (mutt_str_equal(ev_c->name, "hide_thread_subject"))
420 {
421 struct MuttWindow *dlg = dialog_find(win);
422 struct IndexSharedData *shared = dlg->wdata;
423 mutt_sort_headers(shared->mailbox_view, false);
424 }
425
427 return 0;
428}
429
434{
435 if (nc->event_type != NT_GLOBAL)
436 return 0;
437 if (!nc->global_data)
438 return -1;
440 return 0;
441
442 struct MuttWindow *win = nc->global_data;
443 struct MuttWindow *dlg = dialog_find(win);
444 if (!dlg)
445 return 0;
446
447 struct IndexSharedData *shared = dlg->wdata;
449
450 return 0;
451}
452
457{
458 if (!nc->global_data)
459 return -1;
460
461 struct MuttWindow *win = nc->global_data;
462 win->actions |= WA_RECALC;
463
464 struct Menu *menu = win->wdata;
466 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
467
468 struct IndexPrivateData *priv = menu->mdata;
469 struct IndexSharedData *shared = priv->shared;
470 if (shared && shared->mailbox)
471 menu->max = shared->mailbox->vcount;
472 else
473 menu->max = 0;
474
475 return 0;
476}
477
482{
483 if (nc->event_type != NT_MENU)
484 return 0;
485 if (!nc->global_data)
486 return -1;
487
488 struct MuttWindow *win = nc->global_data;
489 struct MuttWindow *dlg = dialog_find(win);
490 struct IndexSharedData *shared = dlg->wdata;
491 struct Menu *menu = win->wdata;
492
493 const int index = menu_get_index(menu);
494 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
496
497 return 0;
498}
499
504{
505 if (nc->event_type != NT_SCORE)
506 return 0;
507 if (!nc->global_data)
508 return -1;
509
510 struct MuttWindow *win = nc->global_data;
511 struct MuttWindow *dlg = dialog_find(win);
512 struct IndexSharedData *shared = dlg->wdata;
513
514 struct Mailbox *m = shared->mailbox;
515 if (!m)
516 return 0;
517
518 for (int i = 0; i < m->msg_count; i++)
519 {
520 struct Email *e = m->emails[i];
521 if (!e)
522 break;
523
524 mutt_score_message(m, e, true);
525 e->attr_color = NULL; // Force recalc of colour
526 }
527
528 mutt_debug(LL_DEBUG5, "score done\n");
529 return 0;
530}
531
536{
537 if (nc->event_type != NT_SUBJECTRX)
538 return 0;
539 if (!nc->global_data)
540 return -1;
541
542 struct MuttWindow *win = nc->global_data;
543 struct MuttWindow *dlg = dialog_find(win);
544 struct IndexSharedData *shared = dlg->wdata;
545
547 mutt_debug(LL_DEBUG5, "subject-regex done\n");
548 return 0;
549}
550
555{
556 if (nc->event_type != NT_WINDOW)
557 return 0;
558 if (!nc->global_data || !nc->event_data)
559 return -1;
560
561 struct MuttWindow *win = nc->global_data;
562 struct Menu *menu = win->wdata;
564 {
567 return 0;
568 }
569
570 struct EventWindow *ev_w = nc->event_data;
571 if (ev_w->win != win)
572 return 0;
573
574 struct IndexPrivateData *priv = menu->mdata;
575
586
587 mutt_debug(LL_DEBUG5, "window delete done\n");
588 return 0;
589}
590
594static int index_recalc(struct MuttWindow *win)
595{
596 win->actions |= WA_REPAINT;
597 mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
598 return 0;
599}
600
604static int index_repaint(struct MuttWindow *win)
605{
606 struct Menu *menu = win->wdata;
607
608 if (menu->redraw & MENU_REDRAW_FULL)
609 menu_redraw_full(menu);
610
611 // If we don't have the focus, then this is a mini-Index ($pager_index_lines)
612 if (!window_is_focused(menu->win))
613 {
614 int indicator = menu->page_len / 3;
615
616 /* some fudge to work out whereabouts the indicator should go */
617 const int index = menu_get_index(menu);
618 if ((index - indicator) < 0)
619 menu->top = 0;
620 else if ((menu->max - index) < (menu->page_len - indicator))
621 menu->top = menu->max - menu->page_len;
622 else
623 menu->top = index - indicator;
624 }
625 menu_adjust(menu);
627
628 struct IndexPrivateData *priv = menu->mdata;
629 struct IndexSharedData *shared = priv->shared;
630 struct Mailbox *m = shared->mailbox;
631 const int index = menu_get_index(menu);
632 if (m && m->emails && (index < m->vcount))
633 {
634 if (menu->redraw & MENU_REDRAW_INDEX)
635 {
636 menu_redraw_index(menu);
637 }
638 else if (menu->redraw & MENU_REDRAW_MOTION)
639 {
640 menu_redraw_motion(menu);
641 }
642 else if (menu->redraw & MENU_REDRAW_CURRENT)
643 {
645 }
646 }
647
648 menu->redraw = MENU_REDRAW_NONE;
649 mutt_debug(LL_DEBUG5, "repaint done\n");
650 return 0;
651}
652
685
694{
696 if (!mod_data || !mod_data->all_dialogs_window)
697 return NULL;
698
699 struct MuttWindow **wp = NULL;
701 {
702 struct MuttWindow *win = window_find_child(*wp, WT_DLG_INDEX);
703 if (win)
704 {
705 struct IndexSharedData *shared = win->wdata;
706 return shared->mailbox_view;
707 }
708
710 if (win)
711 {
712 return postponed_get_mailbox_view(win);
713 }
714 }
715
716 return NULL;
717}
718
727{
729 if (mv)
730 return mv->mailbox;
731
732 return NULL;
733}
Email Aliases.
void mutt_alternates_reset(struct MailboxView *mv)
Clear the recipient valid flag of all emails.
Definition alternates.c:46
#define ARRAY_FOREACH_REVERSE(elem, head)
Iterate backwards over all elements of the array.
Definition array.h:274
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition commands.c:266
GUI display the mailboxes in a side panel.
Color and attribute parsing.
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition notify.c:73
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition notify.c:62
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition color.h:87
@ MT_COLOR_MAX
Definition color.h:97
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition color.h:93
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition color.h:96
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition color.h:94
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition color.h:89
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition color.h:95
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition color.h:82
@ MT_COLOR_NORMAL
Plain text.
Definition color.h:53
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition color.h:91
@ MT_COLOR_INDEX
Index: default colour.
Definition color.h:86
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition color.h:92
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition color.h:90
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition color.h:88
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition helpers.c:71
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition helpers.c:266
Convenience wrapper for the config headers.
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
Definition set.h:53
#define CSR_SUCCESS
Action completed successfully.
Definition set.h:33
#define SORT_MASK
Mask for the sort id.
Definition sort.h:39
#define SORT_REVERSE
Reverse the order of the sort.
Definition sort.h:40
Convenience wrapper for the core headers.
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition dialog.c:89
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition draw.c:464
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition draw.c:341
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition draw.c:327
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition draw.c:405
Structs that make up an email.
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition globals.c:56
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition sort.c:354
bool OptNeedResort
(pseudo) used to force a re-sort
Definition globals.c:52
EmailSortType
Methods for sorting Emails.
Definition sort.h:53
@ EMAIL_SORT_THREADS
Sort by email threads.
Definition sort.h:62
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
Definition envelope.c:68
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition globals.c:57
Global variables.
#define mutt_warning(...)
Definition logging2.h:92
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition index.c:261
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition index.c:386
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition index.c:456
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition index.c:481
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition index.c:503
static int index_subjectrx_observer(struct NotifyCallback *nc)
Notification that a 'subject-regex' command has occurred - Implements observer_t -.
Definition index.c:535
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition index.c:433
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition index.c:223
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition index.c:242
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition index.c:554
static int index_recalc(struct MuttWindow *win)
Recalculate the Index display - Implements MuttWindow::recalc() -.
Definition index.c:594
static int index_repaint(struct MuttWindow *win)
Repaint the Index display - Implements MuttWindow::repaint() -.
Definition index.c:604
Convenience wrapper for the gui headers.
Gui private Module data.
@ UT_FLAT
Unthreaded.
Definition thread.h:104
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition thread.h:103
@ UT_THREADS
Normal threading (root above subthreads)
Definition thread.h:105
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition thread.h:106
GUI manage the main index (list of emails)
Index private Module data.
Private state data for the Index.
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
Data shared between Index, Pager and Sidebar.
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition index.c:113
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
Definition index.c:185
static int config_reply_regex(struct MailboxView *mv)
React to changes to $reply_regex.
Definition index.c:197
bool config_check_index(const char *option)
Does this config option affect the Index?
Definition index.c:356
struct MailboxView * get_current_mailbox_view(void)
Get the current Mailbox view.
Definition index.c:693
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition index.c:726
static void sort_use_threads_warn(void)
Alert the user to odd $sort settings.
Definition index.c:96
static bool config_check_sort(const char *option)
Does this config option affect the Index sorting?
Definition index.c:317
struct MuttWindow * index_window_new(struct IndexPrivateData *priv)
Create a new Index Window (list of Emails)
Definition index.c:658
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition index.c:161
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
Definition mapping.c:85
#define countof(x)
Definition memory.h:49
GUI present the user with a selectable list.
struct MuttWindow * menu_window_new(const struct MenuDefinition *md, struct ConfigSubset *sub)
Create a new Menu Window.
Definition window.c:140
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition move.c:325
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:179
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:155
@ MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:61
@ MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:64
@ MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition lib.h:63
@ MENU_REDRAW_NONE
No flags are set.
Definition lib.h:60
@ MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition lib.h:62
@ MODULE_ID_INDEX
ModuleIndex, Index
Definition module_api.h:72
@ MODULE_ID_GUI
ModuleGui, Graphical code
Definition module_api.h:45
Convenience wrapper for the library headers.
#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
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:665
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition mutt_window.h:86
@ WT_DLG_POSTPONE
Postpone Dialog, dlg_postpone()
Definition mutt_window.h:90
@ WT_INDEX
A panel containing the Index Window.
Definition mutt_window.h:97
@ WA_REPAINT
Redraw the contents of the Window.
@ WA_RECALC
Recalculate the contents of the Window.
@ NT_WINDOW_DELETE
Window is about to be deleted.
@ NT_WINDOW_FOCUS
Window focus has changed.
void mutt_sleep(short s)
Sleep for a while.
Definition muttlib.c:787
Some miscellaneous functions.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:376
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition neomutt.h:71
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition notify_type.h:58
@ NT_MENU
Menu has changed, MenuRedrawFlags.
Definition notify_type.h:52
@ NT_ATTACH
Attachment command changed, NotifyAttach.
Definition notify_type.h:39
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition notify_type.h:43
@ NT_COLOR
Colour has changed, NotifyColor, EventColor.
Definition notify_type.h:41
@ NT_SCORE
Email scoring has changed.
Definition notify_type.h:55
@ NT_SUBJECTRX
Subject Regex has changed, NotifySubjectRx.
Definition notify_type.h:56
@ NT_ALL
Register for all notifications.
Definition notify_type.h:35
@ NT_GLOBAL
Not object-related, NotifyGlobal.
Definition notify_type.h:46
@ NT_ALTERN
Alternates command changed, NotifyAlternates.
Definition notify_type.h:38
struct MailboxView * postponed_get_mailbox_view(struct MuttWindow *dlg)
Extract the Mailbox from the Postponed Dialog.
Definition functions.c:337
Postponed Emails.
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition score.c:216
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition score.c:243
#define ASSERT(COND)
Definition signal2.h:59
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
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition email.h:112
int index
The absolute (unsorted) message number.
Definition email.h:110
The header of an Email.
Definition envelope.h:57
char *const subject
Email's subject.
Definition envelope.h:70
An Event that happened to a Colour.
Definition notify2.h:52
enum ColorId cid
Colour ID that has changed.
Definition notify2.h:53
A config-change event.
Definition subset.h:70
const struct ConfigSubset * sub
Config Subset.
Definition subset.h:71
const char * name
Name of config item that changed.
Definition subset.h:72
struct HashElem * he
Config item that changed.
Definition subset.h:73
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
Gui private Module data.
Definition module_data.h:32
struct MuttWindow * all_dialogs_window
Parent of all Dialogs.
Definition module_data.h:38
Index private Module data.
Definition module_data.h:32
struct MenuDefinition * menu_index
Index menu definition.
Definition module_data.h:34
Private state data for the Index.
struct IndexSharedData * shared
Shared Index data.
struct Menu * menu
Menu controlling the index.
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
struct MailboxView * mailbox_view
Current Mailbox view.
Definition shared_data.h:40
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition shared_data.h:44
View of a Mailbox.
Definition mview.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:81
int vcount
The number of virtual messages.
Definition mailbox.h:101
int msg_count
Total number of messages.
Definition mailbox.h:90
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
Mapping between user-readable string and a constant.
Definition mapping.h:33
Definition lib.h:86
struct MuttWindow * win
Window holding the Menu.
Definition lib.h:94
MenuRedrawFlags redraw
When to redraw the screen.
Definition lib.h:89
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition lib.h:169
int top
Entry that is the top of the current page.
Definition lib.h:98
struct Notify * notify
Notifications.
Definition lib.h:153
void * mdata
Private data.
Definition lib.h:155
int max
Number of entries in the menu.
Definition lib.h:88
int page_len
Number of entries per screen.
Definition lib.h:91
struct MuttWindowArray children
Children Windows.
int(* repaint)(struct MuttWindow *win)
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
int(* recalc)(struct MuttWindow *win)
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Container for Accounts, Notifications.
Definition neomutt.h:41
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
void subjectrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition subjectrx.c:170
Parse Subject-regex Commands.
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:303