106 if (!url_m || !url_f)
123 plen = strlen(mbox) - mlen + flen;
141 if (!mbox || !folder)
149 return mbox + prefix;
153 if (!c_sidebar_delim_chars)
159 if (strchr(c_sidebar_delim_chars, folder[flen - 1]))
170 if (!strchr(c_sidebar_delim_chars, mbox[flen]))
175 return mbox + flen + 1;
181 if (strchr(c_sidebar_delim_chars, mbox[mlen]))
183 return mbox + mlen + 1;
207 const int scheme_len = 10;
219 const char *last = strchr(mbox + scheme_len, split);
236 for (
int i = 0; i < sbe->
depth; i++)
238 res +=
mutt_str_copy(buf + res, c_sidebar_indent_string, buflen - res);
285 if (current || highlight)
313static int calc_path_depth(
const char *mbox,
const char *delims,
const char **last_part)
315 if (!mbox || !delims || !last_part)
319 const char *match = NULL;
320 while ((match = strpbrk(mbox, delims)))
379 char tmp[256] = { 0 };
381 const size_t ilen =
sizeof(tmp);
382 const size_t off =
add_indent(tmp, ilen, sbe);
383 snprintf(tmp + off, ilen - off,
"%s", sbe->
box);
413 char tmp[256] = { 0 };
415 const size_t ilen =
sizeof(tmp);
416 const size_t off =
add_indent(tmp, ilen, sbe);
420 snprintf(tmp + off, ilen - off,
"%s", sbe->
mailbox->
name);
424 snprintf(tmp + off, ilen - off,
"%s", sbe->
box);
481 const char *s = m->
has_new ?
"N" :
" ";
601 width =
MIN(buflen, width);
605 memset(buf + s,
' ', width - w);
606 buf[s + width - w] =
'\0';
639 int i = ARRAY_FOREACH_IDX;
664 if (c_sidebar_non_empty_mailbox_only && (i != wdata->
opn_index) &&
670 if (c_sidebar_new_mail_only && (i != wdata->
opn_index) &&
702 const struct SbEntry *opn_entry = sbep ? *sbep : NULL;
704 const struct SbEntry *hil_entry = sbep ? *sbep : NULL;
710 if (opn_entry || hil_entry)
714 if ((opn_entry == *sbep) && (*sbep)->mailbox->visible)
716 if ((hil_entry == *sbep) && (*sbep)->mailbox->visible)
741 if (c_sidebar_new_mail_only || c_sidebar_non_empty_mailbox_only)
748 int page_entries = 0;
749 while (page_entries < page_size)
819 if ((*sbep)->is_hidden)
822 struct SbEntry *entry = (*sbep);
825 const int entryidx = ARRAY_FOREACH_IDX;
829 if (m_cur && (m_cur->
realpath[0] !=
'\0') &&
844 const char *short_path = abbr ? abbr : path;
847 const char *last_part = abbr;
851 const bool short_path_is_abbr = (short_path == abbr);
853 if (c_sidebar_short_path)
855 short_path = last_part;
861 if (c_sidebar_folder_indent && short_path_is_abbr)
864 if (c_sidebar_component_depth > 0)
865 entry->
depth -= c_sidebar_component_depth;
867 else if (!c_sidebar_folder_indent)
899 int num_rows,
int num_cols)
901 if ((num_rows < 1) || (num_cols < 1) || (wdata->
divider_width > num_cols) ||
916 const int col = c_sidebar_on_right ? 0 : (num_cols - width);
918 for (
int i = 0; i < num_rows; i++)
943 int num_rows,
int div_width,
int num_cols)
951 if (!c_sidebar_on_right)
953 for (
int r = 0; r < num_rows; r++)
958 for (
int i = 0; i < num_cols; i++)
975 if (
wdata->top_index >= 0)
978 if (c_sidebar_on_right)
979 col =
wdata->divider_width;
987 if ((*sbep)->is_hidden)
990 struct SbEntry *entry = (*sbep);
1029 { -1, -1, NULL, NULL },
#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.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
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.
@ ED_SIDEBAR
Sidebar ED_SID_ ExpandoDataSidebar.
Structs that make up an email.
int expando_filter(const struct Expando *exp, const struct ExpandoRenderData *rdata, void *data, MuttFormatFlags flags, int max_cols, struct Buffer *buf)
Render an Expando and run the result through a filter.
long sidebar_S_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: number of messages - Implements ExpandoRenderData::get_number() -.
long sidebar_F_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of flagged messages - Implements ExpandoRenderData::get_number() -.
long sidebar_N_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of unread messages - Implements ExpandoRenderData::get_number() -.
long sidebar_a_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Alert for new mail - Implements ExpandoRenderData::get_number() -.
long sidebar_L_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of limited messages - Implements ExpandoRenderData::get_number() -.
long sidebar_t_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of tagged messages - Implements ExpandoRenderData::get_number() -.
long sidebar_Z_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of new messages - Implements ExpandoRenderData::get_number() -.
long sidebar_r_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of read messages - Implements ExpandoRenderData::get_number() -.
long sidebar_o_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of old messages - Implements ExpandoRenderData::get_number() -.
long sidebar_p_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Poll for new mail - Implements ExpandoRenderData::get_number() -.
long sidebar_n_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: New mail flag - Implements ExpandoRenderData::get_number() -.
long sidebar_d_num(const struct ExpandoNode *node, void *data, MuttFormatFlags flags)
Sidebar: Number of deleted messages - Implements ExpandoRenderData::get_number() -.
void sidebar_D(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Sidebar: Descriptive name - Implements ExpandoRenderData::get_string() -.
void sidebar_bang(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Sidebar: Flagged flags - Implements ExpandoRenderData::get_string() -.
void sidebar_B(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Sidebar: Name of the mailbox - Implements ExpandoRenderData::get_string() -.
void sidebar_n(const struct ExpandoNode *node, void *data, MuttFormatFlags flags, struct Buffer *buf)
Sidebar: New mail flag - Implements ExpandoRenderData::get_string() -.
#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.
uint8_t MuttFormatFlags
Flags for expando_render(), e.g. MUTT_FORMAT_FORCESUBJ.
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.
int vcount
The number of virtual messages.
bool has_new
Mailbox has new mail.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
int msg_new
Number of new messages.
int msg_count
Total number of messages.
enum MailboxType type
Mailbox type.
bool poll_new_mail
Check for new mail.
char * name
A short name for the Mailbox.
bool notify_user
Notify the user of new mail.
int msg_deleted
Number of deleted messages.
bool visible
True if a result of "mailboxes".
int msg_flagged
Number of flagged messages.
int msg_tagged
How many messages are tagged?
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.