#include "sort.h"
@import "lib-lua/base.cpkg"
+static rx_t *Alternates = NULL, *UnAlternates = NULL;
+
@static_package MAlias {
/*
** .pp
** explicitly use the ``$source'' command for it to be executed.
*/
path_t alias_file = m_strdup("~/.madmutt/aliases");
+
+ void alternates(rx_t rx) {
+ rx_list_remove(&UnAlternates, rx);
+ rx_list_add(&Alternates, rx);
+ RETURN();
+ };
+
+ void unalternates(rx_t rx) {
+ rx_list_remove(&Alternates, rx);
+ rx_list_add(&UnAlternates, rx);
+ RETURN();
+ };
};
alias_t *Aliases;
}
}
-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_unlist (BUFFER * buf, BUFFER * s, unsigned long data,
BUFFER * err __attribute__ ((unused)))
{
static int parse_subscribe (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unsubscribe (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-static int parse_alternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-
struct command_t {
const char *name;
int (*func) (BUFFER *, BUFFER *, unsigned long, BUFFER *);
{"unmono", mutt_parse_unmono, 0},
{"unscore", mutt_parse_unscore, 0},
{"alias", parse_alias, 0},
- {"alternates", parse_alternates, 0},
{"attachments", parse_attachments, 0 },
{"ignore", parse_ignore, 0},
{"alternative_order", parse_list, UL &AlternativeOrderList},
{"source", parse_source, 0},
{"subscribe", parse_subscribe, 0},
{"unalias", parse_unalias, 0},
- {"unalternates", parse_unalternates, 0},
{"unattachments", parse_unattachments, 0},
{"unignore", parse_unignore, 0},
{"unlists", parse_unlists, 0},