-static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
- BUFFER * err)
-{
- int i, j;
- unsigned long res = 0;
- BUFFER token;
- struct option_t* option = NULL;
-
- p_clear(&token, 1);
- mutt_extract_token (tmp, s, 0);
-
- /* is the item defined as a variable or a function? */
- if ((option = hash_find (ConfigOptions, tmp->data)) != NULL)
- res = 1;
- else {
- for (i = 0; !res && i < MENU_MAX; i++) {
- struct binding_t *b = km_get_table (Menus[i].value);
-
- if (!b)
- continue;
-
- for (j = 0; b[j].name; j++)
- if (!ascii_strncasecmp (tmp->data, b[j].name, m_strlen(tmp->data))
- && (m_strlen(b[j].name) == m_strlen(tmp->data))) {
- res = 1;
- break;
- }
- }
- }
- /* check for feature_* */
- if (!res && ascii_strncasecmp (tmp->data, "feature_", 8) == 0 &&
- (j = m_strlen(tmp->data)) > 8) {
- i = 0;
- while (Features[i]) {
- if (m_strlen(Features[i]) == j-8 &&
- ascii_strncasecmp (Features[i], tmp->data+8, j-8) == 0) {
- res = 1;
- break;
- }
- i++;
- }
- }
-
- if (!MoreArgs (s)) {
- if (data)
- snprintf (err->data, err->dsize, _("ifdef: too few arguments"));
- else
- snprintf (err->data, err->dsize, _("ifndef: too few arguments"));
- return (-1);
- }
-
- mutt_extract_token (tmp, s, M_TOKEN_SPACE);
-
- if (data == res) {
- if (mutt_parse_rc_line (tmp->data, &token, err) == -1) {
- mutt_error ("Error: %s", err->data);
- p_delete(&token.data);
- return (-1);
- }
- p_delete(&token.data);
- }
- return 0;
-}
-
-static int parse_unignore (BUFFER * buf, BUFFER * s,
- unsigned long data __attribute__ ((unused)),
- BUFFER * err __attribute__ ((unused)))
-{
- do {
- mutt_extract_token (buf, s, 0);
-
- /* don't add "*" to the unignore list */
- if (strcmp (buf->data, "*"))
- add_to_list (&UnIgnore, buf->data);
-
- remove_from_list (&Ignore, buf->data);
- }
- while (MoreArgs (s));
-
- return 0;
-}
-
-static int parse_ignore (BUFFER * buf, BUFFER * s,
- unsigned long data __attribute__ ((unused)),
- BUFFER * err __attribute__ ((unused)))
-{
- do {
- mutt_extract_token (buf, s, 0);
- remove_from_list (&UnIgnore, buf->data);
- add_to_list (&Ignore, buf->data);
- }
- while (MoreArgs (s));
-
- return 0;
-}
-
-static int parse_list (BUFFER * buf, BUFFER * s,
- unsigned long data __attribute__ ((unused)),
- BUFFER * err __attribute__ ((unused)))
-{
- do {
- mutt_extract_token (buf, s, 0);
- add_to_list ((string_list_t **) data, buf->data);
- }
- while (MoreArgs (s));
-
- return 0;
-}
-
-static void _alternates_clean (void)
-{
- int i;
-
- if (Context && Context->msgcount) {
- for (i = 0; i < Context->msgcount; i++)
- Context->hdrs[i]->recip_valid = 0;
- }
-}
-
-static int parse_alternates (BUFFER * buf, BUFFER * s,
- unsigned long data __attribute__ ((unused)),
- BUFFER * err __attribute__ ((unused)))
-{
- _alternates_clean ();
- do {
- mutt_extract_token (buf, s, 0);
- remove_from_rx_list (&UnAlternates, buf->data);
-
- if (add_to_rx_list (&Alternates, buf->data, REG_ICASE, err) != 0)
- return -1;
- }
- while (MoreArgs (s));
-
- return 0;
-}
-
-static int parse_unalternates (BUFFER * buf, BUFFER * s,
- unsigned long data __attribute__ ((unused)),
- BUFFER * err __attribute__ ((unused)))
-{
- _alternates_clean ();
- do {
- mutt_extract_token (buf, s, 0);
- remove_from_rx_list (&Alternates, buf->data);
-
- if (m_strcmp(buf->data, "*") &&
- add_to_rx_list (&UnAlternates, buf->data, REG_ICASE, err) != 0)
- return -1;
-
- }
- while (MoreArgs (s));
-
- return 0;
-}
-
-static int parse_spam_list (BUFFER * buf, BUFFER * s, unsigned long data,
- BUFFER * err)
-{
- BUFFER templ;
-
- p_clear(&templ, 1);
-
- /* Insist on at least one parameter */
- if (!MoreArgs (s)) {
- if (data == M_SPAM)
- m_strcpy(err->data, err->dsize, _("spam: no matching pattern"));
- else
- m_strcpy(err->data, err->dsize, _("nospam: no matching pattern"));
- return -1;
- }
-
- /* Extract the first token, a regexp */
- mutt_extract_token (buf, s, 0);
-
- /* data should be either M_SPAM or M_NOSPAM. M_SPAM is for spam commands. */
- if (data == M_SPAM) {
- /* If there's a second parameter, it's a template for the spam tag. */
- if (MoreArgs (s)) {
- mutt_extract_token (&templ, s, 0);
-
- /* Add to the spam list. */
- if (add_to_spam_list (&SpamList, buf->data, templ.data, err) != 0) {
- p_delete(&templ.data);
- return -1;
- }
- p_delete(&templ.data);
- }
-
- /* If not, try to remove from the nospam list. */
- else {
- remove_from_rx_list (&NoSpamList, buf->data);
- }
-
- return 0;
- }
-
- /* M_NOSPAM is for nospam commands. */
- else if (data == M_NOSPAM) {
- /* nospam only ever has one parameter. */
-
- /* "*" is a special case. */
- if (!m_strcmp(buf->data, "*")) {
- rx_list_wipe(&SpamList);
- rx_list_wipe(&NoSpamList);
- return 0;
- }
-
- /* If it's on the spam list, just remove it. */
- if (remove_from_spam_list (&SpamList, buf->data) != 0)
- return 0;
-
- /* Otherwise, add it to the nospam list. */
- if (add_to_rx_list (&NoSpamList, buf->data, REG_ICASE, err) != 0)
- return -1;
-
- return 0;
- }
-
- /* This should not happen. */
- m_strcpy(err->data, err->dsize, "This is no good at all.");
- return -1;
-}
-
-static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data,
- BUFFER * err __attribute__ ((unused)))