113 plen = strlen(mbox) - mlen + flen;
131 if (!mbox || !folder)
139 return mbox + prefix;
143 if (!c_sidebar_delim_chars)
149 if (strchr(c_sidebar_delim_chars, folder[flen - 1]))
160 if (!strchr(c_sidebar_delim_chars, mbox[flen]))
165 return mbox + flen + 1;
171 if (strchr(c_sidebar_delim_chars, mbox[mlen]))
173 return mbox + mlen + 1;
197 const int scheme_len = 10;
209 const char *last = strchr(mbox + scheme_len, split);
257 if (current || highlight)
285static int calc_path_depth(
const char *mbox,
const char *delims,
const char **last_part)
287 if (!mbox || !delims || !last_part)
291 const char *match = NULL;
292 while ((match = strpbrk(mbox, delims)))
330 width =
MIN(buflen, width);
334 memset(buf + s,
' ', width - w);
335 buf[s + width - w] =
'\0';
368 int i = ARRAY_FOREACH_IDX;
393 if (c_sidebar_non_empty_mailbox_only && (i != wdata->
opn_index) &&
399 if (c_sidebar_new_mail_only && (i != wdata->
opn_index) &&
431 const struct SbEntry *opn_entry = sbep ? *sbep : NULL;
433 const struct SbEntry *hil_entry = sbep ? *sbep : NULL;
439 if (opn_entry || hil_entry)
443 if ((opn_entry == *sbep) && (*sbep)->mailbox->visible)
445 if ((hil_entry == *sbep) && (*sbep)->mailbox->visible)
470 if (c_sidebar_new_mail_only || c_sidebar_non_empty_mailbox_only)
477 int page_entries = 0;
478 while (page_entries < page_size)
548 if ((*sbep)->is_hidden)
551 struct SbEntry *entry = (*sbep);
554 const int entryidx = ARRAY_FOREACH_IDX;
558 if (m_cur && (m_cur->
realpath[0] !=
'\0') &&
573 const char *short_path = abbr ? abbr : path;
576 const char *last_part = abbr;
580 const bool short_path_is_abbr = (short_path == abbr);
582 if (c_sidebar_short_path)
584 short_path = last_part;
590 if (c_sidebar_folder_indent && short_path_is_abbr)
593 if (c_sidebar_component_depth > 0)
594 entry->
depth -= c_sidebar_component_depth;
596 else if (!c_sidebar_folder_indent)
628 int num_rows,
int num_cols)
630 if ((num_rows < 1) || (num_cols < 1) || (wdata->
divider_width > num_cols) ||
645 const int col = c_sidebar_on_right ? 0 : (num_cols - width);
647 for (
int i = 0; i < num_rows; i++)
672 int num_rows,
int div_width,
int num_cols)
680 if (!c_sidebar_on_right)
682 for (
int r = 0; r < num_rows; r++)
687 for (
int i = 0; i < num_cols; i++)
704 if (
wdata->top_index >= 0)
707 if (c_sidebar_on_right)
708 col =
wdata->divider_width;
716 if ((*sbep)->is_hidden)
719 struct SbEntry *entry = (*sbep);
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_EMPTY(head)
Check if an array is empty.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_FOREACH_FROM(elem, head, from)
Iterate from an index to the end.
#define ARRAY_GET(head, idx)
Return the element at index.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Color and attribute parsing.
bool simple_color_is_set(enum ColorId cid)
Is the object coloured?
struct AttrColor * simple_color_get(enum ColorId cid)
Get the colour of an object by its ID.
@ MT_COLOR_SIDEBAR_DIVIDER
Line dividing sidebar from the index/pager.
@ MT_COLOR_SIDEBAR_NEW
Mailbox with new mail.
@ MT_COLOR_SIDEBAR_UNREAD
Mailbox with unread mail.
@ MT_COLOR_INDICATOR
Selected item in list.
@ MT_COLOR_SIDEBAR_SPOOLFILE
$spool_file (Spool mailbox)
@ MT_COLOR_SIDEBAR_ORDINARY
Mailbox with no new or flagged messages.
@ MT_COLOR_SIDEBAR_BACKGROUND
Background colour for the Sidebar.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_SIDEBAR_INDICATOR
Current open mailbox.
@ MT_COLOR_SIDEBAR_HIGHLIGHT
Select cursor.
@ MT_COLOR_SIDEBAR_FLAGGED
Mailbox with flagged messages.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
const struct Expando * cs_subset_expando(const struct ConfigSubset *sub, const char *name)
Get an Expando config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
MailboxType
Supported mailbox formats.
@ MUTT_NOTMUCH
'Notmuch' (virtual) Mailbox type
@ MUTT_POP
'POP3' Mailbox type
@ MUTT_NNTP
'NNTP' (Usenet) Mailbox type
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
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.
void mutt_refresh(void)
Force a refresh of the screen.
size_t mutt_strwidth(const char *s)
Measure a string's width in screen cells.
Structs that make up an email.
EmailSortType
Methods for sorting Emails.
int expando_filter(const struct Expando *exp, const struct ExpandoRenderCallback *erc, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
#define mutt_debug(LEVEL,...)
int sb_recalc(struct MuttWindow *win)
Recalculate the Sidebar display - Implements MuttWindow::recalc() -.
int sb_repaint(struct MuttWindow *win)
Repaint the Sidebar display - Implements MuttWindow::repaint() -.
Convenience wrapper for the gui headers.
GUI manage the main index (list of emails)
struct ListNode * mutt_list_find(const struct ListHead *h, const char *data)
Find a string in a List.
@ LL_DEBUG5
Log at debug level 5.
const struct AttrColor * merged_color_overlay(const struct AttrColor *base, const struct AttrColor *over)
Combine two colours.
Convenience wrapper for the library headers.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
const struct AttrColor * mutt_curses_set_color_by_id(enum ColorId cid)
Set the colour and attributes by the colour id.
void mutt_curses_set_color(const struct AttrColor *ac)
Set the colour and attributes for text.
int mutt_window_printf(struct MuttWindow *win, const char *fmt,...)
Write a formatted string to a Window.
int mutt_window_move(struct MuttWindow *win, int col, int row)
Move the cursor in a Window.
int mutt_window_addstr(struct MuttWindow *win, const char *str)
Write a string to a Window.
int mutt_window_addch(struct MuttWindow *win, int ch)
Write one character to a Window.
#define WA_REPAINT
Redraw the contents of the Window.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FOREACH(var, head, field)
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
A curses colour and its attributes.
String manipulation buffer.
Data shared between Index, Pager and Sidebar.
struct Mailbox * mailbox
Current Mailbox.
struct Mailbox * mailbox
Mailbox in the list.
bool has_new
Mailbox has new mail.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int msg_count
Total number of messages.
enum MailboxType type
Mailbox type.
char * name
A short name for the Mailbox.
bool visible
True if a result of "mailboxes".
int msg_flagged
Number of flagged messages.
int msg_unread
Number of unread messages.
struct WindowState state
Current state of the Window.
void * wdata
Private data.
WindowActionFlags actions
Actions to be performed, e.g. WA_RECALC.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Info about folders in the sidebar.
const struct AttrColor * color
Colour to use.
int depth
Indentation depth.
char display[256]
Formatted string to display.
struct Mailbox * mailbox
Mailbox this represents.
bool is_hidden
Don't show, e.g. $sidebar_new_mail_only.
char box[256]
Mailbox path (possibly abbreviated)
A parsed URL proto://user:password@host:port/path?a=1&b=2
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
short rows
Number of rows, can be MUTT_WIN_SIZE_UNLIMITED.
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.