WHERE struct Hash *TagFormats;
#endif
-WHERE struct List *AutoViewList;
+WHERE struct STailQHead AutoViewList INITVAL(STAILQ_HEAD_INITIALIZER(AutoViewList));
WHERE struct List *AlternativeOrderList;
WHERE struct List *AttachAllow;
WHERE struct List *AttachExclude;
else
{
/* determine if this type is on the user's auto_view list */
- struct List *t = AutoViewList;
-
mutt_check_lookup_list(b, type, sizeof(type));
- for (; t; t = t->next)
+ struct STailQNode *np;
+ STAILQ_FOREACH(np, &AutoViewList, entries)
{
- int i = mutt_strlen(t->data) - 1;
- if ((i > 0 && t->data[i - 1] == '/' && t->data[i] == '*' &&
- (mutt_strncasecmp(type, t->data, i) == 0)) ||
- (mutt_strcasecmp(type, t->data) == 0))
+ int i = mutt_strlen(np->data) - 1;
+ if ((i > 0 && np->data[i - 1] == '/' && np->data[i] == '*' &&
+ (mutt_strncasecmp(type, np->data, i) == 0)) ||
+ (mutt_strcasecmp(type, np->data) == 0))
+ {
is_av = 1;
+ break;
+ }
}
if (is_mmnoask(type))
}
}
+static void add_to_stailq(struct STailQHead *head, const char *str)
+{
+ /* don't add a NULL or empty string to the list */
+ if (!str || *str == '\0')
+ return;
+
+ /* check to make sure the item is not already on this list */
+ struct STailQNode *np;
+ STAILQ_FOREACH(np, head, entries)
+ {
+ if (mutt_strcasecmp(str, np->data) == 0)
+ {
+ return;
+ }
+ }
+ np = safe_calloc(1, sizeof(struct STailQNode));
+ np->data = safe_strdup(str);
+ STAILQ_INSERT_TAIL(head, np, entries);
+}
+
static struct RxList *new_rx_list(void)
{
return safe_calloc(1, sizeof(struct RxList));
return 0;
}
+static int parse_stailq(struct Buffer *buf, struct Buffer *s, unsigned long data,
+ struct Buffer *err)
+{
+
+ do
+ {
+ mutt_extract_token(buf, s, 0);
+ add_to_stailq((struct STailQHead *)data, buf->data);
+ } while (MoreArgs(s));
+
+ return 0;
+}
+
+static void remove_from_stailq(struct STailQHead *head, const char *str)
+{
+ if (mutt_strcmp("*", str) == 0)
+ mutt_free_stailq(head); /* ``unCMD *'' means delete all current entries */
+ else
+ {
+ struct STailQNode *np, *tmp;
+ STAILQ_FOREACH_SAFE(np, head, entries, tmp)
+ {
+ if (mutt_strcasecmp(str, np->data) == 0)
+ {
+ STAILQ_REMOVE(head, np, STailQNode, entries);
+ FREE(&np->data);
+ FREE(&np);
+ break;
+ }
+ }
+ }
+}
+
+static int parse_unstailq(struct Buffer *buf, struct Buffer *s,
+ unsigned long data, struct Buffer *err)
+{
+ do
+ {
+ mutt_extract_token(buf, s, 0);
+ /*
+ * Check for deletion of entire list
+ */
+ if (mutt_strcmp(buf->data, "*") == 0)
+ {
+ mutt_free_stailq((struct STailQHead *)data);
+ break;
+ }
+ remove_from_stailq((struct STailQHead *)data, buf->data);
+ } while (MoreArgs(s));
+
+ return 0;
+}
+
static void _alternates_clean(void)
{
int i;
static int parse_list(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err);
+static int parse_stailq(struct Buffer *buf, struct Buffer *s, unsigned long data,
+ struct Buffer *err);
static int parse_spam_list(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err);
static int parse_unlist(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err);
+static int parse_unstailq(struct Buffer *buf, struct Buffer *s,
+ unsigned long data, struct Buffer *err);
#ifdef USE_SIDEBAR
static int parse_path_list(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err);
{ "alias", parse_alias, 0 },
{ "attachments", parse_attachments, 0 },
{ "unattachments",parse_unattachments,0 },
- { "auto_view", parse_list, UL &AutoViewList },
+ { "auto_view", parse_stailq, UL &AutoViewList },
{ "alternative_order", parse_list, UL &AlternativeOrderList },
{ "bind", mutt_parse_bind, 0 },
{ "charset-hook", mutt_parse_hook, MUTT_CHARSETHOOK },
{ "toggle", parse_set, MUTT_SET_INV },
{ "unalias", parse_unalias, 0 },
{ "unalternative_order",parse_unlist, UL &AlternativeOrderList },
- { "unauto_view", parse_unlist, UL &AutoViewList },
+ { "unauto_view", parse_unstailq, UL &AutoViewList },
{ "unhdr_order", parse_unlist, UL &HeaderOrderList },
{ "unhook", mutt_parse_unhook, 0 },
{ "unignore", parse_unignore, 0 },