NeoMutt  2022-04-29-323-g5fcc6c
Teaching an old dog new tricks
DOXYGEN
index.c
Go to the documentation of this file.
1
68#include "config.h"
69#include <stddef.h>
70#include <stdbool.h>
71#include "mutt/lib.h"
72#include "config/lib.h"
73#include "email/lib.h"
74#include "core/lib.h"
75#include "gui/lib.h"
76#include "attach/lib.h"
77#include "color/lib.h"
78#include "menu/lib.h"
79#include "alternates.h"
80#include "mutt_thread.h"
81#include "muttlib.h"
82#include "mview.h"
83#include "options.h"
84#include "private_data.h"
85#include "score.h"
86#include "shared_data.h"
87#include "subjectrx.h"
88
92static void sort_use_threads_warn(void)
93{
94 static bool warned = false;
95 if (!warned)
96 {
97 mutt_warning(_("Changing threaded display should prefer $use_threads over $sort"));
98 warned = true;
99 mutt_sleep(0);
100 }
101}
102
109static int config_sort(const struct ConfigSubset *sub)
110{
111 const short c_sort = cs_subset_sort(sub, "sort");
112 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
113
114 if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
115 return 0;
116
118
119 /* Note: changing a config variable here kicks off a second round of
120 * observers before the first round has completed. Be careful that
121 * changes made here do not cause an infinite loop of toggling
122 * adjustments - the early exit above when $sort no longer uses
123 * SORT_THREADS ends the recursion.
124 */
125 int rc;
126 if ((c_use_threads == UT_FLAT) ||
127 (!(c_sort & SORT_REVERSE) == (c_use_threads == UT_REVERSE)))
128 {
129 /* If we were flat or the user wants to change thread
130 * directions, then leave $sort alone for now and change
131 * $use_threads to match the desired outcome. The 2nd-level
132 * observer for $use_threads will then adjust $sort, and our
133 * 3rd-level observer for $sort will be a no-op.
134 */
135 rc = cs_subset_str_native_set(sub, "use_threads",
136 (c_sort & SORT_REVERSE) ? UT_REVERSE : UT_THREADS, NULL);
137 }
138 else
139 {
140 /* We were threaded, and the user still wants the same thread
141 * direction. Adjust $sort based on $sort_aux, and the 2nd-level
142 * observer for $sort will be a no-op.
143 */
144 short c_sort_aux = cs_subset_sort(sub, "sort_aux");
145 c_sort_aux ^= (c_sort & SORT_REVERSE);
146 rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
147 }
148 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
149}
150
157static int config_use_threads(const struct ConfigSubset *sub)
158{
159 const short c_sort = cs_subset_sort(sub, "sort");
160 const unsigned char c_use_threads = cs_subset_enum(sub, "use_threads");
161
162 if (((c_sort & SORT_MASK) != SORT_THREADS) || (c_use_threads == UT_UNSET))
163 return 0;
164
166
167 /* Note: changing a config variable here kicks off a second round of
168 * observers before the first round has completed. But since we
169 * aren't setting $sort to threads, the 2nd-level observer will be a
170 * no-op.
171 */
172 const short c_sort_aux = cs_subset_sort(sub, "sort_aux");
173 int rc = cs_subset_str_native_set(sub, "sort", c_sort_aux, NULL);
174 return (CSR_RESULT(rc) == CSR_SUCCESS) ? 0 : -1;
175}
176
182{
183 /* For lack of a better way, we fake a "set use_threads" */
185}
186
193static int config_reply_regex(struct Mailbox *m)
194{
195 if (!m)
196 return 0;
197
198 regmatch_t pmatch[1];
199
200 for (int i = 0; i < m->msg_count; i++)
201 {
202 struct Email *e = m->emails[i];
203 if (!e)
204 break;
205 struct Envelope *env = e->env;
206 if (!env || !env->subject)
207 continue;
208
209 const struct Regex *c_reply_regex = cs_subset_regex(NeoMutt->sub, "reply_regex");
210 if (mutt_regex_capture(c_reply_regex, env->subject, 1, pmatch))
211 {
212 env->real_subj = env->subject + pmatch[0].rm_eo;
213 if (env->real_subj[0] == '\0')
214 env->real_subj = NULL;
215 continue;
216 }
217
218 env->real_subj = env->subject;
219 }
220
221 OptResortInit = true; /* trigger a redraw of the index */
222 return 0;
223}
224
229{
230 if (nc->event_type != NT_ALTERN)
231 return 0;
232 if (!nc->global_data)
233 return -1;
234
235 struct MuttWindow *win = nc->global_data;
236 struct MuttWindow *dlg = dialog_find(win);
237 struct IndexSharedData *shared = dlg->wdata;
238
240 mutt_debug(LL_DEBUG5, "alternates done\n");
241 return 0;
242}
243
248{
249 if (nc->event_type != NT_ATTACH)
250 return 0;
251 if (!nc->global_data)
252 return -1;
253
254 struct MuttWindow *win = nc->global_data;
255 struct MuttWindow *dlg = dialog_find(win);
256 struct IndexSharedData *shared = dlg->wdata;
257
259 mutt_debug(LL_DEBUG5, "attachments done\n");
260 return 0;
261}
262
267{
268 if (nc->event_type != NT_COLOR)
269 return 0;
270 if (!nc->global_data || !nc->event_data)
271 return -1;
272
273 struct EventColor *ev_c = nc->event_data;
274
275 const int cid = ev_c->cid;
276
277 // MT_COLOR_MAX is sent on `uncolor *`
278 if (!((cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
284 (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_TREE)))
285 {
286 // The changes aren't relevant to the index menu
287 return 0;
288 }
289
290 struct MuttWindow *win = nc->global_data;
291 struct MuttWindow *dlg = dialog_find(win);
292 struct IndexSharedData *shared = dlg->wdata;
293
294 struct Mailbox *m = shared->mailbox;
295 if (!m)
296 return 0;
297
298 // Force re-caching of index colours
299 for (int i = 0; i < m->msg_count; i++)
300 {
301 struct Email *e = m->emails[i];
302 if (!e)
303 break;
304 e->attr_color = NULL;
305 }
306
307 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
308 struct IndexPrivateData *priv = panel_index->wdata;
309 struct Menu *menu = priv->menu;
310 menu->redraw = MENU_REDRAW_FULL;
312 mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
313
314 return 0;
315}
316
321{
322 if (nc->event_type != NT_CONFIG)
323 return 0;
324 if (!nc->global_data || !nc->event_data)
325 return -1;
326
327 struct EventConfig *ev_c = nc->event_data;
328 struct MuttWindow *win = nc->global_data;
329
330 const struct ConfigDef *cdef = ev_c->he->data;
331 ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
332
333 if (flags & R_RESORT_SUB)
334 OptSortSubthreads = true;
335 if (flags & R_RESORT)
336 OptNeedResort = true;
337 if (flags & R_RESORT_INIT)
338 OptResortInit = true;
339 if (!(flags & R_INDEX))
340 return 0;
341
342 if (mutt_str_equal(ev_c->name, "reply_regex"))
343 {
344 struct MuttWindow *dlg = dialog_find(win);
345 struct IndexSharedData *shared = dlg->wdata;
347 mutt_debug(LL_DEBUG5, "config done\n");
348 }
349 else if (mutt_str_equal(ev_c->name, "sort"))
350 {
351 config_sort(ev_c->sub);
352 mutt_debug(LL_DEBUG5, "config done\n");
353 }
354 else if (mutt_str_equal(ev_c->name, "use_threads"))
355 {
356 config_use_threads(ev_c->sub);
357 mutt_debug(LL_DEBUG5, "config done\n");
358 }
359
361 return 0;
362}
363
368{
369 if (nc->event_type != NT_GLOBAL)
370 return 0;
371 if (!nc->global_data)
372 return -1;
374 return 0;
375
376 struct MuttWindow *win = nc->global_data;
377 struct MuttWindow *dlg = dialog_find(win);
378 if (!dlg)
379 return 0;
380
381 struct IndexSharedData *shared = dlg->wdata;
383
384 return 0;
385}
386
391{
392 if (!nc->global_data)
393 return -1;
394
395 struct MuttWindow *win = nc->global_data;
396 win->actions |= WA_RECALC;
397
398 struct Menu *menu = win->wdata;
400 mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
401
402 struct IndexPrivateData *priv = menu->mdata;
403 struct IndexSharedData *shared = priv->shared;
404 if (shared && shared->mailbox)
405 menu->max = shared->mailbox->vcount;
406 else
407 menu->max = 0;
408
409 return 0;
410}
411
416{
417 if (nc->event_type != NT_MENU)
418 return 0;
419 if (!nc->global_data)
420 return -1;
421
422 struct MuttWindow *win = nc->global_data;
423 struct MuttWindow *dlg = dialog_find(win);
424 struct IndexSharedData *shared = dlg->wdata;
425 struct Menu *menu = win->wdata;
426
427 const int index = menu_get_index(menu);
428 struct Email *e = mutt_get_virt_email(shared->mailbox, index);
430
431 return 0;
432}
433
438{
439 if (nc->event_type != NT_SCORE)
440 return 0;
441 if (!nc->global_data)
442 return -1;
443
444 struct MuttWindow *win = nc->global_data;
445 struct MuttWindow *dlg = dialog_find(win);
446 struct IndexSharedData *shared = dlg->wdata;
447
448 struct Mailbox *m = shared->mailbox;
449 if (!m)
450 return 0;
451
452 for (int i = 0; i < m->msg_count; i++)
453 {
454 struct Email *e = m->emails[i];
455 if (!e)
456 break;
457
458 mutt_score_message(m, e, true);
459 e->attr_color = NULL; // Force recalc of colour
460 }
461
462 mutt_debug(LL_DEBUG5, "score done\n");
463 return 0;
464}
465
470{
471 if (nc->event_type != NT_SUBJRX)
472 return 0;
473 if (!nc->global_data)
474 return -1;
475
476 struct MuttWindow *win = nc->global_data;
477 struct MuttWindow *dlg = dialog_find(win);
478 struct IndexSharedData *shared = dlg->wdata;
479
480 subjrx_clear_mods(shared->mailbox);
481 mutt_debug(LL_DEBUG5, "subjectrx done\n");
482 return 0;
483}
484
489{
490 if (nc->event_type != NT_WINDOW)
491 return 0;
492 if (!nc->global_data || !nc->event_data)
493 return -1;
494
495 struct MuttWindow *win = nc->global_data;
496 struct Menu *menu = win->wdata;
498 {
500 return 0;
501 }
502
503 struct EventWindow *ev_w = nc->event_data;
504 if (ev_w->win != win)
505 return 0;
506
507 struct IndexPrivateData *priv = menu->mdata;
508
519
520 mutt_debug(LL_DEBUG5, "window delete done\n");
521 return 0;
522}
523
527static int index_recalc(struct MuttWindow *win)
528{
529 win->actions |= WA_REPAINT;
530 mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
531 return 0;
532}
533
537static int index_repaint(struct MuttWindow *win)
538{
539 struct Menu *menu = win->wdata;
540
541 if (menu->redraw & MENU_REDRAW_FULL)
542 menu_redraw_full(menu);
543
544 // If we don't have the focus, then this is a mini-Index ($pager_index_lines)
545 if (!window_is_focused(menu->win))
546 {
547 int indicator = menu->page_len / 3;
548
549 /* some fudge to work out whereabouts the indicator should go */
550 const int index = menu_get_index(menu);
551 if ((index - indicator) < 0)
552 menu->top = 0;
553 else if ((menu->max - index) < (menu->page_len - indicator))
554 menu->top = menu->max - menu->page_len;
555 else
556 menu->top = index - indicator;
557 }
558 menu_adjust(menu);
560
561 struct IndexPrivateData *priv = menu->mdata;
562 struct IndexSharedData *shared = priv->shared;
563 struct Mailbox *m = shared->mailbox;
564 const int index = menu_get_index(menu);
565 if (m && m->emails && (index < m->vcount))
566 {
567 if (menu->redraw & MENU_REDRAW_INDEX)
568 {
569 menu_redraw_index(menu);
570 }
571 else if (menu->redraw & MENU_REDRAW_MOTION)
572 menu_redraw_motion(menu);
573 else if (menu->redraw & MENU_REDRAW_CURRENT)
575 }
576
578 mutt_debug(LL_DEBUG5, "repaint done\n");
579 return 0;
580}
581
587{
589 win->recalc = index_recalc;
590 win->repaint = index_repaint;
591
592 struct Menu *menu = win->wdata;
593 menu->mdata = priv;
594 menu->mdata_free = NULL; // Menu doesn't own the data
595 priv->menu = menu;
596
607
608 return win;
609}
610
619{
620 if (!AllDialogsWindow)
621 return NULL;
622
623 struct MuttWindow *np = NULL;
624 TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
625 {
626 struct MuttWindow *win = window_find_child(np, WT_DLG_INDEX);
627 if (win)
628 {
629 struct IndexSharedData *shared = win->wdata;
630 return shared->mailbox;
631 }
632 }
633
634 return NULL;
635}
636
645{
646 if (!AllDialogsWindow)
647 return NULL;
648
649 struct MuttWindow *np = NULL;
650 TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
651 {
652 struct MuttWindow *dlg = window_find_child(np, WT_DLG_INDEX);
653 if (dlg)
654 {
655 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
656 struct IndexPrivateData *priv = panel_index->wdata;
657 return priv->menu;
658 }
659 }
660
661 return NULL;
662}
void mutt_alternates_reset(struct Mailbox *m)
Clear the recipient valid flag of all emails.
Definition: alternates.c:72
Alternate address handling.
GUI display the mailboxes in a side panel.
void mutt_attachments_reset(struct Mailbox *m)
Reset the attachment count for all Emails.
Definition: attachments.c:285
Color and attribute parsing.
@ MT_COLOR_INDEX_AUTHOR
Index: author field.
Definition: color.h:81
@ MT_COLOR_MAX
Definition: color.h:91
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:87
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:90
@ MT_COLOR_INDEX_SUBJECT
Index: subject field.
Definition: color.h:88
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:83
@ MT_COLOR_INDEX_TAG
Index: tag field (G)
Definition: color.h:89
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:76
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:57
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:85
@ MT_COLOR_INDEX
Index: default colour.
Definition: color.h:80
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:86
@ MT_COLOR_INDEX_FLAGS
Index: flags field.
Definition: color.h:84
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:82
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
Definition: helpers.c:243
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition: helpers.c:97
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
struct MuttWindow * AllDialogsWindow
Parent of all Dialogs.
Definition: dialog.c:74
struct MuttWindow * dialog_find(struct MuttWindow *win)
Find the parent Dialog of a Window.
Definition: dialog.c:83
void menu_redraw_current(struct Menu *menu)
Redraw the current menu.
Definition: draw.c:436
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: draw.c:320
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: draw.c:306
void menu_redraw_motion(struct Menu *menu)
Force the redraw of the list part of the menu.
Definition: draw.c:377
Structs that make up an email.
#define mutt_warning(...)
Definition: logging.h:85
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static int index_color_observer(struct NotifyCallback *nc)
Notification that a Color has changed - Implements observer_t -.
Definition: index.c:266
static int index_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: index.c:320
static int index_index_observer(struct NotifyCallback *nc)
Notification that the Index has changed - Implements observer_t -.
Definition: index.c:390
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:415
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:437
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:367
static int index_altern_observer(struct NotifyCallback *nc)
Notification that an 'alternates' command has occurred - Implements observer_t -.
Definition: index.c:228
static int index_subjrx_observer(struct NotifyCallback *nc)
Notification that a 'subjectrx' command has occurred - Implements observer_t -.
Definition: index.c:469
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:247
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:488
static int index_recalc(struct MuttWindow *win)
Recalculate the Index display - Implements MuttWindow::recalc() -.
Definition: index.c:527
static int index_repaint(struct MuttWindow *win)
Repaint the Index display - Implements MuttWindow::repaint() -.
Definition: index.c:537
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:230
Data shared between Index, Pager and Sidebar.
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:109
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
Definition: index.c:181
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:618
struct Menu * get_current_menu(void)
Get the current Menu.
Definition: index.c:644
static void sort_use_threads_warn(void)
Alert the user to odd $sort settings.
Definition: index.c:92
struct MuttWindow * index_window_new(struct IndexPrivateData *priv)
Create a new Index Window (list of Emails)
Definition: index.c:586
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:157
static int config_reply_regex(struct Mailbox *m)
React to changes to $reply_regex.
Definition: index.c:193
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
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:178
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:154
#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:136
#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:228
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:189
bool mutt_regex_capture(const struct Regex *regex, const char *str, size_t nmatch, regmatch_t matches[])
Match a regex against a string, with provided options.
Definition: regex.c:614
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
Create/manipulate threading in emails.
@ UT_FLAT
Unthreaded.
Definition: mutt_thread.h:85
@ UT_UNSET
Not yet set by user, stick to legacy semantics.
Definition: mutt_thread.h:84
@ UT_THREADS
Normal threading (root above subthreads)
Definition: mutt_thread.h:86
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition: mutt_thread.h:87
bool window_is_focused(const struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:629
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
#define WA_RECALC
Recalculate the contents of the Window.
Definition: mutt_window.h:110
@ WT_DLG_INDEX
Index Dialog, index_pager_init()
Definition: mutt_window.h:86
@ 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:206
#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:1455
Some miscellaneous functions.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:414
The "currently-open" mailbox.
@ NT_GLOBAL_COMMAND
A NeoMutt command.
Definition: neomutt.h:55
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
@ 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:53
@ 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:54
Handling of global boolean variables.
bool OptResortInit
(pseudo) used to force the next resort to be from scratch
Definition: options.h:56
bool OptSortSubthreads
(pseudo) used when $sort_aux changes
Definition: options.h:59
bool OptNeedResort
(pseudo) used to force a re-sort
Definition: options.h:48
Private state data for the Pager.
#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:63
void mutt_score_message(struct Mailbox *m, struct Email *e, bool upd_mbox)
Apply scoring to an email.
Definition: score.c:159
Routines for adding user scores to emails.
#define CSR_RESULT(x)
Definition: set.h:52
#define CSR_SUCCESS
Action completed successfully.
Definition: set.h:35
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
@ SORT_THREADS
Sort by email threads.
Definition: sort2.h:49
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:79
Definition: set.h:64
uint32_t type
Variable type, e.g. DT_STRING.
Definition: set.h:66
A set of inherited config items.
Definition: subset.h:47
The envelope/body of an email.
Definition: email.h:37
struct Envelope * env
Envelope information.
Definition: email.h:66
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 * subject
Email's subject.
Definition: envelope.h:70
char * real_subj
Offset of the real subject.
Definition: envelope.h:71
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: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.
Definition: mutt_window.h:216
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
void * data
User-supplied data.
Definition: hash.h:47
Private state data for the Index.
Definition: private_data.h:35
struct IndexSharedData * shared
Shared Index data.
Definition: private_data.h:42
struct Menu * menu
Menu controlling the index.
Definition: private_data.h:43
Data shared between Index, Pager and Sidebar.
Definition: shared_data.h:37
struct Mailbox * mailbox
Current Mailbox.
Definition: shared_data.h:41
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition: shared_data.h:44
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
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
MenuRedrawFlags redraw
When to redraw the screen.
Definition: lib.h:72
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:152
int top
Entry that is the top of the current page.
Definition: lib.h:80
struct Notify * notify
Notifications.
Definition: lib.h:135
void * mdata
Private data.
Definition: lib.h:137
int max
Number of entries in the menu.
Definition: lib.h:71
int page_len
Number of entries per screen.
Definition: lib.h:74
int(* repaint)(struct MuttWindow *win)
Definition: mutt_window.h:182
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:171
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:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
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
Cached regular expression.
Definition: regex3.h:89
void subjrx_clear_mods(struct Mailbox *m)
Clear out all modified email subjects.
Definition: subjectrx.c:146
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:305
@ MENU_INDEX
Index panel (list of emails)
Definition: type.h:50
#define R_RESORT
Resort the mailbox.
Definition: types.h:68
#define R_RESORT_SUB
Resort subthreads.
Definition: types.h:69
uint32_t ConfigRedrawFlags
Flags for redraw/resort, e.g. R_INDEX.
Definition: types.h:63
#define R_REDRAW_MASK
Mask for the Redraw Flags.
Definition: types.h:74
#define R_INDEX
Redraw the index menu (MENU_INDEX)
Definition: types.h:65
#define R_RESORT_INIT
Resort from scratch.
Definition: types.h:70