X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-ui%2Fhdrline.c;h=92e6fa628254cb96a8c0c900b56563f248668430;hp=25ccce13ed5a1ba2111f6cc8585e9c72db720bc6;hb=7d29626ce4e1fa932c6349c7253e6f774df069fc;hpb=1ee89902de184a640c171ae3285bff6882a791bd diff --git a/lib-ui/hdrline.c b/lib-ui/hdrline.c index 25ccce1..92e6fa6 100644 --- a/lib-ui/hdrline.c +++ b/lib-ui/hdrline.c @@ -10,8 +10,8 @@ #include #include - #include +#include #include "mutt.h" #include "alias.h" @@ -210,19 +210,16 @@ struct hdr_format_info { HEADER *hdr; }; -static const char *hdr_format_str (char *dest, - ssize_t destlen, - char op, - const char *src, - const char *prefix, - const char *ifstring, - const char *elsestring, - unsigned long data, format_flag flags) +static const char * +hdr_format_str(char *dest, ssize_t destlen, + char op, const char *src, const char *prefix, + const char *ifstr, const char *elstr, + anytype data, format_flag flags) { - struct hdr_format_info *hfi = (struct hdr_format_info *) data; + struct hdr_format_info *hfi = data.ptr; HEADER *hdr, *htmp; CONTEXT *ctx; - char fmt[SHORT_STRING], buf2[SHORT_STRING], ch, *p; + char fmt[STRING], buf2[STRING], ch, *p; int do_locales, i; int optional = (flags & M_FORMAT_OPTIONAL); int threads = ((Sort & SORT_MASK) == SORT_THREADS); @@ -395,7 +392,7 @@ static const char *hdr_format_str (char *dest, case 'f': buf2[0] = 0; - rfc822_write_address (buf2, sizeof (buf2), hdr->env->from, 1); + rfc822_addrcat(buf2, sizeof (buf2), hdr->env->from, 1); mutt_format_s (dest, destlen, prefix, buf2); break; @@ -438,7 +435,7 @@ static const char *hdr_format_str (char *dest, int j = 0; for (i = 0; hdr->env->from && hdr->env->from->personal && - hdr->env->from->personal[i] && j < SHORT_STRING - 1; i++) { + hdr->env->from->personal[i] && j < STRING - 1; i++) { if (isalpha ((int) hdr->env->from->personal[i])) { if (!iflag) { buf2[j++] = hdr->env->from->personal[i]; @@ -628,12 +625,6 @@ static const char *hdr_format_str (char *dest, { int count = 0; - if (option (OPTCOUNTATTACH)) { - if (!hdr->content->parts) - mutt_parse_mime_message(ctx, hdr); - count = mutt_count_body_parts(hdr, 0); - } - /* The recursion allows messages without depth to return 0. */ if (optional) optional = count != 0; @@ -708,18 +699,15 @@ static const char *hdr_format_str (char *dest, break; default: - snprintf (dest, destlen, "%%%s%c", prefix, op); + *dest = 0; break; } - if (optional) - mutt_FormatString (dest, destlen, ifstring, hdr_format_str, - (unsigned long) hfi, flags); - else if (flags & M_FORMAT_OPTIONAL) - mutt_FormatString (dest, destlen, elsestring, hdr_format_str, - (unsigned long) hfi, flags); + if (flags & M_FORMAT_OPTIONAL) + m_strformat(dest, destlen, 0, optional ? ifstr: elstr, + hdr_format_str, data, flags); - return (src); + return src; #undef THREAD_NEW #undef THREAD_OLD } @@ -733,6 +721,5 @@ _mutt_make_string (char *dest, ssize_t destlen, const char *s, CONTEXT * ctx, hfi.hdr = hdr; hfi.ctx = ctx; - mutt_FormatString (dest, destlen, s, hdr_format_str, (unsigned long) &hfi, - flags); + m_strformat(dest, destlen, COLS - SW, s, hdr_format_str, &hfi, flags); }