NeoMutt  2024-04-25-85-g27bab4
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
index.c
Go to the documentation of this file.
1
70#include "config.h"
71#include <stdbool.h>
72#include <stddef.h>
73#include "mutt/lib.h"
74#include "config/lib.h"
75#include "email/lib.h"
76#include "core/lib.h"
77#include "gui/lib.h"
78#include "attach/lib.h"
79#include "color/lib.h"
80#include "menu/lib.h"
81#include "postpone/lib.h"
82#include "alternates.h"
83#include "globals.h"
84#include "mutt_thread.h"
85#include "muttlib.h"
86#include "mview.h"
87#include "private_data.h"
88#include "score.h"
89#include "shared_data.h"
90#include "subjectrx.h"
91
95static void sort_use_threads_warn(void)
96{
97 static bool warned = false;
98 if (!warned)
99 {
100 mutt_warning(_("Changing threaded display should prefer $use_threads over $sort"));
101 warned = true;
102 mutt_sleep(0);
103 }
104}
105
112static int config_sort(const struct ConfigSubset *sub)
113{
114 const enum SortType c_sort = cs_subset_sort(sub, "sort");
115 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
116
117 if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
118 return 0;
119
121
122 /* Note: changing a config variable here kicks off a second round of
123 * observers before the first round has completed. Be careful that
124 * changes made here do not cause an infinite loop of toggling
125 * adjustments - the early exit above when $sort no longer uses
126 * SORT_THREADS ends the recursion.
127 */
128 int rc;
129 if ((c_use_threads == UT_FLAT) ||
130 (!(c_sort & SORT_REVERSE) == (c_use_threads == UT_REVERSE)))
131 {
132 /* If we were flat or the user wants to change thread
133 * directions, then leave $sort alone for now and change
134 * $use_threads to match the desired outcome. The 2nd-level
135 * observer for $use_threads will then adjust $sort, and our
136 * 3rd-level observer for $sort will be a no-op.
137 */
138 rc = cs_subset_str_native_set(sub, "use_threads",
139 (c_sort & SORT_REVERSE) ? UT_REVERSE : UT_THREADS, NULL);
140 }
141 else
142 {
143 /* We were threaded, and the user still wants the same thread
144 * direction. Adjust $sort based on $sort_aux, and the 2nd-level
145 * observer for $sort will be a no-op.
146 */
147 enum SortType c_sort_aux = cs_subset_sort(sub, "sort_aux");
148 c_sort_aux ^= (c_sort & SORT_REVERSE);
149 rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
150 }
151 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
152}
153
160static int config_use_threads(const struct ConfigSubset *sub)
161{
162 const enum SortType c_sort = cs_subset_sort(sub, "sort");
163 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
164
165 if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
166 return 0;
167
169
170 /* Note: changing a config variable here kicks off a second round of
171 * observers before the first round has completed. But since we
172 * aren't setting $sort to threads, the 2nd-level observer will be a
173 * no-op.
174 */
175 const enum SortType c_sort_aux = cs_subset_sort(sub, "sort_aux");
176 int rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
177 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
178}
179
185{
186 /* For lack of a better way, we fake a "set use_threads" */
188}
189
196static int config_reply_regex(struct MailboxView *mv)
197{
198 if (!mv || !mv->mailbox)
199 return 0;
200
201 struct Mailbox *m = mv->mailbox;
202
203 for (int i = 0; i < m->msg_count; i++)
204 {
205 struct Email *e = m->emails[i];
206 if (!e)
207 break;
208 struct Envelope *env = e->env;
209 if (!env || !env->subject)
210 continue;
211
212 mutt_env_set_subject(env, env->subject);
213 }
214
215 OptResortInit = true; /* trigger a redraw of the index */
216 return 0;
217}
218
223{
224 if (nc->event_type != NT_ALTERN)
225 return 0;
226 if (!nc->global_data)
227 return -1;
228
229 struct MuttWindow *win = nc->global_data;
230 struct MuttWindow *dlg = dialog_find(win);
231 struct IndexSharedData *shared = dlg->wdata;
232
234 mutt_debug(LL_DEBUG5, "alternates done\n");
235 return 0;
236}
237
242{
243 if (nc->event_type != NT_ATTACH)
244 return 0;
245 if (!nc->global_data)
246 return -1;
247
248 struct MuttWindow *win = nc->global_data;
249 struct MuttWindow *dlg = dialog_find(win);
250 struct IndexSharedData *shared = dlg->wdata;
251
253 mutt_debug(LL_DEBUG5, "attachments done\n");
254 return 0;
255}
256
261{
262 if (nc->event_type != NT_COLOR)
263 return 0;
264 if (!nc->global_data || !nc->event_data)
265 return -1;
266
267 struct EventColor *ev_c = nc->event_data;
268
269 const int cid = ev_c->cid;
270
271 // MT_COLOR_MAX is sent on `uncolor *`
272 if (!((cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
278 (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_TREE)))
279 {
280 // The changes aren't relevant to the index menu
281 return 0;
282 }
283
284 struct MuttWindow *win = nc->global_data;
285 struct MuttWindow *dlg = dialog_find(win);
286 struct IndexSharedData *shared = dlg->wdata;
287
288 struct Mailbox *m = shared->mailbox;
289 if (!m)
290 return 0;
291
292 // Force re-caching of index colours
293 for (int i = 0; i < m->msg_count; i++)
294 {
295 struct Email *e = m->emails[i];
296 if (!e)
297 break;
298 e->attr_color = NULL;
299 }
300
301 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
302 struct IndexPrivateData *priv = panel_index->wdata;
303 struct Menu *menu = priv->menu;
304 menu->redraw = MENU_REDRAW_FULL;
306 mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
307
308 return 0;
309}
310
316static bool config_check_sort(const char *option)
317{
318 const int R_RESORT = (1 << 0);
319 const int R_RESORT_INIT = (1 << 1);
320 const int R_RESORT_SUB = (1 << 2);
321
322 static const struct Mapping sort_options[] = {
323 // clang-format off
324 { "duplicate_threads", R_RESORT | R_RESORT_INIT },
325 { "reply_regex", R_RESORT },
326 { "sort", R_RESORT },
327 { "sort_aux", R_RESORT | R_RESORT_SUB },
328 { "sort_re", R_RESORT | R_RESORT_INIT },
329 { "strict_threads", R_RESORT | R_RESORT_INIT },
330 { "thread_received", R_RESORT | R_RESORT_INIT },
331 { "use_threads", R_RESORT },
332 { NULL, 0 }
333 // clang-format on
334 };
335
336 int flags = mutt_map_get_value(option, sort_options);
337 if (flags < 0)
338 return false;
339
340 if (flags & R_RESORT)
341 OptNeedResort = true;
342 if (flags & R_RESORT_INIT)
343 OptResortInit = true;
344 if (flags & R_RESORT_SUB)
345 OptSortSubthreads = true;
346
347 return true;
348}
349
355bool config_check_index(const char *option)
356{
357 static const char *index_options[] = {
358 "ascii_chars", "crypt_chars",
359 "flag_chars", "from_chars",
360 "group_index_format", "hide_limited",
361 "hide_missing", "hide_thread_subject",
362 "hide_top_limited", "hide_top_missing",
363 "imap_headers", "index_format",
364 "mark_old", "mbox",
365 "narrow_tree", "postponed",
366 "real_name", "reverse_alias",
367 "reverse_name", "reverse_real_name",
368 "status_chars", "status_format",
369 "to_chars", "ts_enabled",
370 "ts_icon_format", "ts_status_format"
371 };
372
373 for (size_t i = 0; i < mutt_array_size(index_options); i++)
374 {
375 if (mutt_str_equal(option, index_options[i]))
376 return true;
377 }
378
379 return false;
380}
381
386{
387 if (nc->event_type != NT_CONFIG)
388 return 0;
389 if (!nc->global_data || !nc->event_data)
390 return -1;
391
392 struct EventConfig *ev_c = nc->event_data;
393 if (!ev_c->name || !ev_c->he)
394 return 0;
395
396 struct MuttWindow *win = nc->global_data;
397
398 if (!config_check_sort(ev_c->name) && !config_check_index(ev_c->name))
399 return 0;
400
401 if (mutt_str_equal(ev_c->name, "reply_regex"))
402 {
403 struct MuttWindow *dlg = dialog_find(win);
404 struct IndexSharedData *shared = dlg->wdata;
406 mutt_debug(LL_DEBUG5, "config done\n");
407 }
408 else if (mutt_str_equal(ev_c->name, "sort"))
409 {
410 config_sort(ev_c->sub);
411 mutt_debug(LL_DEBUG5, "config done\n");
412 }
413 else if (mutt_str_equal(ev_c->name, "use_threads"))
414 {
415 config_use_threads(ev_c->sub);
416 mutt_debug(LL_DEBUG5, "config done\n");
417 }
418
420 return 0;
421}
422
427{
428 if (nc->event_type != NT_GLOBAL)
429 return 0;
430 if (!nc->global_data)
431 return -1;
433 return 0;
434
435 struct MuttWindow *win = nc->global_data;
436 struct MuttWindow *dlg = dialog_find(win);
437 if (!dlg)
438 return 0;
439
440 struct IndexSharedData *shared = dlg->wdata;
442
443 return 0;
444}
445
450{
451 if (!nc->global_data)
452 return -1;
453
454 struct MuttWindow *win = nc->global_data;
455 win->actions |= WA_RECALC;
456
457 struct Menu *menu = win->wdata;
459 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
460
461 struct IndexPrivateData *priv = menu->mdata;
462 struct IndexSharedData *shared = priv->shared;
463 if (shared && shared->mailbox)
464 menu->max = shared->mailbox->vcount;
465 else
466 menu->max = 0;
467
468 return 0;
469}
470
475{
476 if (nc->event_type != NT_MENU)
477 return 0;
478 if (!nc->global_data)
479 return -1;
480
481 struct MuttWindow *win = nc->global_data;
482 struct MuttWindow *dlg = dialog_find(win);
483 struct IndexSharedData *shared = dlg->wdata;
484 struct Menu *menu = win->wdata;
485
486 const int index = menu_get_index(menu);
487 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
489
490 return 0;
491}
492
497{
498 if (nc->event_type != NT_SCORE)
499 return 0;
500 if (!nc->global_data)
501 return -1;
502
503 struct MuttWindow *win = nc->global_data;
504 struct MuttWindow *dlg = dialog_find(win);
505 struct IndexSharedData *shared = dlg->wdata;
506
507 struct Mailbox *m = shared->mailbox;
508 if (!m)
509 return 0;
510
511 for (int i = 0; i < m->msg_count; i++)
512 {
513 struct Email *e = m->emails[i];
514 if (!e)
515 break;
516
517 mutt_score_message(m, e, true);
518 e->attr_color = NULL; // Force recalc of colour
519 }
520
521 mutt_debug(LL_DEBUG5, "score done\n");
522 return 0;
523}
524
529{
530 if (nc->event_type != NT_SUBJRX)
531 return 0;
532 if (!nc->global_data)
533 return -1;
534
535 struct MuttWindow *win = nc->global_data;
536 struct MuttWindow *dlg = dialog_find(win);
537 struct IndexSharedData *shared = dlg->wdata;
538
540 mutt_debug(LL_DEBUG5, "subjectrx done\n");
541 return 0;
542}
543
548{
549 if (nc->event_type != NT_WINDOW)
550 return 0;
551 if (!nc->global_data || !nc->event_data)
552 return -1;
553
554 struct MuttWindow *win = nc->global_data;
555 struct Menu *menu = win->wdata;
557 {
560 return 0;
561 }
562
563 struct EventWindow *ev_w = nc->event_data;
564 if (ev_w->win != win)
565 return 0;
566
567 struct IndexPrivateData *priv = menu->mdata;
568
579
580 mutt_debug(LL_DEBUG5, "window delete done\n");
581 return 0;
582}
583
587static int index_recalc(struct MuttWindow *win)
588{
589 win->actions |= WA_REPAINT;
590 mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
591 return 0;
592}
593
597static int index_repaint(struct MuttWindow *win)
598{
599 struct Menu *menu = win->wdata;
600
601 if (menu->redraw & MENU_REDRAW_FULL)
602 menu_redraw_full(menu);
603
604 // If we don't have the focus, then this is a mini-Index ($pager_index_lines)
605 if (!window_is_focused(menu->win))
606 {
607 int indicator = menu->page_len / 3;
608
609 /* some fudge to work out whereabouts the indicator should go */
610 const int index = menu_get_index(menu);
611 if ((index - indicator) < 0)
612 menu->top = 0;
613 else if ((menu->max - index) < (menu->page_len - indicator))
614 menu->top = menu->max - menu->page_len;
615 else
616 menu->top = index - indicator;
617 }
618 menu_adjust(menu);
620
621 struct IndexPrivateData *priv = menu->mdata;
622 struct IndexSharedData *shared = priv->shared;
623 struct Mailbox *m = shared->mailbox;
624 const int index = menu_get_index(menu);
625 if (m && m->emails && (index < m->vcount))
626 {
627 if (menu->redraw & MENU_REDRAW_INDEX)
628 {
629 menu_redraw_index(menu);
630 }
631 else if (menu->redraw & MENU_REDRAW_MOTION)
632 {
633 menu_redraw_motion(menu);
634 }
635 else if (menu->redraw & MENU_REDRAW_CURRENT)
636 {
638 }
639 }
640
642 mutt_debug(LL_DEBUG5, "repaint done\n");
643 return 0;
644}
645
652{
654 win->recalc = index_recalc;
655 win->repaint = index_repaint;
656
657 struct Menu *menu = win->wdata;
658 menu->mdata = priv;
659 menu->mdata_free = NULL; // Menu doesn't own the data
660 priv->menu = menu;
661
672
673 return win;
674}
675
684{
685 if (!AllDialogsWindow)
686 return NULL;
687
688 struct MuttWindow *np = NULL;
689 TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
690 {
691 struct MuttWindow *win = window_find_child(np, WT_DLG_INDEX);
692 if (win)
693 {
694 struct IndexSharedData *shared = win->wdata;
695 return shared->mailbox_view;
696 }
697
699 if (win)
700 {
701 return postponed_get_mailbox_view(win);
702 }
703 }
704
705 return NULL;
706}
707
716{
718 if (mv)
719 return mv->mailbox;
720
721 return NULL;
722}
723
732{
733 if (!AllDialogsWindow)
734 return NULL;
735
736 struct MuttWindow *np = NULL;
737 TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
738 {
739 struct MuttWindow *dlg = window_find_child(np, WT_DLG_INDEX);
740 if (dlg)
741 {
742 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
743 struct IndexPrivateData *priv = panel_index->wdata;
744 return priv->menu;
745 }
746 }
747
748 return NULL;
749}
void mutt_alternates_reset(struct MailboxView *mv)
Clear the recipient valid flag of all emails.
Definition: alternates.c:73
Alternate address handling.
GUI display the mailboxes in a side panel.
void mutt_attachments_reset(struct MailboxView *mv)
Reset the attachment count for all Emails.
Definition: attachments.c:289
Color and attribute parsing.
void mutt_color_observer_remove(observer_t callback, void *global_data)
Remove an observer.
Definition: notify.c:69
void mutt_color_observer_add(observer_t callback, void *global_data)
Add an observer.
Definition: notify.c:59
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:84
@ MT_COLOR_MAX
Definition: color.h:94
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:90
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:93
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:91
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:86
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:92
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:79
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:59
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:88
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:83
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:89
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:87
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:85
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)
Definition: set.h:52
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
Convenience wrapper for the core headers.
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:80
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:444
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: draw.c:322
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: draw.c:308
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: draw.c:386
Structs that make up an email.
void mutt_env_set_subject(struct Envelope *env, const char *subj)
Set both subject and real_subj to subj.
Definition: envelope.c:69
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: globals.c:74
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: globals.c:75
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: globals.c:69
#define mutt_warning(...)
Definition: logging2.h:90
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:260
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:385
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: index.c:449
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:474
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:496
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:426
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:222
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:528
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:241
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:547
static int index_recalc(struct MuttWindow *win)
Recalculate the Index display - Implements MuttWindow::recalc() -.
Definition: index.c:587
static int index_repaint(struct MuttWindow *win)
Repaint the Index display - Implements MuttWindow::repaint() -.
Definition: index.c:597
Convenience wrapper for the gui headers.
void index_shared_data_set_email(struct IndexSharedData *shared, struct Email *e)
Set the current Email for the Index and friends.
Definition: shared_data.c:235
Data shared between Index, Pager and Sidebar.
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:112
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
Definition: index.c:184
static int config_reply_regex(struct MailboxView *mv)
React to changes to $reply_regex.
Definition: index.c:196
bool config_check_index(const char *option)
Does this config option affect the Index?
Definition: index.c:355
struct MailboxView * get_current_mailbox_view(void)
Get the current Mailbox view.
Definition: index.c:683
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:715
struct Menu * get_current_menu(void)
Get the current Menu.
Definition: index.c:731
static void sort_use_threads_warn(void)
Alert the user to odd $sort settings.
Definition: index.c:95
static bool config_check_sort(const char *option)
Does this config option affect the Index sorting?
Definition: index.c:316
struct MuttWindow * index_window_new(struct IndexPrivateData *priv)
Create a new Index Window (list of Emails)
Definition: index.c:651
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:160
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
int mutt_map_get_value(const char *name, const struct Mapping *map)
Lookup the constant for a string.
Definition: mapping.c:85
#define mutt_array_size(x)
Definition: memory.h:38
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_adjust(struct Menu *menu)
Reapply the config to the Menu.
Definition: move.c:319
#define MENU_REDRAW_INDEX
Redraw the index.
Definition: lib.h:56
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
#define MENU_REDRAW_NO_FLAGS
No flags are set.
Definition: lib.h:55
struct MuttWindow * menu_window_new(enum MenuType type, struct ConfigSubset *sub)
Create a new Menu Window.
Definition: window.c:140
#define MENU_REDRAW_CURRENT
Redraw the current line of the menu.
Definition: lib.h:58
#define MENU_REDRAW_MOTION
Redraw after moving the menu list.
Definition: lib.h:57
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:660
Create/manipulate threading in emails.
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:99
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:98
@ UT_THREADS
Normal threading (root above subthreads)
Definition: mutt_thread.h:100
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:101
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:654
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
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition: mutt_window.h:86
@ WT_DLG_POSTPONED
Postponed Dialog, dlg_postponed()
Definition: mutt_window.h:89
@ WT_INDEX
A panel containing the Index Window.
Definition: mutt_window.h:97
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:229
@ NT_WINDOW_FOCUS
Window focus has changed.
Definition: mutt_window.h:232
#define WA_REPAINT
Redraw the contents of the Window.
Definition: mutt_window.h:111
void mutt_sleep(short s)
Sleep for a while.
Definition: muttlib.c:843
Some miscellaneous functions.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:418
View of a Mailbox.
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:63
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
@ NT_MENU
Menu has changed, MenuRedrawFlags.
Definition: notify_type.h:51
@ 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:54
@ 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
@ NT_SUBJRX
Subject Regex has changed, NotifySubjRx.
Definition: notify_type.h:55
Private state data for the Pager.
struct MailboxView * postponed_get_mailbox_view(struct MuttWindow *dlg)
Extract the Mailbox from the Postponed Dialog.
Definition: functions.c:213
Postponed Emails.
#define TAILQ_FOREACH_REVERSE(var, head, headname, field)
Definition: queue.h:745
void mutt_check_rescore(struct Mailbox *m)
Do the emails need to have their scores recalculated?
Definition: score.c:67
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:164
Routines for adding user scores to emails.
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:70
SortType
Methods for sorting.
Definition: sort2.h:34
@ SORT_THREADS
Sort by email threads.
Definition: sort2.h:41
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:71
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: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:115
int index
The absolute (unsorted) message number.
Definition: email.h:113
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:53
enum ColorId cid
Colour ID that has changed.
Definition: notify2.h:54
A config-change event.
Definition: subset.h:71
const struct ConfigSubset * sub
Config Subset.
Definition: subset.h:72
const char * name
Name of config item that changed.
Definition: subset.h:73
struct HashElem * he
Config item that changed.
Definition: subset.h:74
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
Private state data for the Index.
Definition: private_data.h:35
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:40
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:41
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:79
int vcount
The number of virtual messages.
Definition: mailbox.h:99
int msg_count
Total number of messages.
Definition: mailbox.h:88
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
Mapping between user-readable string and a constant.
Definition: mapping.h:33
Definition: lib.h:79
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:86
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:82
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:161
int top
Entry that is the top of the current page.
Definition: lib.h:90
struct Notify * notify
Notifications.
Definition: lib.h:145
void * mdata
Private data.
Definition: lib.h:147
int max
Number of entries in the menu.
Definition: lib.h:81
int page_len
Number of entries per screen.
Definition: lib.h:84
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:187
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
struct MuttWindowList children
Children Windows.
Definition: mutt_window.h:136
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Definition: mutt_window.h:132
Container for Accounts, Notifications.
Definition: neomutt.h:42
struct Notify * notify
Notifications handler.
Definition: neomutt.h:43
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:46
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 subjrx_clear_mods(struct MailboxView *mv)
Clear out all modified email subjects.
Definition: subjectrx.c:152
Subject Regex handling.
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:297
@ MENU_INDEX
Index panel (list of emails)
Definition: type.h:51