NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_index.c File Reference

Index Dialog. More...

#include "config.h"
#include <stdbool.h>
#include <string.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "conn/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "color/lib.h"
#include "expando/lib.h"
#include "hooks/lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "nntp/lib.h"
#include "pager/lib.h"
#include "pattern/lib.h"
#include "sidebar/lib.h"
#include "expando_index.h"
#include "functions.h"
#include "globals.h"
#include "mutt_logging.h"
#include "mutt_mailbox.h"
#include "mx.h"
#include "nntp/adata.h"
#include "private_data.h"
#include "shared_data.h"
#include "status.h"
#include "notmuch/lib.h"
#include "monitor.h"
+ Include dependency graph for dlg_index.c:

Go to the source code of this file.

Functions

bool check_acl (struct Mailbox *m, AclFlags acl, const char *msg)
 Check the ACLs for a function.
 
void collapse_all (struct MailboxView *mv, struct Menu *menu, enum CollapseMode mode)
 Collapse/uncollapse all threads.
 
static void uncollapse_thread (struct MailboxView *mv, int index)
 Open a collapsed thread.
 
int find_next_undeleted (struct MailboxView *mv, int msgno, bool uncollapse)
 Find the next undeleted email.
 
int find_previous_undeleted (struct MailboxView *mv, int msgno, bool uncollapse)
 Find the previous undeleted email.
 
int find_first_message (struct MailboxView *mv)
 Get index of first new message.
 
void resort_index (struct MailboxView *mv, struct Menu *menu)
 Resort the index.
 
static void update_index_threaded (struct MailboxView *mv, enum MxStatus check, int oldcount)
 Update the index (if threaded)
 
static void update_index_unthreaded (struct MailboxView *mv, enum MxStatus check)
 Update the index (if unthreaded)
 
void update_index (struct Menu *menu, struct MailboxView *mv, enum MxStatus check, int oldcount, const struct IndexSharedData *shared)
 Update the index.
 
static int index_mailbox_observer (struct NotifyCallback *nc)
 Notification that a Mailbox has changed - Implements observer_t -.
 
void change_folder_mailbox (struct Menu *menu, struct Mailbox *m, int *oldcount, struct IndexSharedData *shared, bool read_only)
 Change to a different Mailbox by pointer.
 
struct Mailboxchange_folder_notmuch (struct Menu *menu, char *buf, int buflen, int *oldcount, struct IndexSharedData *shared, bool read_only)
 Change to a different Notmuch Mailbox by string.
 
void change_folder_string (struct Menu *menu, struct Buffer *buf, int *oldcount, struct IndexSharedData *shared, bool read_only)
 Change to a different Mailbox by string.
 
int mutt_make_string (struct Buffer *buf, size_t max_cols, const struct Expando *exp, struct Mailbox *m, int inpgr, struct Email *e, MuttFormatFlags flags, const char *progress)
 Create formatted strings using mailbox expandos.
 
int index_make_entry (struct Menu *menu, int line, int max_cols, struct Buffer *buf)
 Format an Email for the Menu - Implements Menu::make_entry() -.
 
const struct AttrColorindex_color (struct Menu *menu, int line)
 Calculate the colour for a line of the index - Implements Menu::color() -.
 
void mutt_draw_statusline (struct MuttWindow *win, int max_cols, const char *buf, size_t buflen)
 Draw a highlighted status bar.
 
struct Mailboxdlg_index (struct MuttWindow *dlg, struct Mailbox *m_init)
 Display a list of emails -.
 
void email_set_color (struct Mailbox *m, struct Email *e)
 Select an Index colour for an Email.
 
struct MuttWindowindex_pager_init (void)
 Allocate the Windows for the Index/Pager.
 
void index_change_folder (struct MuttWindow *dlg, struct Mailbox *m)
 Change the current folder, cautiously.
 

Variables

static const struct Mapping IndexHelp []
 Help Bar for the Index dialog.
 
const struct Mapping IndexNewsHelp []
 Help Bar for the News Index dialog.
 

Detailed Description

Index Dialog.

Authors
  • Pietro Cerutti
  • Richard Russon
  • R Primus
  • Eric Blake
  • Igor Serebryany
  • Dennis Schön
  • Tóth János

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file dlg_index.c.

Function Documentation

◆ check_acl()

bool check_acl ( struct Mailbox * m,
AclFlags acl,
const char * msg )

Check the ACLs for a function.

Parameters
mMailbox
aclACL, see AclFlags
msgError message for failure
Return values
trueThe function is permitted

Definition at line 135 of file dlg_index.c.

136{
137 if (!m)
138 return false;
139
140 if (!(m->rights & acl))
141 {
142 /* L10N: %s is one of the CHECK_ACL entries below. */
143 mutt_error(_("%s: Operation not permitted by ACL"), msg);
144 return false;
145 }
146
147 return true;
148}
#define mutt_error(...)
Definition logging2.h:94
#define _(a)
Definition message.h:28
AclFlags rights
ACL bits, see AclFlags.
Definition mailbox.h:118
+ Here is the caller graph for this function:

◆ collapse_all()

void collapse_all ( struct MailboxView * mv,
struct Menu * menu,
enum CollapseMode mode )

Collapse/uncollapse all threads.

Parameters
mvMailbox View
menuCurrent menu
modeCollapse mode

This function is called by OP_MAIN_COLLAPSE_ALL, by the one-way open/close commands, and on folder enter if the $collapse_all option is set.

Definition at line 159 of file dlg_index.c.

160{
161 if (!mv || !mv->mailbox || (mv->mailbox->msg_count == 0) || !menu)
162 return;
163
164 struct Email *e_cur = mutt_get_virt_email(mv->mailbox, menu_get_index(menu));
165 if (!e_cur)
166 return;
167
168 int final = -1;
169
170 /* Figure out what the current message would be after folding / unfolding,
171 * so that we can restore the cursor in a sane way afterwards. */
172 switch (mode)
173 {
175 if (e_cur->collapsed)
176 final = mutt_uncollapse_thread(e_cur);
177 else if (mutt_thread_can_collapse(e_cur))
178 final = mutt_collapse_thread(e_cur);
179 else
180 final = e_cur->vnum;
181 break;
182
184 if (mutt_thread_can_collapse(e_cur))
185 final = mutt_collapse_thread(e_cur);
186 else
187 final = e_cur->vnum;
188 break;
189
191 if (e_cur->collapsed)
192 final = mutt_uncollapse_thread(e_cur);
193 else
194 final = e_cur->vnum;
195 break;
196 }
197
198 if (final == -1)
199 return;
200
201 struct Email *base = mutt_get_virt_email(mv->mailbox, final);
202 if (!base)
203 return;
204
205 /* Iterate all threads, perform collapse/uncollapse as needed */
206 if (mode == COLLAPSE_MODE_TOGGLE)
207 mv->collapsed = !mv->collapsed;
208 else
209 mv->collapsed = (mode == COLLAPSE_MODE_CLOSE);
211
212 /* Restore the cursor */
214 menu->max = mv->mailbox->vcount;
215 for (int i = 0; i < mv->mailbox->vcount; i++)
216 {
217 struct Email *e = mutt_get_virt_email(mv->mailbox, i);
218 if (!e)
219 break;
220 if (e->index == base->index)
221 {
222 menu_set_index(menu, i);
223 break;
224 }
225 }
226
228}
void mutt_thread_collapse(struct ThreadsContext *tctx, bool collapse)
Toggle collapse.
Definition thread.c:1868
off_t mutt_set_vnum(struct Mailbox *m)
Set the virtual index number of all the messages in a mailbox.
Definition thread.c:1483
bool mutt_thread_can_collapse(struct Email *e)
Check whether a thread can be collapsed.
Definition thread.c:1896
#define mutt_uncollapse_thread(e)
Definition thread.h:107
#define mutt_collapse_thread(e)
Definition thread.h:106
@ COLLAPSE_MODE_TOGGLE
Toggle collapsed state.
Definition lib.h:91
@ COLLAPSE_MODE_CLOSE
Collapse all threads.
Definition lib.h:92
@ COLLAPSE_MODE_OPEN
Open all threads.
Definition lib.h:93
#define MENU_REDRAW_INDEX
Redraw the index.
Definition lib.h:57
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:188
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:164
MenuRedrawFlags menu_set_index(struct Menu *menu, int index)
Set the current selection in the Menu.
Definition menu.c:178
struct Email * mutt_get_virt_email(struct Mailbox *m, int vnum)
Get a virtual Email.
Definition mview.c:415
The envelope/body of an email.
Definition email.h:39
bool collapsed
Is this message part of a collapsed thread?
Definition email.h:120
int vnum
Virtual message number.
Definition email.h:114
int index
The absolute (unsorted) message number.
Definition email.h:110
bool collapsed
Are all threads collapsed?
Definition mview.h:49
struct ThreadsContext * threads
Threads context.
Definition mview.h:44
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
int vcount
The number of virtual messages.
Definition mailbox.h:98
int msg_count
Total number of messages.
Definition mailbox.h:87
int max
Number of entries in the menu.
Definition lib.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uncollapse_thread()

static void uncollapse_thread ( struct MailboxView * mv,
int index )
static

Open a collapsed thread.

Parameters
mvMailbox View
indexMessage number

Definition at line 235 of file dlg_index.c.

236{
237 if (!mv || !mv->mailbox)
238 return;
239
240 struct Mailbox *m = mv->mailbox;
241 struct Email *e = mutt_get_virt_email(m, index);
242 if (e && e->collapsed)
243 {
245 mutt_set_vnum(m);
246 }
247}
A mailbox.
Definition mailbox.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_next_undeleted()

int find_next_undeleted ( struct MailboxView * mv,
int msgno,
bool uncollapse )

Find the next undeleted email.

Parameters
mvMailbox view
msgnoMessage number to start at
uncollapseOpen collapsed threads
Return values
>=0Message number of next undeleted email
-1No more undeleted messages

Definition at line 257 of file dlg_index.c.

258{
259 if (!mv || !mv->mailbox)
260 return -1;
261
262 struct Mailbox *m = mv->mailbox;
263
264 int index = -1;
265 for (int i = msgno + 1; i < m->vcount; i++)
266 {
267 struct Email *e = mutt_get_virt_email(m, i);
268 if (!e)
269 continue;
270 if (!e->deleted)
271 {
272 index = i;
273 break;
274 }
275 }
276
277 if (uncollapse)
279
280 return index;
281}
static void uncollapse_thread(struct MailboxView *mv, int index)
Open a collapsed thread.
Definition dlg_index.c:235
bool deleted
Email is deleted.
Definition email.h:78
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_previous_undeleted()

int find_previous_undeleted ( struct MailboxView * mv,
int msgno,
bool uncollapse )

Find the previous undeleted email.

Parameters
mvMailbox View
msgnoMessage number to start at
uncollapseOpen collapsed threads
Return values
>=0Message number of next undeleted email
-1No more undeleted messages

Definition at line 291 of file dlg_index.c.

292{
293 if (!mv || !mv->mailbox)
294 return -1;
295
296 struct Mailbox *m = mv->mailbox;
297
298 int index = -1;
299 for (int i = msgno - 1; i >= 0; i--)
300 {
301 struct Email *e = mutt_get_virt_email(m, i);
302 if (!e)
303 continue;
304 if (!e->deleted)
305 {
306 index = i;
307 break;
308 }
309 }
310
311 if (uncollapse)
313
314 return index;
315}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_first_message()

int find_first_message ( struct MailboxView * mv)

Get index of first new message.

Parameters
mvMailbox view
Return values
numIndex of first new message

Return the index of the first new message, or failing that, the first unread message.

Definition at line 325 of file dlg_index.c.

326{
327 if (!mv)
328 return 0;
329
330 struct Mailbox *m = mv->mailbox;
331 if (!m || (m->msg_count == 0))
332 return 0;
333
334 int old = -1;
335 for (int i = 0; i < m->vcount; i++)
336 {
337 struct Email *e = mutt_get_virt_email(m, i);
338 if (!e)
339 continue;
340 if (!e->read && !e->deleted)
341 {
342 if (!e->old)
343 return i;
344 if (old == -1)
345 old = i;
346 }
347 }
348 if (old != -1)
349 return old;
350
351 /* If `$use_threads` is not threaded and `$sort` is reverse, the latest
352 * message is first. Otherwise, the latest message is first if exactly
353 * one of `$use_threads` and `$sort` are reverse.
354 */
355 enum EmailSortType c_sort = cs_subset_sort(m->sub, "sort");
356 if ((c_sort & SORT_MASK) == EMAIL_SORT_THREADS)
357 c_sort = cs_subset_sort(m->sub, "sort_aux");
358 bool reverse = false;
359 switch (mutt_thread_style())
360 {
361 case UT_FLAT:
362 reverse = c_sort & SORT_REVERSE;
363 break;
364 case UT_THREADS:
365 reverse = c_sort & SORT_REVERSE;
366 break;
367 case UT_REVERSE:
368 reverse = !(c_sort & SORT_REVERSE);
369 break;
370 default:
371 ASSERT(false);
372 }
373
374 if (reverse || (m->vcount == 0))
375 return 0;
376
377 return m->vcount - 1;
378}
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition helpers.c:266
#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
EmailSortType
Methods for sorting Emails.
Definition sort.h:53
@ EMAIL_SORT_THREADS
Sort by email threads.
Definition sort.h:62
enum UseThreads mutt_thread_style(void)
Which threading style is active?
Definition thread.c:79
@ UT_FLAT
Unthreaded.
Definition thread.h:98
@ UT_THREADS
Normal threading (root above subthreads)
Definition thread.h:99
@ UT_REVERSE
Reverse threading (subthreads above root)
Definition thread.h:100
#define ASSERT(COND)
Definition signal2.h:59
bool read
Email is read.
Definition email.h:50
bool old
Email is seen, but unread.
Definition email.h:49
struct ConfigSubset * sub
Inherited config items.
Definition mailbox.h:82
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resort_index()

void resort_index ( struct MailboxView * mv,
struct Menu * menu )

Resort the index.

Parameters
mvMailbox View
menuCurrent Menu

Definition at line 385 of file dlg_index.c.

386{
387 if (!mv || !mv->mailbox || !menu)
388 return;
389
390 struct Mailbox *m = mv->mailbox;
391 const int old_index = menu_get_index(menu);
392 struct Email *e_cur = mutt_get_virt_email(m, old_index);
393
394 int new_index = -1;
395 mutt_sort_headers(mv, false);
396
397 /* Restore the current message */
398 for (int i = 0; i < m->vcount; i++)
399 {
400 struct Email *e = mutt_get_virt_email(m, i);
401 if (!e)
402 continue;
403 if (e == e_cur)
404 {
405 new_index = i;
406 break;
407 }
408 }
409
410 if (mutt_using_threads() && (old_index < 0))
411 new_index = mutt_parent_message(e_cur, false);
412
413 if (old_index < 0)
414 new_index = find_first_message(mv);
415
416 menu->max = m->vcount;
417 menu_set_index(menu, new_index);
419}
int find_first_message(struct MailboxView *mv)
Get index of first new message.
Definition dlg_index.c:325
void mutt_sort_headers(struct MailboxView *mv, bool init)
Sort emails by their headers.
Definition sort.c:354
int mutt_parent_message(struct Email *e, bool find_root)
Find the parent of a message.
Definition thread.c:1433
#define mutt_using_threads()
Definition thread.h:113
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_index_threaded()

static void update_index_threaded ( struct MailboxView * mv,
enum MxStatus check,
int oldcount )
static

Update the index (if threaded)

Parameters
mvMailbox
checkFlags, e.g. MX_STATUS_REOPENED
oldcountHow many items are currently in the index

Definition at line 427 of file dlg_index.c.

428{
429 struct Email **save_new = NULL;
430 const bool lmt = mview_has_limit(mv);
431
432 struct Mailbox *m = mv->mailbox;
433 int num_new = MAX(0, m->msg_count - oldcount);
434
435 const bool c_uncollapse_new = cs_subset_bool(m->sub, "uncollapse_new");
436 /* save the list of new messages */
437 if ((check != MX_STATUS_REOPENED) && (oldcount > 0) &&
438 (lmt || c_uncollapse_new) && (num_new > 0))
439 {
440 save_new = MUTT_MEM_MALLOC(num_new, struct Email *);
441 for (int i = oldcount; i < m->msg_count; i++)
442 save_new[i - oldcount] = m->emails[i];
443 }
444
445 /* Sort first to thread the new messages, because some patterns
446 * require the threading information.
447 *
448 * If the mailbox was reopened, need to rethread from scratch. */
450
451 if (lmt)
452 {
453 for (int i = 0; i < m->msg_count; i++)
454 {
455 struct Email *e = m->emails[i];
456 if (!e)
457 continue;
458
459 if ((e->limit_visited && e->visible) ||
461 MUTT_MATCH_FULL_ADDRESS, m, e, NULL))
462 {
463 /* vnum will get properly set by mutt_set_vnum(), which
464 * is called by mutt_sort_headers() just below. */
465 e->vnum = 1;
466 e->visible = true;
467 }
468 else
469 {
470 e->vnum = -1;
471 e->visible = false;
472 }
473
474 // mark email as visited so we don't re-apply the pattern next time
475 e->limit_visited = true;
476 }
477 /* Need a second sort to set virtual numbers and redraw the tree */
478 mutt_sort_headers(mv, false);
479 }
480
481 /* uncollapse threads with new mail */
482 if (c_uncollapse_new)
483 {
484 if (check == MX_STATUS_REOPENED)
485 {
486 mv->collapsed = false;
488 mutt_set_vnum(m);
489 }
490 else if (oldcount > 0)
491 {
492 for (int j = 0; j < num_new; j++)
493 {
494 if (save_new[j]->visible)
495 {
496 mutt_uncollapse_thread(save_new[j]);
497 }
498 }
499 mutt_set_vnum(m);
500 }
501 }
502
503 FREE(&save_new);
504}
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition helpers.c:47
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define MUTT_MEM_MALLOC(n, type)
Definition memory.h:53
#define MAX(a, b)
Return the maximum of two values.
Definition memory.h:38
bool mview_has_limit(const struct MailboxView *mv)
Is a limit active?
Definition mview.c:436
@ MX_STATUS_REOPENED
Mailbox was reopened.
Definition mxapi.h:64
bool mutt_pattern_exec(struct Pattern *pat, PatternExecFlags flags, struct Mailbox *m, struct Email *e, struct PatternCache *cache)
Match a pattern against an email header.
Definition exec.c:1151
#define MUTT_MATCH_FULL_ADDRESS
Match the full address.
Definition lib.h:107
#define SLIST_FIRST(head)
Definition queue.h:227
bool visible
Is this message part of the view?
Definition email.h:121
bool limit_visited
Has the limit pattern been applied to this message?
Definition email.h:122
struct PatternList * limit_pattern
Compiled limit pattern.
Definition mview.h:43
struct Email ** emails
Array of Emails.
Definition mailbox.h:95
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_index_unthreaded()

static void update_index_unthreaded ( struct MailboxView * mv,
enum MxStatus check )
static

Update the index (if unthreaded)

Parameters
mvMailbox
checkFlags, e.g. MX_STATUS_REOPENED

Definition at line 511 of file dlg_index.c.

512{
513 /* We are in a limited view. Check if the new message(s) satisfy
514 * the limit criteria. If they do, set their virtual msgno so that
515 * they will be visible in the limited view */
516 if (mview_has_limit(mv))
517 {
518 int padding = mx_msg_padding_size(mv->mailbox);
519 mv->mailbox->vcount = mv->vsize = 0;
520 for (int i = 0; i < mv->mailbox->msg_count; i++)
521 {
522 struct Email *e = mv->mailbox->emails[i];
523 if (!e)
524 break;
525
526 if ((e->limit_visited && e->visible) ||
528 MUTT_MATCH_FULL_ADDRESS, mv->mailbox, e, NULL))
529 {
531 e->vnum = mv->mailbox->vcount;
532 mv->mailbox->v2r[mv->mailbox->vcount] = i;
533 e->visible = true;
534 mv->mailbox->vcount++;
535 struct Body *b = e->body;
536 mv->vsize += b->length + b->offset - b->hdr_offset + padding;
537 }
538 else
539 {
540 e->visible = false;
541 }
542
543 // mark email as visited so we don't re-apply the pattern next time
544 e->limit_visited = true;
545 }
546 }
547
548 /* if the mailbox was reopened, need to rethread from scratch */
550}
int mx_msg_padding_size(struct Mailbox *m)
Bytes of padding between messages - Wrapper for MxOps::msg_padding_size()
Definition mx.c:1507
The body of an email.
Definition body.h:36
LOFF_T offset
offset where the actual data begins
Definition body.h:52
LOFF_T length
length (in bytes) of attachment
Definition body.h:53
long hdr_offset
Offset in stream where the headers begin.
Definition body.h:81
struct Body * body
List of MIME parts.
Definition email.h:69
off_t vsize
Size (in bytes) of the messages shown.
Definition mview.h:41
int * v2r
Mapping from virtual to real msgno.
Definition mailbox.h:97
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ update_index()

void update_index ( struct Menu * menu,
struct MailboxView * mv,
enum MxStatus check,
int oldcount,
const struct IndexSharedData * shared )

Update the index.

Parameters
menuCurrent Menu
mvMailbox
checkFlags, e.g. MX_STATUS_REOPENED
oldcountHow many items are currently in the index
sharedShared Index data

Definition at line 560 of file dlg_index.c.

562{
563 if (!menu || !mv)
564 return;
565
566 struct Mailbox *m = mv->mailbox;
567 if (mutt_using_threads())
568 update_index_threaded(mv, check, oldcount);
569 else
570 update_index_unthreaded(mv, check);
571
572 menu->max = m->vcount;
573 const int old_index = menu_get_index(menu);
574 int index = -1;
575 if (oldcount)
576 {
577 /* restore the current message to the message it was pointing to */
578 for (int i = 0; i < m->vcount; i++)
579 {
580 struct Email *e = mutt_get_virt_email(m, i);
581 if (!e)
582 continue;
583 if (index_shared_data_is_cur_email(shared, e))
584 {
585 index = i;
586 break;
587 }
588 }
589 }
590
591 if (index < 0)
592 {
593 index = (old_index < m->vcount) ? old_index : find_first_message(mv);
594 }
595 menu_set_index(menu, index);
596}
static void update_index_threaded(struct MailboxView *mv, enum MxStatus check, int oldcount)
Update the index (if threaded)
Definition dlg_index.c:427
static void update_index_unthreaded(struct MailboxView *mv, enum MxStatus check)
Update the index (if unthreaded)
Definition dlg_index.c:511
bool index_shared_data_is_cur_email(const struct IndexSharedData *shared, const struct Email *e)
Check whether an email is the currently selected Email.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_folder_mailbox()

void change_folder_mailbox ( struct Menu * menu,
struct Mailbox * m,
int * oldcount,
struct IndexSharedData * shared,
bool read_only )

Change to a different Mailbox by pointer.

Parameters
menuCurrent Menu
mMailbox
oldcountHow many items are currently in the index
sharedShared Index data
read_onlyOpen Mailbox in read-only mode

Definition at line 629 of file dlg_index.c.

631{
632 if (!m)
633 return;
634
635 /* keepalive failure in mutt_enter_fname may kill connection. */
636 if (shared->mailbox && (buf_is_empty(&shared->mailbox->pathbuf)))
637 {
638 mview_free(&shared->mailbox_view);
639 mailbox_free(&shared->mailbox);
640 }
641
642 if (shared->mailbox)
643 {
644 char *new_last_folder = NULL;
645#ifdef USE_INOTIFY
646 int monitor_remove_rc = mutt_monitor_remove(NULL);
647#endif
648 if (shared->mailbox->compress_info && (shared->mailbox->realpath[0] != '\0'))
649 new_last_folder = mutt_str_dup(shared->mailbox->realpath);
650 else
651 new_last_folder = mutt_str_dup(mailbox_path(shared->mailbox));
652 *oldcount = shared->mailbox->msg_count;
653
654 const enum MxStatus check = mx_mbox_close(shared->mailbox);
655 if (check == MX_STATUS_OK)
656 {
657 mview_free(&shared->mailbox_view);
658 if (shared->mailbox != m)
659 {
660 mailbox_free(&shared->mailbox);
661 }
662 }
663 else
664 {
665#ifdef USE_INOTIFY
666 if (monitor_remove_rc == 0)
667 mutt_monitor_add(NULL);
668#endif
669 if ((check == MX_STATUS_NEW_MAIL) || (check == MX_STATUS_REOPENED))
670 update_index(menu, shared->mailbox_view, check, *oldcount, shared);
671
672 FREE(&new_last_folder);
675 return;
676 }
678 LastFolder = new_last_folder;
679 }
681
682 /* If the `folder-hook` were to call `unmailboxes`, then the Mailbox (`m`)
683 * could be deleted, leaving `m` dangling. */
684 // TODO: Refactor this function to avoid the need for an observer
686 char *dup_path = mutt_str_dup(mailbox_path(m));
687 char *dup_name = mutt_str_dup(m->name);
688
689 exec_folder_hook(dup_path, dup_name);
690 if (m)
691 {
692 /* `m` is still valid, but we won't need the observer again before the end
693 * of the function. */
695 }
696 else
697 {
698 // Recreate the Mailbox as the folder-hook might have invoked `mailboxes`
699 // and/or `unmailboxes`.
700 m = mx_path_resolve(dup_path);
701 }
702
703 FREE(&dup_path);
704 FREE(&dup_name);
705
706 if (!m)
707 return;
708
709 const OpenMailboxFlags flags = read_only ? MUTT_READONLY : MUTT_OPEN_NO_FLAGS;
710 if (mx_mbox_open(m, flags))
711 {
712 struct MailboxView *mv = mview_new(m, NeoMutt->notify);
713 index_shared_data_set_mview(shared, mv);
714
715 menu->max = m->msg_count;
717#ifdef USE_INOTIFY
718 mutt_monitor_add(NULL);
719#endif
720 }
721 else
722 {
723 index_shared_data_set_mview(shared, NULL);
725 }
726
727 const bool c_collapse_all = cs_subset_bool(shared->sub, "collapse_all");
728 if (mutt_using_threads() && c_collapse_all)
730
732 /* force the mailbox check after we have changed the folder */
733 struct EventMailbox ev_m = { shared->mailbox };
737}
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
void mutt_pattern_free(struct PatternList **pat)
Free a Pattern.
Definition compile.c:826
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
Definition mailbox.c:90
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
Definition mailbox.h:213
void update_index(struct Menu *menu, struct MailboxView *mv, enum MxStatus check, int oldcount, const struct IndexSharedData *shared)
Update the index.
Definition dlg_index.c:560
void collapse_all(struct MailboxView *mv, struct Menu *menu, enum CollapseMode mode)
Collapse/uncollapse all threads.
Definition dlg_index.c:159
char * LastFolder
Previously selected mailbox.
Definition globals.c:39
char * CurrentFolder
Currently selected mailbox.
Definition globals.c:38
static int index_mailbox_observer(struct NotifyCallback *nc)
Notification that a Mailbox has changed - Implements observer_t -.
Definition dlg_index.c:603
void exec_folder_hook(const char *path, const char *desc)
Perform a folder hook.
Definition exec.c:64
void index_shared_data_set_mview(struct IndexSharedData *shared, struct MailboxView *mv)
Set the MailboxView for the Index and friends.
#define MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:60
int mutt_monitor_add(struct Mailbox *m)
Add a watch for a mailbox.
Definition monitor.c:484
int mutt_monitor_remove(struct Mailbox *m)
Remove a watch for a mailbox.
Definition monitor.c:528
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition notify.c:230
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition notify.c:191
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition string.c:257
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Definition string.c:284
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
int mutt_mailbox_check(struct Mailbox *m_cur, CheckStatsFlags flags)
Check all all Mailboxes for new mail.
void mview_free(struct MailboxView **ptr)
Free a MailboxView.
Definition mview.c:47
struct MailboxView * mview_new(struct Mailbox *m, struct Notify *parent)
Create a new MailboxView.
Definition mview.c:88
bool mx_mbox_open(struct Mailbox *m, OpenMailboxFlags flags)
Open a mailbox and parse it.
Definition mx.c:285
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
Definition mx.c:1647
enum MxStatus mx_mbox_close(struct Mailbox *m)
Save changes and close mailbox.
Definition mx.c:595
#define MUTT_READONLY
Open in read-only mode.
Definition mxapi.h:42
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
Definition mxapi.h:38
#define MUTT_OPEN_NO_FLAGS
No flags are set.
Definition mxapi.h:39
#define MUTT_MAILBOX_CHECK_POSTPONED
Make sure the number of postponed messages is updated.
Definition mxapi.h:50
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
Definition mxapi.h:59
@ MX_STATUS_OK
No changes.
Definition mxapi.h:61
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
Definition mxapi.h:62
@ NT_MAILBOX
Mailbox has changed, NotifyMailbox, EventMailbox.
Definition notify_type.h:49
An Event that happened to a Mailbox.
Definition mailbox.h:189
struct Mailbox * mailbox
The Mailbox this Event relates to.
Definition mailbox.h:190
struct Mailbox * mailbox
Current Mailbox.
Definition shared_data.h:41
struct ConfigSubset * sub
Config set to use.
Definition shared_data.h:38
struct MailboxView * mailbox_view
Current Mailbox view.
Definition shared_data.h:40
struct SearchState * search_state
State of the current search.
Definition shared_data.h:45
View of a Mailbox.
Definition mview.h:40
struct Menu * menu
Needed for pattern compilation.
Definition mview.h:47
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
Definition mailbox.h:80
char * name
A short name for the Mailbox.
Definition mailbox.h:81
struct Notify * notify
Notifications: NotifyMailbox, EventMailbox.
Definition mailbox.h:144
struct Buffer pathbuf
Path of the Mailbox.
Definition mailbox.h:79
void * compress_info
Compressed mbox module private data.
Definition mailbox.h:120
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
struct PatternList * pattern
compiled search pattern
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_folder_notmuch()

struct Mailbox * change_folder_notmuch ( struct Menu * menu,
char * buf,
int buflen,
int * oldcount,
struct IndexSharedData * shared,
bool read_only )

Change to a different Notmuch Mailbox by string.

Parameters
menuCurrent Menu
bufFolder to change to
buflenLength of buffer
oldcountHow many items are currently in the index
sharedShared Index data
read_onlyOpen Mailbox in read-only mode
Return values
ptrMailbox

Definition at line 750 of file dlg_index.c.

752{
753 if (!nm_url_from_query(NULL, buf, buflen))
754 {
755 mutt_message(_("Failed to create query, aborting"));
756 return NULL;
757 }
758
759 struct Mailbox *m_query = mx_path_resolve(buf);
760 change_folder_mailbox(menu, m_query, oldcount, shared, read_only);
761 if (!shared->mailbox_view)
762 mailbox_free(&m_query);
763 return m_query;
764}
void change_folder_mailbox(struct Menu *menu, struct Mailbox *m, int *oldcount, struct IndexSharedData *shared, bool read_only)
Change to a different Mailbox by pointer.
Definition dlg_index.c:629
#define mutt_message(...)
Definition logging2.h:93
char * nm_url_from_query(struct Mailbox *m, char *buf, size_t buflen)
Turn a query into a URL.
Definition notmuch.c:1615
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ change_folder_string()

void change_folder_string ( struct Menu * menu,
struct Buffer * buf,
int * oldcount,
struct IndexSharedData * shared,
bool read_only )

Change to a different Mailbox by string.

Parameters
menuCurrent Menu
bufFolder to change to
oldcountHow many items are currently in the index
sharedShared Index data
read_onlyOpen Mailbox in read-only mode

Definition at line 775 of file dlg_index.c.

777{
778 if (OptNews)
779 {
780 OptNews = false;
781 nntp_expand_path(buf->data, buf->dsize, &CurrentNewsSrv->conn->account);
782 }
783 else
784 {
785 const char *const c_folder = cs_subset_string(shared->sub, "folder");
786 mx_path_canon(buf, c_folder, NULL);
787 }
788
789 enum MailboxType type = mx_path_probe(buf_string(buf));
790 if ((type == MUTT_MAILBOX_ERROR) || (type == MUTT_UNKNOWN))
791 {
792 // Look for a Mailbox by its description, before failing
793 struct Mailbox *m = mailbox_find_name(buf_string(buf));
794 if (m)
795 {
796 change_folder_mailbox(menu, m, oldcount, shared, read_only);
797 }
798 else
799 {
800 mutt_error(_("%s is not a mailbox"), buf_string(buf));
801 }
802 return;
803 }
804
805 struct Mailbox *m = mx_path_resolve(buf_string(buf));
806 change_folder_mailbox(menu, m, oldcount, shared, read_only);
807}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
struct Mailbox * mailbox_find_name(const char *name)
Find the mailbox with a given name.
Definition mailbox.c:187
MailboxType
Supported mailbox formats.
Definition mailbox.h:40
@ MUTT_MAILBOX_ERROR
Error occurred examining Mailbox.
Definition mailbox.h:42
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
Definition mailbox.h:43
bool OptNews
(pseudo) used to change reader mode
Definition globals.c:53
int mx_path_canon(struct Buffer *path, const char *folder, enum MailboxType *type)
Canonicalise a mailbox path - Wrapper for MxOps::path_canon()
Definition mx.c:1369
enum MailboxType mx_path_probe(const char *path)
Find a mailbox that understands a path.
Definition mx.c:1323
void nntp_expand_path(char *buf, size_t buflen, struct ConnAccount *acct)
Make fully qualified url from newsgroup name.
Definition newsrc.c:555
struct NntpAccountData * CurrentNewsSrv
Current NNTP news server.
Definition nntp.c:74
size_t dsize
Length of data.
Definition buffer.h:39
char * data
Pointer to data.
Definition buffer.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_make_string()

int mutt_make_string ( struct Buffer * buf,
size_t max_cols,
const struct Expando * exp,
struct Mailbox * m,
int inpgr,
struct Email * e,
MuttFormatFlags flags,
const char * progress )

Create formatted strings using mailbox expandos.

Parameters
bufBuffer for the result
max_colsNumber of screen columns (-1 means unlimited)
expExpando containing expando tree
mMailbox
inpgrMessage shown in the pager
eEmail
flagsFlags, see MuttFormatFlags
progressPager progress string
Return values
numNumber of screen columns used

Definition at line 821 of file dlg_index.c.

824{
825 if (!exp)
826 return 0;
827
828 struct EmailFormatInfo efi = { 0 };
829
830 efi.email = e;
831 efi.mailbox = m;
832 efi.msg_in_pager = inpgr;
833 efi.pager_progress = progress;
834
835 return expando_filter(exp, IndexRenderCallbacks, &efi, flags, max_cols,
836 NeoMutt->env, buf);
837}
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, char **env_list, struct Buffer *buf)
Render an Expando and run the result through a filter.
Definition filter.c:139
const struct ExpandoRenderCallback IndexRenderCallbacks[]
Callbacks for Index Expandos.
Data passed to index_format_str()
Definition private.h:37
struct Email * email
Current Email.
Definition private.h:40
struct Mailbox * mailbox
Current Mailbox.
Definition private.h:38
int msg_in_pager
Index of Email displayed in the Pager.
Definition private.h:39
const char * pager_progress
String representing Pager position through Email.
Definition private.h:41
char ** env
Private copy of the environment variables.
Definition neomutt.h:58
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_draw_statusline()

void mutt_draw_statusline ( struct MuttWindow * win,
int max_cols,
const char * buf,
size_t buflen )

Draw a highlighted status bar.

Parameters
winWindow
max_colsMaximum number of screen columns
bufMessage to be displayed
buflenLength of the buffer

Users configure the highlighting of the status bar, e.g. color status red default "[0-9][0-9]:[0-9][0-9]"

Where regexes overlap, the one nearest the start will be used. If two regexes start at the same place, the longer match will be used.

Colours of the status bar

< Colour attribute

< First character of that colour

< Last character of that colour

Definition at line 977 of file dlg_index.c.

978{
979 if (!buf || !stdscr)
980 return;
981
982 size_t i = 0;
983 size_t offset = 0;
984 bool found = false;
985 size_t chunks = 0;
986 size_t len = 0;
987
991 struct StatusSyntax
992 {
993 const struct AttrColor *attr_color;
994 int first;
995 int last;
996 } *syntax = NULL;
997
1000 do
1001 {
1002 struct RegexColor *cl = NULL;
1003 found = false;
1004
1005 if (!buf[offset])
1006 break;
1007
1008 /* loop through each "color status regex" */
1010 {
1011 regmatch_t pmatch[cl->match + 1];
1012 memset(pmatch, 0, (cl->match + 1) * sizeof(regmatch_t));
1013
1014 if (regexec(&cl->regex, buf + offset, cl->match + 1, pmatch, 0) != 0)
1015 continue; /* regex doesn't match the status bar */
1016
1017 int first = pmatch[cl->match].rm_so + offset;
1018 int last = pmatch[cl->match].rm_eo + offset;
1019
1020 if (first == last)
1021 continue; /* ignore an empty regex */
1022
1023 if (!found)
1024 {
1025 chunks++;
1026 MUTT_MEM_REALLOC(&syntax, chunks, struct StatusSyntax);
1027 }
1028
1029 i = chunks - 1;
1030 if (!found || (first < syntax[i].first) ||
1031 ((first == syntax[i].first) && (last > syntax[i].last)))
1032 {
1033 const struct AttrColor *ac_merge = merged_color_overlay(ac_base, &cl->attr_color);
1034
1035 syntax[i].attr_color = ac_merge;
1036 syntax[i].first = first;
1037 syntax[i].last = last;
1038 }
1039 found = true;
1040 }
1041
1042 if (syntax)
1043 {
1044 offset = syntax[i].last;
1045 }
1046 } while (found);
1047
1048 /* Only 'len' bytes will fit into 'max_cols' screen columns */
1049 len = mutt_wstr_trunc(buf, buflen, max_cols, NULL);
1050
1051 offset = 0;
1052
1053 if ((chunks > 0) && (syntax[0].first > 0))
1054 {
1055 /* Text before the first highlight */
1056 mutt_window_addnstr(win, buf, MIN(len, syntax[0].first));
1057 mutt_curses_set_color(ac_base);
1058 if (len <= syntax[0].first)
1059 goto dsl_finish; /* no more room */
1060
1061 offset = syntax[0].first;
1062 }
1063
1064 for (i = 0; i < chunks; i++)
1065 {
1066 /* Highlighted text */
1067 mutt_curses_set_color(syntax[i].attr_color);
1068 mutt_window_addnstr(win, buf + offset, MIN(len, syntax[i].last) - offset);
1069 if (len <= syntax[i].last)
1070 goto dsl_finish; /* no more room */
1071
1072 size_t next;
1073 if ((i + 1) == chunks)
1074 {
1075 next = len;
1076 }
1077 else
1078 {
1079 next = MIN(len, syntax[i + 1].first);
1080 }
1081
1082 mutt_curses_set_color(ac_base);
1083 offset = syntax[i].last;
1084 mutt_window_addnstr(win, buf + offset, next - offset);
1085
1086 offset = next;
1087 if (offset >= len)
1088 goto dsl_finish; /* no more room */
1089 }
1090
1091 mutt_curses_set_color(ac_base);
1092 if (offset < len)
1093 {
1094 /* Text after the last highlight */
1095 mutt_window_addnstr(win, buf + offset, len - offset);
1096 }
1097
1098 int width = mutt_strwidth(buf);
1099 if (width < max_cols)
1100 {
1101 /* Pad the rest of the line with whitespace */
1102 mutt_paddstr(win, max_cols - width, "");
1103 }
1104dsl_finish:
1105 FREE(&syntax);
1106}
struct RegexColorList * regex_colors_get_list(enum ColorId cid)
Return the RegexColorList for a Colour ID.
Definition regex.c:205
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
Definition simple.c:95
@ MT_COLOR_STATUS
Status bar (takes a pattern)
Definition color.h:78
@ MT_COLOR_NORMAL
Plain text.
Definition color.h:53
size_t mutt_wstr_trunc(const char *src, size_t maxlen, size_t maxwid, size_t *width)
Work out how to truncate a widechar string.
Definition curs_lib.c:384
void mutt_paddstr(struct MuttWindow *win, int n, const char *s)
Display a string on screen, padded if necessary.
Definition curs_lib.c:342
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Definition curs_lib.c:444
#define MIN(a, b)
Return the minimum of two values.
Definition memory.h:40
#define MUTT_MEM_REALLOC(pptr, n, type)
Definition memory.h:55
const struct AttrColor * merged_color_overlay(const struct AttrColor *base, const struct AttrColor *over)
Combine two colours.
Definition merged.c:107
void mutt_curses_set_color(const struct AttrColor *ac)
Set the colour and attributes for text.
Definition mutt_curses.c:38
int mutt_window_addnstr(struct MuttWindow *win, const char *str, int num)
Write a partial string to a Window.
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
A curses colour and its attributes.
Definition attr.h:65
A regular expression and a color to highlight a line.
Definition regex4.h:35
regex_t regex
Compiled regex.
Definition regex4.h:38
struct AttrColor attr_color
Colour and attributes to apply.
Definition regex4.h:36
int match
Substring to match, 0 for old behaviour.
Definition regex4.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ email_set_color()

void email_set_color ( struct Mailbox * m,
struct Email * e )

Select an Index colour for an Email.

Parameters
mMailbox
eCurrent Email

Calculate the colour for an Email in the Index. Cache the colour in the Email.

Definition at line 1425 of file dlg_index.c.

1426{
1427 if (!e)
1428 return;
1429
1430 struct RegexColor *color = NULL;
1431 struct PatternCache cache = { 0 };
1432
1433 const struct AttrColor *ac_merge = NULL;
1435 {
1437 MUTT_MATCH_FULL_ADDRESS, m, e, &cache))
1438 {
1439 ac_merge = merged_color_overlay(ac_merge, &color->attr_color);
1440 }
1441 }
1442
1443 struct AttrColor *ac_normal = simple_color_get(MT_COLOR_NORMAL);
1444 if (ac_merge)
1445 ac_merge = merged_color_overlay(ac_normal, ac_merge);
1446 else
1447 ac_merge = ac_normal;
1448
1449 e->attr_color = ac_merge;
1450}
@ MT_COLOR_INDEX
Index: default colour.
Definition color.h:86
const struct AttrColor * attr_color
Color-pair to use when displaying in the index.
Definition email.h:112
Cache commonly-used patterns.
Definition lib.h:118
struct PatternList * color_pattern
Compiled pattern to speed up index color calculation.
Definition regex4.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_pager_init()

struct MuttWindow * index_pager_init ( void )

Allocate the Windows for the Index/Pager.

Return values
ptrDialog containing nested Windows

Definition at line 1456 of file dlg_index.c.

1457{
1461
1462 struct IndexSharedData *shared = index_shared_data_new();
1463 notify_set_parent(shared->notify, dlg->notify);
1464
1465 dlg->wdata = shared;
1467
1468 const bool c_status_on_top = cs_subset_bool(NeoMutt->sub, "status_on_top");
1469
1470 struct MuttWindow *panel_index = ipanel_new(c_status_on_top, shared);
1471 struct MuttWindow *panel_pager = ppanel_new(c_status_on_top, shared);
1472
1473 mutt_window_add_child(dlg, panel_index);
1474 mutt_window_add_child(dlg, panel_pager);
1475
1476 return dlg;
1477}
void index_shared_data_free(struct MuttWindow *win, void **ptr)
Free Shared Index Data - Implements MuttWindow::wdata_free() -.
struct IndexSharedData * index_shared_data_new(void)
Create new Index Data.
struct MuttWindow * ipanel_new(bool status_on_top, struct IndexSharedData *shared)
Create the Windows for the Index panel.
Definition ipanel.c:121
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void mutt_window_add_child(struct MuttWindow *parent, struct MuttWindow *child)
Add a child to Window.
struct MuttWindow * mutt_window_new(enum WindowType type, enum MuttWindowOrientation orient, enum MuttWindowSize size, int cols, int rows)
Create a new Window.
@ WT_DLG_INDEX
Index Dialog, dlg_index()
Definition mutt_window.h:86
@ MUTT_WIN_ORIENT_HORIZONTAL
Window uses all available horizontal space.
Definition mutt_window.h:39
#define MUTT_WIN_SIZE_UNLIMITED
Use as much space as possible.
Definition mutt_window.h:52
@ MUTT_WIN_SIZE_MAXIMISE
Window wants as much space as possible.
Definition mutt_window.h:48
struct MuttWindow * ppanel_new(bool status_on_top, struct IndexSharedData *shared)
Create the Windows for the Pager panel.
Definition ppanel.c:133
Data shared between Index, Pager and Sidebar.
Definition shared_data.h:37
struct Notify * notify
Notifications: NotifyIndex, IndexSharedData.
Definition shared_data.h:44
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
void(* wdata_free)(struct MuttWindow *win, void **ptr)
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index_change_folder()

void index_change_folder ( struct MuttWindow * dlg,
struct Mailbox * m )

Change the current folder, cautiously.

Parameters
dlgDialog holding the Index
mMailbox to change to

Definition at line 1484 of file dlg_index.c.

1485{
1486 if (!dlg || !m)
1487 return;
1488
1489 struct IndexSharedData *shared = dlg->wdata;
1490 if (!shared)
1491 return;
1492
1493 struct MuttWindow *panel_index = window_find_child(dlg, WT_INDEX);
1494 if (!panel_index)
1495 return;
1496
1497 struct IndexPrivateData *priv = panel_index->wdata;
1498 if (!priv)
1499 return;
1500
1501 change_folder_mailbox(priv->menu, m, &priv->oldcount, shared, false);
1502}
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
@ WT_INDEX
A panel containing the Index Window.
Definition mutt_window.h:96
Private state data for the Index.
struct IndexSharedData * shared
Shared Index data.
struct Menu * menu
Menu controlling the index.
int oldcount
Old count of mails in the mailbox.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ IndexHelp

const struct Mapping IndexHelp[]
static
Initial value:
= {
{ N_("Quit"), OP_QUIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
{ N_("Save"), OP_SAVE },
{ N_("Mail"), OP_MAIL },
{ N_("Reply"), OP_REPLY },
{ N_("Group"), OP_GROUP_REPLY },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}
#define N_(a)
Definition message.h:32

Help Bar for the Index dialog.

Definition at line 99 of file dlg_index.c.

99 {
100 // clang-format off
101 { N_("Quit"), OP_QUIT },
102 { N_("Del"), OP_DELETE },
103 { N_("Undel"), OP_UNDELETE },
104 { N_("Save"), OP_SAVE },
105 { N_("Mail"), OP_MAIL },
106 { N_("Reply"), OP_REPLY },
107 { N_("Group"), OP_GROUP_REPLY },
108 { N_("Help"), OP_HELP },
109 { NULL, 0 },
110 // clang-format on
111};

◆ IndexNewsHelp

const struct Mapping IndexNewsHelp[]
Initial value:
= {
{ N_("Quit"), OP_QUIT },
{ N_("Del"), OP_DELETE },
{ N_("Undel"), OP_UNDELETE },
{ N_("Save"), OP_SAVE },
{ N_("Post"), OP_POST },
{ N_("Followup"), OP_FOLLOWUP },
{ N_("Catchup"), OP_CATCHUP },
{ N_("Help"), OP_HELP },
{ NULL, 0 },
}

Help Bar for the News Index dialog.

Definition at line 114 of file dlg_index.c.

114 {
115 // clang-format off
116 { N_("Quit"), OP_QUIT },
117 { N_("Del"), OP_DELETE },
118 { N_("Undel"), OP_UNDELETE },
119 { N_("Save"), OP_SAVE },
120 { N_("Post"), OP_POST },
121 { N_("Followup"), OP_FOLLOWUP },
122 { N_("Catchup"), OP_CATCHUP },
123 { N_("Help"), OP_HELP },
124 { NULL, 0 },
125 // clang-format on
126};