*/
void mutt_check_lookup_list(struct Body *b, char *type, int len)
{
- struct List *t = MimeLookupList;
int i;
- for (; t; t = t->next)
+ struct STailQNode *np;
+ STAILQ_FOREACH(np, &MimeLookupList, entries)
{
- 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))
+ 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))
{
struct Body tmp = { 0 };
int n;
WHERE struct STailQHead InlineExclude INITVAL(STAILQ_HEAD_INITIALIZER(InlineExclude));
WHERE struct STailQHead HeaderOrderList INITVAL(STAILQ_HEAD_INITIALIZER(HeaderOrderList));
WHERE struct STailQHead Ignore INITVAL(STAILQ_HEAD_INITIALIZER(Ignore));
-WHERE struct List *MailToAllow;
-WHERE struct List *MimeLookupList;
+WHERE struct STailQHead MailToAllow INITVAL(STAILQ_HEAD_INITIALIZER(MailToAllow));
+WHERE struct STailQHead MimeLookupList INITVAL(STAILQ_HEAD_INITIALIZER(MimeLookupList));
WHERE struct STailQHead UnIgnore INITVAL(STAILQ_HEAD_INITIALIZER(UnIgnore));
WHERE struct RxList *Alternates;
#ifdef USE_SIDEBAR
WHERE short SidebarWidth;
-WHERE struct List *SidebarWhitelist;
+WHERE struct STailQHead SidebarWhitelist INITVAL(STAILQ_HEAD_INITIALIZER(SidebarWhitelist));
#endif
#ifdef USE_IMAP
mutt_free_rx_list(&NoSpamList);
}
-static void add_to_list(struct List **list, const char *str)
-{
- struct List *t = NULL, *last = NULL;
-
- /* 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 */
- for (last = *list; last; last = last->next)
- {
- if (mutt_strcasecmp(str, last->data) == 0)
- {
- /* already on the list, so just ignore it */
- last = NULL;
- break;
- }
- if (!last->next)
- break;
- }
-
- if (!*list || last)
- {
- t = safe_calloc(1, sizeof(struct List));
- t->data = safe_strdup(str);
- if (last)
- {
- last->next = t;
- last = last->next;
- }
- else
- *list = last = t;
- }
-}
-
static void add_to_stailq(struct STailQHead *head, const char *str)
{
/* don't add a NULL or empty string to the list */
return 0;
}
-static void remove_from_list(struct List **l, const char *str)
-{
- struct List *p = NULL, *last = NULL;
-
- if (mutt_strcmp("*", str) == 0)
- mutt_free_list(l); /* ``unCMD *'' means delete all current entries */
- else
- {
- p = *l;
- last = NULL;
- while (p)
- {
- if (mutt_strcasecmp(str, p->data) == 0)
- {
- FREE(&p->data);
- if (last)
- last->next = p->next;
- else
- (*l) = p->next;
- FREE(&p);
- }
- else
- {
- last = p;
- p = p->next;
- }
- }
- }
-}
-
/**
* finish_source - 'finish' command: stop processing current config file
* @param tmp Temporary space shared by all command handlers
return 0;
}
-static int parse_list(struct Buffer *buf, struct Buffer *s, unsigned long data,
- struct Buffer *err)
-{
- do
- {
- mutt_extract_token(buf, s, 0);
- add_to_list((struct List **) data, buf->data);
- } while (MoreArgs(s));
-
- return 0;
-}
-
static int parse_stailq(struct Buffer *buf, struct Buffer *s, unsigned long data,
struct Buffer *err)
{
return -1;
}
-static int parse_unlist(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_list((struct List **) data);
- break;
- }
- remove_from_list((struct List **) data, buf->data);
- } while (MoreArgs(s));
-
- return 0;
-}
-
#ifdef USE_SIDEBAR
static int parse_path_list(struct Buffer *buf, struct Buffer *s,
unsigned long data, struct Buffer *err)
mutt_extract_token(buf, s, 0);
strfcpy(path, buf->data, sizeof(path));
mutt_expand_path(path, sizeof(path));
- add_to_list((struct List **) data, path);
+ add_to_stailq((struct STailQHead *) data, path);
} while (MoreArgs(s));
return 0;
*/
if (mutt_strcmp(buf->data, "*") == 0)
{
- mutt_free_list((struct List **) data);
+ mutt_stailq_free((struct STailQHead *) data);
break;
}
strfcpy(path, buf->data, sizeof(path));
mutt_expand_path(path, sizeof(path));
- remove_from_list((struct List **) data, path);
+ remove_from_stailq((struct STailQHead *) data, path);
} while (MoreArgs(s));
return 0;
* create RFC822-compliant mail messages using the "subject" and "body"
* headers.
*/
- add_to_list(&MailToAllow, "body");
- add_to_list(&MailToAllow, "subject");
+ add_to_stailq(&MailToAllow, "body");
+ add_to_stailq(&MailToAllow, "subject");
/* Cc, In-Reply-To, and References help with not breaking threading on
* mailing lists, see https://github.com/neomutt/neomutt/issues/115 */
- add_to_list(&MailToAllow, "cc");
- add_to_list(&MailToAllow, "in-reply-to");
- add_to_list(&MailToAllow, "references");
+ add_to_stailq(&MailToAllow, "cc");
+ add_to_stailq(&MailToAllow, "in-reply-to");
+ add_to_stailq(&MailToAllow, "references");
struct STailQNode *np = NULL;
if (STAILQ_EMPTY(&Muttrc))
/* functions used to parse commands in a rc file */
-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
{ "tag-transforms", parse_tag_transforms, 0 },
{ "tag-formats", parse_tag_formats, 0 },
#endif
- { "mailto_allow", parse_list, UL &MailToAllow },
- { "unmailto_allow", parse_unlist, UL &MailToAllow },
+ { "mailto_allow", parse_stailq, UL &MailToAllow },
+ { "unmailto_allow", parse_unstailq, UL &MailToAllow },
{ "message-hook", mutt_parse_hook, MUTT_MESSAGEHOOK },
{ "mbox-hook", mutt_parse_hook, MUTT_MBOXHOOK },
- { "mime_lookup", parse_list, UL &MimeLookupList },
- { "unmime_lookup", parse_unlist, UL &MimeLookupList },
+ { "mime_lookup", parse_stailq, UL &MimeLookupList },
+ { "unmime_lookup", parse_unstailq, UL &MimeLookupList },
{ "mono", mutt_parse_mono, 0 },
{ "my_hdr", parse_my_hdr, 0 },
{ "pgp-hook", mutt_parse_hook, MUTT_CRYPTHOOK },
/* Spool directory */
continue;
- if (mutt_find_list(SidebarWhitelist, sbe->buffy->path) ||
- mutt_find_list(SidebarWhitelist, sbe->buffy->desc))
+ if (mutt_stailq_find(&SidebarWhitelist, sbe->buffy->path) ||
+ mutt_stailq_find(&SidebarWhitelist, sbe->buffy->desc))
/* Explicitly asked to be visible */
continue;
* choose to create a message with only a subset of the headers given in
* the URL.
*/
- if (mutt_matches_list(tag, MailToAllow))
+ if (mutt_stailq_match(tag, &MailToAllow))
{
if (mutt_strcasecmp(tag, "body") == 0)
{