+ do {
+ mutt_extract_token (buf, s, 0);
+ /*
+ * Check for deletion of entire list
+ */
+ if (m_strcmp(buf->data, "*") == 0) {
+ string_list_wipe((string_list_t **) data);
+ break;
+ }
+ remove_from_list ((string_list_t **) data, buf->data);
+ }
+ while (MoreArgs (s));
+
+ return 0;
+}
+
+static int parse_lists (BUFFER * buf, BUFFER * s,
+ unsigned long data __attribute__ ((unused)),
+ BUFFER * err)
+{
+ do {
+ mutt_extract_token (buf, s, 0);
+ remove_from_rx_list (&UnMailLists, buf->data);
+
+ if (add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0)
+ return -1;
+ }
+ while (MoreArgs (s));
+
+ return 0;
+}
+
+/* always wise to do what someone else did before */
+static void _attachments_clean (void) {
+ int i;
+ if (Context && Context->msgcount) {
+ for (i = 0; i < Context->msgcount; i++)
+ Context->hdrs[i]->attach_valid = 0;
+ }
+}
+
+static int parse_attach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
+ BUFFER *err __attribute__ ((unused))) {
+ ATTACH_MATCH *a;
+ string_list_t *listp, *lastp;
+ char *p;
+ char *tmpminor;
+ int len;
+
+ /* Find the last item in the list that data points to. */
+ lastp = NULL;
+ for (listp = *ldata; listp; listp = listp->next) {
+ a = (ATTACH_MATCH *)listp->data;
+ lastp = listp;
+ }
+
+ do {
+ mutt_extract_token (buf, s, 0);
+
+ if (!buf->data || *buf->data == '\0')
+ continue;
+
+ a = p_new(ATTACH_MATCH, 1);
+
+ /* some cheap hacks that I expect to remove */
+ if (!m_strcasecmp(buf->data, "any"))
+ a->major = m_strdup("*/.*");
+ else if (!m_strcasecmp(buf->data, "none"))
+ a->major = m_strdup("cheap_hack/this_should_never_match");
+ else
+ a->major = m_strdup(buf->data);
+
+ if ((p = strchr(a->major, '/'))) {
+ *p = '\0';
+ ++p;
+ a->minor = p;
+ } else {
+ a->minor = "unknown";
+ }
+
+ len = m_strlen(a->minor);
+ tmpminor = p_new(char, len + 3);
+ m_strcpy(&tmpminor[1], len + 3, a->minor);
+ tmpminor[0] = '^';
+ tmpminor[len+1] = '$';
+ tmpminor[len+2] = '\0';
+
+ a->major_int = mutt_check_mime_type(a->major);
+ regcomp(&a->minor_rx, tmpminor, REG_ICASE|REG_EXTENDED);
+
+ p_delete(&tmpminor);
+
+ listp = p_new(string_list_t, 1);
+ listp->data = (char *)a;
+ listp->next = NULL;
+ if (lastp) {
+ lastp->next = listp;
+ } else {
+ *ldata = listp;
+ }
+ lastp = listp;
+ }
+ while (MoreArgs (s));
+
+ _attachments_clean();
+ return 0;
+}
+
+static int parse_unattach_list (BUFFER *buf, BUFFER *s, string_list_t **ldata,
+ BUFFER *err __attribute__ ((unused))) {
+ ATTACH_MATCH *a;
+ string_list_t *lp, *lastp, *newlp;
+ char *tmp;
+ int major;
+ char *minor;