Commit 6ee24526 authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Fix (un)sidebar_whitelist to expand paths.

Thanks to Arturo for reporting the issue.
parent 3e9315dc
......@@ -941,6 +941,46 @@ static int parse_unlist (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err
return 0;
}
static int parse_path_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
char path[_POSIX_PATH_MAX];
do
{
mutt_extract_token (buf, s, 0);
strfcpy (path, buf->data, sizeof (path));
mutt_expand_path (path, sizeof (path));
add_to_list ((LIST **) data, path);
}
while (MoreArgs (s));
return 0;
}
static int parse_path_unlist (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
char path[_POSIX_PATH_MAX];
do
{
mutt_extract_token (buf, s, 0);
/*
* Check for deletion of entire list
*/
if (mutt_strcmp (buf->data, "*") == 0)
{
mutt_free_list ((LIST **) data);
break;
}
strfcpy (path, buf->data, sizeof (path));
mutt_expand_path (path, sizeof (path));
remove_from_list ((LIST **) data, path);
}
while (MoreArgs (s));
return 0;
}
static int parse_lists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err)
{
group_context_t *gc = NULL;
......
......@@ -3880,6 +3880,8 @@ const struct mapping_t SortSidebarMethods[] = {
static int parse_list (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_spam_list (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unlist (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_path_list (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_path_unlist (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_group (BUFFER *, BUFFER *, unsigned long, BUFFER *);
......@@ -3975,8 +3977,8 @@ const struct command_t Commands[] = {
{ "set", parse_set, 0 },
{ "setenv", parse_setenv, 0 },
#ifdef USE_SIDEBAR
{ "sidebar_whitelist",parse_list, UL &SidebarWhitelist },
{ "unsidebar_whitelist",parse_unlist, UL &SidebarWhitelist },
{ "sidebar_whitelist",parse_path_list, UL &SidebarWhitelist },
{ "unsidebar_whitelist",parse_path_unlist, UL &SidebarWhitelist },
#endif
{ "source", parse_source, 0 },
{ "spam", parse_spam_list, MUTT_SPAM },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment