From: Pierre Habouzit Date: Sat, 31 Mar 2007 14:23:14 +0000 (+0200) Subject: last lists into Mime X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=5f299ed8b67fa06f3c96777d437c0285ff71d9ac;p=apps%2Fmadmutt.git last lists into Mime Signed-off-by: Pierre Habouzit --- diff --git a/globals.h b/globals.h index 0bc0c97..38438e2 100644 --- a/globals.h +++ b/globals.h @@ -148,9 +148,6 @@ WHERE string_list_t *AttachAllow INITVAL(0); WHERE string_list_t *AttachExclude INITVAL(0); WHERE string_list_t *InlineAllow INITVAL(0); WHERE string_list_t *InlineExclude INITVAL(0); -WHERE string_list_t *HeaderOrderList INITVAL (0); -WHERE string_list_t *Ignore INITVAL (0); -WHERE string_list_t *UnIgnore INITVAL (0); /* bit vector for boolean variables */ WHERE unsigned char Options[(OPTMAX + 7) / 8]; diff --git a/init.c b/init.c index 549ba24..061f35e 100644 --- a/init.c +++ b/init.c @@ -519,70 +519,6 @@ int query_quadoption (int opt, const char *prompt) /* not reached */ } -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 (m_strcmp(buf->data, "*")) { - string_list_add(&UnIgnore, buf->data); - string_list_remove(&Ignore, buf->data); - } else { - string_list_wipe(&Ignore); - } - } 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); - if (m_strcmp(buf->data, "*")) { - string_list_remove(&UnIgnore, buf->data); - } else { - string_list_wipe(&UnIgnore); - } - string_list_add(&Ignore, buf->data); - } while (MoreArgs(s)); - return 0; -} - -static int parse_list(BUFFER * buf, BUFFER * s, unsigned long data, - BUFFER * err __attribute__ ((unused))) -{ - do { - mutt_extract_token (buf, s, 0); - string_list_add ((string_list_t **) data, buf->data); - } while (MoreArgs(s)); - return 0; -} - -static int parse_unlist (BUFFER * buf, BUFFER * s, unsigned long data, - BUFFER * err __attribute__ ((unused))) -{ - do { - mutt_extract_token (buf, s, 0); - /* - * Check for deletion of entire list - */ - if (!m_strcmp(buf->data, "*")) { - string_list_wipe((string_list_t **) data); - break; - } - string_list_remove((string_list_t **) data, buf->data); - } - while (MoreArgs (s)); - - return 0; -} - /* always wise to do what someone else did before */ static void _attachments_clean (void) { int i; diff --git a/init.h b/init.h index 89eba35..89457d3 100644 --- a/init.h +++ b/init.h @@ -3332,8 +3332,6 @@ const struct mapping_t SortKeyMethods[] = { /* functions used to parse commands in a rc file */ -static int parse_list (BUFFER *, BUFFER *, unsigned long, BUFFER *); -static int parse_unlist (BUFFER *, BUFFER *, unsigned long, BUFFER *); static int parse_attachments (BUFFER *, BUFFER *, unsigned long, BUFFER *); static int parse_unattachments (BUFFER *, BUFFER *, unsigned long, BUFFER *); static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *); @@ -3380,8 +3378,6 @@ struct command_t Commands[] = { {"unscore", mutt_parse_unscore, 0}, {"alias", parse_alias, 0}, {"attachments", parse_attachments, 0 }, - {"ignore", parse_ignore, 0}, - {"hdr_order", parse_list, UL &HeaderOrderList}, {"my_hdr", parse_my_hdr, 0}, {"reset", parse_set, M_SET_RESET}, {"set", parse_set, 0}, @@ -3390,8 +3386,6 @@ struct command_t Commands[] = { {"source", parse_source, 0}, {"unalias", parse_unalias, 0}, {"unattachments", parse_unattachments, 0}, - {"unignore", parse_unignore, 0}, - {"unhdr_order", parse_unlist, UL &HeaderOrderList}, {"unmy_hdr", parse_unmy_hdr, 0}, {NULL, NULL, 0} }; diff --git a/lib-mime/mime.cpkg b/lib-mime/mime.cpkg index 1340ad4..c4b8d8a 100644 --- a/lib-mime/mime.cpkg +++ b/lib-mime/mime.cpkg @@ -54,6 +54,7 @@ const char *BodyEncodings[] = { rx_t *SpamList = NULL, *NoSpamList = NULL; string_list_t *AutoViewList, *AlternativeOrderList, *MimeLookupList; +string_list_t *Ignore, *UnIgnore, *HeaderOrderList; static char *mailcap_init(void) { @@ -150,6 +151,36 @@ static char *mailcap_init(void) } RETURN(); }; + + void hdr_order(string_t s) { + string_list_add(&HeaderOrderList, s); + RETURN(); + }; + void unhdr_order(string_t s) { + if (m_strcmp(s, "*")) { + string_list_remove(&HeaderOrderList, s); + } else { + string_list_wipe(&HeaderOrderList); + } + RETURN(); + }; + + void ignore(string_t s) { + if (m_strcmp(s, "*")) { + string_list_remove(&UnIgnore, s); + } else { + string_list_wipe(&UnIgnore); + } + string_list_add(&Ignore, s); + }; + void unignore(string_t s) { + if (m_strcmp(s, "*")) { + string_list_add(&UnIgnore, s); + string_list_remove(&Ignore, s); + } else { + string_list_wipe(&Ignore); + } + }; }; /****************************************************************************/ diff --git a/lib-mime/mime.h b/lib-mime/mime.h index 0bbdea8..478b2b0 100644 --- a/lib-mime/mime.h +++ b/lib-mime/mime.h @@ -40,9 +40,12 @@ extern const char *BodyTypes[]; extern const char *BodyEncodings[]; extern rx_t *SpamList, *NoSpamList; -extern string_list_t *AutoViewList; extern string_list_t *AlternativeOrderList; +extern string_list_t *AutoViewList; +extern string_list_t *HeaderOrderList; +extern string_list_t *Ignore; extern string_list_t *MimeLookupList; +extern string_list_t *UnIgnore; /* MIME encoding/decoding global vars */