X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=muttlib.c;h=00d0e90baa60c6310af989396eb841e95d9b587b;hp=c8339efc6396ba6efb172bab97bfda01ec34e0aa;hb=108f3c7ab59844591f7540347914ea57be5245e2;hpb=ecfcc6df70230ba136c2fb3843700ecb749c41b7 diff --git a/muttlib.c b/muttlib.c index c8339ef..00d0e90 100644 --- a/muttlib.c +++ b/muttlib.c @@ -12,12 +12,26 @@ # include "config.h" #endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include #include #include #include +#include +#include #include @@ -26,7 +40,6 @@ #include "mutt.h" #include "mx.h" -#include "url.h" #include "attach.h" #include "version.h" @@ -36,20 +49,6 @@ #include -#include "lib/debug.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #define SW (option(OPTMBOXPANE)?SidebarWidth:0) BODY *mutt_new_body (void) @@ -177,7 +176,7 @@ void mutt_free_body (BODY ** p) a = a->next; if (b->parameter) - parameter_delete(&b->parameter); + parameter_list_wipe(&b->parameter); if (b->unlink && b->filename) { debug_print (1, ("unlinking %s.\n", b->filename)); unlink (b->filename); @@ -217,7 +216,7 @@ HEADER *mutt_dup_header (HEADER * h) } /* returns true if the header contained in "s" is in list "t" */ -int mutt_matches_ignore (const char *s, LIST * t) +int mutt_matches_ignore (const char *s, string_list_t * t) { for (; t; t = t->next) { if (!ascii_strncasecmp (s, t->data, m_strlen(t->data)) @@ -323,7 +322,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) HEADER *h; address_t *alias; - if ((alias = mutt_lookup_alias (s + 1))) { + if ((alias = alias_lookup(Aliases, s + 1))) { h = header_new(); h->env = envelope_new(); h->env->from = h->env->to = alias; @@ -388,7 +387,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) } if (rx && *p && !recurse) { - mutt_rx_sanitize_string (q, sizeof (q), p); + rx_sanitize_string (q, sizeof (q), p); snprintf (tmp, sizeof (tmp), "%s%s", q, tail); } else @@ -401,51 +400,6 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) return (s); } -/* Extract the real name from /etc/passwd's GECOS field. - * When set, honor the regular expression in GecosMask, - * otherwise assume that the GECOS field is a - * comma-separated list. - * Replace "&" by a capitalized version of the user's login - * name. - */ - -char *mutt_gecos_name (char *dest, ssize_t destlen, struct passwd *pw) -{ - regmatch_t pat_match[1]; - ssize_t pwnl; - int idx; - char *p; - - if (!pw || !pw->pw_gecos) - return NULL; - - p_clear(dest, destlen); - - if (GecosMask.rx) { - if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0) - m_strcpy(dest, MIN(pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen), - pw->pw_gecos + pat_match[0].rm_so); - } - else if ((p = strchr (pw->pw_gecos, ','))) - m_strcpy(dest, MIN(destlen, p - pw->pw_gecos + 1), pw->pw_gecos); - else - m_strcpy(dest, destlen, pw->pw_gecos); - - pwnl = m_strlen(pw->pw_name); - - for (idx = 0; dest[idx]; idx++) { - if (dest[idx] == '&') { - memmove (&dest[idx + pwnl], &dest[idx + 1], - MAX (destlen - idx - pwnl - 1, 0)); - memcpy (&dest[idx], pw->pw_name, MIN (destlen - idx - 1, pwnl)); - dest[idx] = toupper ((unsigned char) dest[idx]); - } - } - - return dest; -} - - char *mutt_get_parameter (const char *s, PARAMETER * p) { for (; p; p = p->next) @@ -487,7 +441,7 @@ void mutt_delete_parameter (const char *attribute, PARAMETER ** p) if (ascii_strcasecmp (attribute, q->attribute) == 0) { *p = q->next; q->next = NULL; - parameter_delete(&q); + parameter_list_wipe(&q); return; } } @@ -580,7 +534,7 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra) /* spam and user headers should never be hashed, and the new envelope may * have better values. Use new versions regardless. */ mutt_buffer_free (&base->spam); - mutt_free_list (&base->userhdrs); + string_list_wipe(&base->userhdrs); MOVE_ELEM(spam); MOVE_ELEM(userhdrs); #undef MOVE_ELEM @@ -598,19 +552,6 @@ void _mutt_mktemp (char *s, const char *src, int line) unlink (s); } -void mutt_free_alias (ALIAS ** p) -{ - ALIAS *t; - - while (*p) { - t = *p; - *p = (*p)->next; - p_delete(&t->name); - address_delete (&t->addr); - p_delete(&t); - } -} - /* collapse the pathname using ~ or = when possible */ void mutt_pretty_mailbox (char *s) { @@ -1237,7 +1178,7 @@ void mutt_free_spam_list (SPAM_LIST ** list) while (*list) { p = *list; *list = (*list)->next; - rx_free (&p->rx); + rx_delete(&p->rx); p_delete(&p->template); p_delete(&p); } @@ -1331,7 +1272,7 @@ int mutt_cmp_addr (const address_t * a, const address_t * b) return (1); } -int mutt_cmp_list (const LIST * a, const LIST * b) +int mutt_cmp_list (const string_list_t * a, const string_list_t * b) { while (a && b) { if (m_strcmp(a->data, b->data))