From: Pierre Habouzit Date: Fri, 30 Mar 2007 09:45:43 +0000 (+0200) Subject: Move (un)alternates to MAlias X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=6aac4a85332ec3647c29a7b996cade972895a8b8;p=apps%2Fmadmutt.git Move (un)alternates to MAlias Signed-off-by: Pierre Habouzit --- diff --git a/alias.cpkg b/alias.cpkg index bab4a49..2651026 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -38,6 +38,8 @@ #include "sort.h" @import "lib-lua/base.cpkg" +static rx_t *Alternates = NULL, *UnAlternates = NULL; + @static_package MAlias { /* ** .pp @@ -62,6 +64,18 @@ ** 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; diff --git a/globals.h b/globals.h index b3289d7..9306abb 100644 --- a/globals.h +++ b/globals.h @@ -160,8 +160,6 @@ WHERE string_list_t *Ignore INITVAL (0); WHERE string_list_t *MimeLookupList INITVAL (0); WHERE string_list_t *UnIgnore INITVAL (0); -WHERE rx_t *Alternates INITVAL (0); -WHERE rx_t *UnAlternates INITVAL (0); WHERE rx_t *MailLists INITVAL (0); WHERE rx_t *UnMailLists INITVAL (0); WHERE rx_t *SubscribedLists INITVAL (0); diff --git a/init.c b/init.c index 9d6908b..3b57790 100644 --- a/init.c +++ b/init.c @@ -640,42 +640,6 @@ static void _alternates_clean (void) } } -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))) { diff --git a/init.h b/init.h index 92eed15..cad0fdc 100644 --- a/init.h +++ b/init.h @@ -3422,9 +3422,6 @@ static int parse_unmy_hdr (BUFFER *, BUFFER *, unsigned long, BUFFER *); 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 *); @@ -3461,7 +3458,6 @@ struct command_t Commands[] = { {"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}, @@ -3477,7 +3473,6 @@ struct command_t Commands[] = { {"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},