NeoMutt  2022-04-29-81-g9c5a59
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 
92 static 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 
109 static 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 
157 static 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" */
184  config_use_threads(sub);
185 }
186 
193 static 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 
228 static int index_altern_observer(struct NotifyCallback *nc)
229 {
230  if ((nc->event_type != NT_ALTERN) || !nc->global_data)
231  return -1;
232 
233  struct MuttWindow *win = nc->global_data;
234  struct MuttWindow *dlg = dialog_find(win);
235  struct IndexSharedData *shared = dlg->wdata;
236 
238  mutt_debug(LL_DEBUG5, "alternates done\n");
239  return 0;
240 }
241 
245 static int index_attach_observer(struct NotifyCallback *nc)
246 {
247  if ((nc->event_type != NT_ATTACH) || !nc->global_data)
248  return -1;
249 
250  struct MuttWindow *win = nc->global_data;
251  struct MuttWindow *dlg = dialog_find(win);
252  struct IndexSharedData *shared = dlg->wdata;
253 
255  mutt_debug(LL_DEBUG5, "attachments done\n");
256  return 0;
257 }
258 
262 static int index_color_observer(struct NotifyCallback *nc)
263 {
264  if ((nc->event_type != NT_COLOR) || !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  bool simple = (cid == MT_COLOR_INDEX_COLLAPSED) ||
276 
277  bool lists = (cid == MT_COLOR_INDEX) || (cid == MT_COLOR_INDEX_AUTHOR) ||
279  (cid == MT_COLOR_INDEX_TAG) || (cid == MT_COLOR_TREE) ||
280  (cid == MT_COLOR_NORMAL) || (cid == MT_COLOR_MAX);
281 
282  // The changes aren't relevant to the index menu
283  if (!simple && !lists)
284  return 0;
285 
286  struct MuttWindow *win = nc->global_data;
287  struct MuttWindow *dlg = dialog_find(win);
288  struct IndexSharedData *shared = dlg->wdata;
289 
290  struct Mailbox *m = shared->mailbox;
291  if (!m)
292  return 0;
293 
294  // Colour added/deleted from a list
295  if (lists)
296  {
297  // Force re-caching of index colours
298  for (int i = 0; i < m->msg_count; i++)
299  {
300  struct Email *e = m->emails[i];
301  if (!e)
302  break;
303  e->attr_color = NULL;
304  }
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;
311  win->actions |= WA_REPAINT;
312  mutt_debug(LL_DEBUG5, "color done, request MENU_REDRAW_FULL\n");
313 
314  return 0;
315 }
316 
320 static int index_config_observer(struct NotifyCallback *nc)
321 {
322  if ((nc->event_type != NT_CONFIG) || !nc->global_data || !nc->event_data)
323  return -1;
324 
325  struct EventConfig *ev_c = nc->event_data;
326  struct MuttWindow *win = nc->global_data;
327 
328  const struct ConfigDef *cdef = ev_c->he->data;
329  ConfigRedrawFlags flags = cdef->type & R_REDRAW_MASK;
330 
331  if (flags & R_RESORT_SUB)
332  OptSortSubthreads = true;
333  if (flags & R_RESORT)
334  OptNeedResort = true;
335  if (flags & R_RESORT_INIT)
336  OptResortInit = true;
337  if (!(flags & R_INDEX))
338  return 0;
339 
340  if (mutt_str_equal(ev_c->name, "reply_regex"))
341  {
342  struct MuttWindow *dlg = dialog_find(win);
343  struct IndexSharedData *shared = dlg->wdata;
344  config_reply_regex(shared->mailbox);
345  mutt_debug(LL_DEBUG5, "config done\n");
346  }
347  else if (mutt_str_equal(ev_c->name, "sort"))
348  {
349  config_sort(ev_c->sub);
350  mutt_debug(LL_DEBUG5, "config done\n");
351  }
352  else if (mutt_str_equal(ev_c->name, "use_threads"))
353  {
354  config_use_threads(ev_c->sub);
355  mutt_debug(LL_DEBUG5, "config done\n");
356  }
357 
359  return 0;
360 }
361 
365 static int index_global_observer(struct NotifyCallback *nc)
366 {
367  if ((nc->event_type != NT_GLOBAL) || !nc->global_data)
368  return -1;
369  if (nc->event_subtype != NT_GLOBAL_COMMAND)
370  return 0;
371 
372  struct MuttWindow *win = nc->global_data;
373  struct MuttWindow *dlg = dialog_find(win);
374  if (!dlg)
375  return 0;
376 
377  struct IndexSharedData *shared = dlg->wdata;
378  mutt_check_rescore(shared->mailbox);
379 
380  return 0;
381 }
382 
386 static int index_index_observer(struct NotifyCallback *nc)
387 {
388  if (!nc->global_data)
389  return -1;
390 
391  struct MuttWindow *win = nc->global_data;
392  win->actions |= WA_RECALC;
393 
394  struct Menu *menu = win->wdata;
396  mutt_debug(LL_DEBUG5, "index done, request WA_RECALC\n");
397 
398  struct IndexPrivateData *priv = menu->mdata;
399  struct IndexSharedData *shared = priv->shared;
400  if (shared && shared->mailbox)
401  menu->max = shared->mailbox->vcount;
402  else
403  menu->max = 0;
404 
405  return 0;
406 }
407 
411 static int index_menu_observer(struct NotifyCallback *nc)
412 {
413  if ((nc->event_type != NT_MENU) || !nc->global_data)
414  return -1;
415 
416  struct MuttWindow *win = nc->global_data;
417  struct MuttWindow *dlg = dialog_find(win);
418  struct IndexSharedData *shared = dlg->wdata;
419  struct Menu *menu = win->wdata;
420 
421  const int index = menu_get_index(menu);
422  struct Email *e = mutt_get_virt_email(shared->mailbox, index);
423  index_shared_data_set_email(shared, e);
424 
425  return 0;
426 }
427 
431 static int index_score_observer(struct NotifyCallback *nc)
432 {
433  if ((nc->event_type != NT_SCORE) || !nc->global_data)
434  return -1;
435 
436  struct MuttWindow *win = nc->global_data;
437  struct MuttWindow *dlg = dialog_find(win);
438  struct IndexSharedData *shared = dlg->wdata;
439 
440  struct Mailbox *m = shared->mailbox;
441  if (!m)
442  return 0;
443 
444  for (int i = 0; i < m->msg_count; i++)
445  {
446  struct Email *e = m->emails[i];
447  if (!e)
448  break;
449 
450  mutt_score_message(m, e, true);
451  e->attr_color = NULL; // Force recalc of colour
452  }
453 
454  mutt_debug(LL_DEBUG5, "score done\n");
455  return 0;
456 }
457 
461 static int index_subjrx_observer(struct NotifyCallback *nc)
462 {
463  if ((nc->event_type != NT_SUBJRX) || !nc->global_data)
464  return -1;
465 
466  struct MuttWindow *win = nc->global_data;
467  struct MuttWindow *dlg = dialog_find(win);
468  struct IndexSharedData *shared = dlg->wdata;
469 
470  subjrx_clear_mods(shared->mailbox);
471  mutt_debug(LL_DEBUG5, "subjectrx done\n");
472  return 0;
473 }
474 
478 static int index_window_observer(struct NotifyCallback *nc)
479 {
480  if ((nc->event_type != NT_WINDOW) || !nc->global_data || !nc->event_data)
481  return -1;
482 
483  struct MuttWindow *win = nc->global_data;
484  struct Menu *menu = win->wdata;
485  if (nc->event_subtype != NT_WINDOW_DELETE)
486  {
488  return 0;
489  }
490 
491  struct EventWindow *ev_w = nc->event_data;
492  if (ev_w->win != win)
493  return 0;
494 
495  struct IndexPrivateData *priv = menu->mdata;
496 
507 
508  mutt_debug(LL_DEBUG5, "window delete done\n");
509  return 0;
510 }
511 
515 static int index_recalc(struct MuttWindow *win)
516 {
517  win->actions |= WA_REPAINT;
518  mutt_debug(LL_DEBUG5, "recalc done, request WA_REPAINT\n");
519  return 0;
520 }
521 
525 static int index_repaint(struct MuttWindow *win)
526 {
527  struct Menu *menu = win->wdata;
528 
529  if (menu->redraw & MENU_REDRAW_FULL)
530  menu_redraw_full(menu);
531 
532  // If we don't have the focus, then this is a mini-Index ($pager_index_lines)
533  if (!window_is_focused(menu->win))
534  {
535  int indicator = menu->page_len / 3;
536 
537  /* some fudge to work out whereabouts the indicator should go */
538  const int index = menu_get_index(menu);
539  if ((index - indicator) < 0)
540  menu->top = 0;
541  else if ((menu->max - index) < (menu->page_len - indicator))
542  menu->top = menu->max - menu->page_len;
543  else
544  menu->top = index - indicator;
545  }
546  menu_adjust(menu);
547  menu->redraw = MENU_REDRAW_INDEX;
548 
549  struct IndexPrivateData *priv = menu->mdata;
550  struct IndexSharedData *shared = priv->shared;
551  struct Mailbox *m = shared->mailbox;
552  const int index = menu_get_index(menu);
553  if (m && m->emails && (index < m->vcount))
554  {
555  if (menu->redraw & MENU_REDRAW_INDEX)
556  {
557  menu_redraw_index(menu);
558  }
559  else if (menu->redraw & MENU_REDRAW_MOTION)
560  menu_redraw_motion(menu);
561  else if (menu->redraw & MENU_REDRAW_CURRENT)
562  menu_redraw_current(menu);
563  }
564 
566  mutt_debug(LL_DEBUG5, "repaint done\n");
567  return 0;
568 }
569 
575 {
577  win->recalc = index_recalc;
578  win->repaint = index_repaint;
579 
580  struct Menu *menu = win->wdata;
581  menu->mdata = priv;
582  menu->mdata_free = NULL; // Menu doesn't own the data
583  priv->menu = menu;
584 
595 
596  return win;
597 }
598 
607 {
608  if (!AllDialogsWindow)
609  return NULL;
610 
611  struct MuttWindow *np = NULL;
612  TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
613  {
614  struct MuttWindow *win = window_find_child(np, WT_DLG_INDEX);
615  if (win)
616  {
617  struct IndexSharedData *shared = win->wdata;
618  return shared->mailbox;
619  }
620  }
621 
622  return NULL;
623 }
624 
632 struct Menu *get_current_menu(void)
633 {
634  if (!AllDialogsWindow)
635  return NULL;
636 
637  struct MuttWindow *np = NULL;
638  TAILQ_FOREACH_REVERSE(np, &AllDialogsWindow->children, MuttWindowList, entries)
639  {
640  struct MuttWindow *dlg = window_find_child(np, WT_DLG_INDEX);
641  if (dlg)
642  {
643  struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
644  struct IndexPrivateData *priv = panel_index->wdata;
645  return priv->menu;
646  }
647  }
648 
649  return NULL;
650 }
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:286
Color and attribute parsing.
@ MT_COLOR_INDEX_AUTHOR
Index: author field (takes a pattern)
Definition: color.h:77
@ MT_COLOR_MAX
Definition: color.h:88
@ MT_COLOR_INDEX_SIZE
Index: size field.
Definition: color.h:86
@ MT_COLOR_INDEX_TAGS
Index: tags field (g, J)
Definition: color.h:87
@ MT_COLOR_INDEX_SUBJECT
Index: subject field (takes a pattern)
Definition: color.h:79
@ MT_COLOR_INDEX_DATE
Index: date field.
Definition: color.h:83
@ MT_COLOR_INDEX_TAG
Index: tag field (g, takes a pattern)
Definition: color.h:80
@ MT_COLOR_TREE
Index: tree-drawing characters.
Definition: color.h:72
@ MT_COLOR_NORMAL
Plain text.
Definition: color.h:53
@ MT_COLOR_INDEX_LABEL
Index: label field.
Definition: color.h:84
@ MT_COLOR_INDEX
Index: default colour (takes a pattern)
Definition: color.h:76
@ MT_COLOR_INDEX_NUMBER
Index: index number.
Definition: color.h:85
@ MT_COLOR_INDEX_FLAGS
Index: flags field (takes a pattern)
Definition: color.h:78
@ MT_COLOR_INDEX_COLLAPSED
Index: number of messages in collapsed thread.
Definition: color.h:82
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:445
void menu_redraw_index(struct Menu *menu)
Force the redraw of the index.
Definition: draw.c:329
void menu_redraw_full(struct Menu *menu)
Force the redraw of the Menu.
Definition: draw.c:315
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.
#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:262
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:386
static int index_menu_observer(struct NotifyCallback *nc)
Notification that the Menu has changed - Implements observer_t -.
Definition: index.c:411
static int index_score_observer(struct NotifyCallback *nc)
Notification that a 'score' command has occurred - Implements observer_t -.
Definition: index.c:431
static int index_global_observer(struct NotifyCallback *nc)
Notification that a Global event occurred - Implements observer_t -.
Definition: index.c:365
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:461
static int index_attach_observer(struct NotifyCallback *nc)
Notification that an 'attachments' command has occurred - Implements observer_t -.
Definition: index.c:245
static int index_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: index.c:478
static int index_recalc(struct MuttWindow *win)
Recalculate the Index display - Implements MuttWindow::recalc() -.
Definition: index.c:515
static int index_repaint(struct MuttWindow *win)
Repaint the Index display - Implements MuttWindow::repaint() -.
Definition: index.c:525
Convenience wrapper for the gui headers.
unsigned char cs_subset_enum(const struct ConfigSubset *sub, const char *name)
Get a enumeration config item by name.
Definition: helpers.c:97
const struct Regex * cs_subset_regex(const struct ConfigSubset *sub, const char *name)
Get a regex config item by name.
Definition: helpers.c:243
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
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:226
Data shared between Index, Pager and Sidebar.
static int config_sort(const struct ConfigSubset *sub)
React to changes to "sort".
Definition: index.c:109
struct Menu * get_current_menu(void)
Get the current Menu.
Definition: index.c:632
void index_adjust_sort_threads(const struct ConfigSubset *sub)
Adjust use_threads/sort/sort_aux.
Definition: index.c:181
struct MuttWindow * index_window_new(struct IndexPrivateData *priv)
Create a new Index Window (list of Emails)
Definition: index.c:574
static void sort_use_threads_warn(void)
Alert the user to odd $sort settings.
Definition: index.c:92
static int config_use_threads(const struct ConfigSubset *sub)
React to changes to "use_threads".
Definition: index.c:157
struct Mailbox * get_current_mailbox(void)
Get the current Mailbox.
Definition: index.c:606
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
struct MuttWindow * menu_window_new(enum MenuType type, struct ConfigSubset *sub)
Create a new Menu Window.
Definition: window.c:136
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
#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, observer_t callback, 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:784
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
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
bool window_is_focused(struct MuttWindow *win)
Does the given Window have the focus?
Definition: mutt_window.c:629
#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:1454
Some miscellaneous functions.
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition: mview.c:412
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