mutt stable branch with some hacks
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Updated $assumed_charset patch (closes: #2218). Thanks to TAKAHASHI Tamotsu for the fixes and for handling patch conflicts.

+126 -178
+1 -1
UPDATING
··· 4 4 The keys used are: 5 5 !: modified feature, -: deleted feature, +: new feature 6 6 7 + + $assumed_charset, $attach_charset, $ignore_linear_white_space 7 8 + $save_history, $history_file (save history across sessions) 8 - + $assumed_charset, $file_charset, $strict_mime 9 9 + $smtp_url (ESMTP relay support) 10 10 + $crypt_use_pka (use GPGME PKA signature verification) 11 11
+13 -83
charset.c
··· 282 282 return !ascii_strcasecmp (buffer, chs); 283 283 } 284 284 285 + char *mutt_get_default_charset () 286 + { 287 + static char fcharset[SHORT_STRING]; 288 + const char *c = AssumedCharset; 289 + const char *c1; 290 + 291 + if (c && *c) { 292 + c1 = strchr (c, ':'); 293 + strfcpy (fcharset, c, c1 ? (c1 - c + 1) : sizeof (fcharset)); 294 + return fcharset; 295 + } 296 + return strcpy (fcharset, "us-ascii"); /* __STRCPY_CHECKED__ */ 297 + } 285 298 286 299 #ifndef HAVE_ICONV 287 300 ··· 591 604 iconv_close (fc->cd); 592 605 FREE (_fc); /* __FREE_CHECKED__ */ 593 606 } 594 - 595 - const char *mutt_get_first_charset (const char *charset) 596 - { 597 - static char fcharset[SHORT_STRING]; 598 - const char *c, *c1; 599 - 600 - c = charset; 601 - if (!mutt_strlen(c)) 602 - return "us-ascii"; 603 - if (!(c1 = strchr (c, ':'))) 604 - return charset; 605 - strfcpy (fcharset, c, c1 - c + 1); 606 - return fcharset; 607 - } 608 - 609 - static size_t convert_string (ICONV_CONST char *f, size_t flen, 610 - const char *from, const char *to, 611 - char **t, size_t *tlen) 612 - { 613 - iconv_t cd; 614 - char *buf, *ob; 615 - size_t obl, n; 616 - int e; 617 - 618 - cd = mutt_iconv_open (to, from, 0); 619 - if (cd == (iconv_t)(-1)) 620 - return (size_t)(-1); 621 - obl = 4 * flen + 1; 622 - ob = buf = safe_malloc (obl); 623 - n = iconv (cd, &f, &flen, &ob, &obl); 624 - if (n == (size_t)(-1) || iconv (cd, 0, 0, &ob, &obl) == (size_t)(-1)) 625 - { 626 - e = errno; 627 - FREE (&buf); 628 - iconv_close (cd); 629 - errno = e; 630 - return (size_t)(-1); 631 - } 632 - *ob = '\0'; 633 - 634 - *tlen = ob - buf; 635 - 636 - safe_realloc ((void **) &buf, ob - buf + 1); 637 - *t = buf; 638 - iconv_close (cd); 639 - 640 - return n; 641 - } 642 - 643 - int mutt_convert_nonmime_string (char **ps) 644 - { 645 - const char *c, *c1; 646 - 647 - for (c = AssumedCharset; c; c = c1 ? c1 + 1 : 0) 648 - { 649 - char *u = *ps; 650 - char *s; 651 - char *fromcode; 652 - size_t m, n; 653 - size_t ulen = mutt_strlen (*ps); 654 - size_t slen; 655 - 656 - if (!u || !*u) 657 - return 0; 658 - 659 - c1 = strchr (c, ':'); 660 - n = c1 ? c1 - c : mutt_strlen (c); 661 - if (!n) 662 - continue; 663 - fromcode = safe_malloc (n + 1); 664 - strfcpy (fromcode, c, n + 1); 665 - m = convert_string (u, ulen, fromcode, Charset, &s, &slen); 666 - FREE (&fromcode); 667 - if (m != (size_t)(-1)) 668 - { 669 - FREE (ps); /* __FREE_CHECKED__ */ 670 - *ps = s; 671 - return 0; 672 - } 673 - } 674 - return -1; 675 - } 676 -
+1 -2
charset.h
··· 35 35 #endif 36 36 37 37 int mutt_convert_string (char **, const char *, const char *, int); 38 - const char *mutt_get_first_charset (const char *); 39 - int mutt_convert_nonmime_string (char **); 40 38 41 39 iconv_t mutt_iconv_open (const char *, const char *, int); 42 40 size_t mutt_iconv (iconv_t, ICONV_CONST char **, size_t *, char **, size_t *, ICONV_CONST char **, const char *); ··· 49 47 void fgetconv_close (FGETCONV **); 50 48 51 49 void mutt_set_langinfo_charset (void); 50 + char *mutt_get_default_charset (); 52 51 53 52 #define M_ICONV_HOOK_FROM 1 54 53 #define M_ICONV_HOOK_TO 2
+1 -1
globals.h
··· 36 36 WHERE char *AssumedCharset; 37 37 WHERE char *AttachSep; 38 38 WHERE char *Attribution; 39 + WHERE char *AttachCharset; 39 40 WHERE char *AttachFormat; 40 41 WHERE char *Charset; 41 42 WHERE char *ComposeFormat; ··· 48 49 WHERE char *DsnReturn; 49 50 WHERE char *Editor; 50 51 WHERE char *EscChar; 51 - WHERE char *FileCharset; 52 52 WHERE char *FolderFormat; 53 53 WHERE char *ForwFmt; 54 54 WHERE char *Fqdn;
+8 -14
handler.c
··· 1743 1743 int istext = mutt_is_text_part (b); 1744 1744 iconv_t cd = (iconv_t)(-1); 1745 1745 1746 - if (istext) 1746 + if (istext && s->flags & M_CHARCONV) 1747 1747 { 1748 - if(s->flags & M_CHARCONV) 1749 - { 1750 - char *charset = mutt_get_parameter ("charset", b->parameter); 1751 - if (!option (OPTSTRICTMIME) && !charset) 1752 - charset = mutt_get_first_charset (AssumedCharset); 1753 - if (charset && Charset) 1754 - cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM); 1755 - } 1756 - else 1757 - { 1758 - if (b->file_charset) 1759 - cd = mutt_iconv_open (Charset, b->file_charset, M_ICONV_HOOK_FROM); 1760 - } 1748 + char *charset = mutt_get_parameter ("charset", b->parameter); 1749 + if (!charset && AssumedCharset && *AssumedCharset) 1750 + charset = mutt_get_default_charset (); 1751 + if (charset && Charset) 1752 + cd = mutt_iconv_open (Charset, charset, M_ICONV_HOOK_FROM); 1761 1753 } 1754 + else if (istext && b->charset) 1755 + cd = mutt_iconv_open (Charset, b->charset, M_ICONV_HOOK_FROM); 1762 1756 1763 1757 fseeko (s->fpin, b->offset, 0); 1764 1758 switch (b->encoding)
+23 -27
init.h
··· 218 218 ** If set, Mutt will prompt you for carbon-copy (Cc) recipients before 219 219 ** editing the body of an outgoing message. 220 220 */ 221 - { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL "us-ascii"}, 221 + { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0}, 222 222 /* 223 223 ** .pp 224 224 ** This variable is a colon-separated list of character encoding ··· 233 233 ** set assumed_charset="iso-2022-jp:euc-jp:shift_jis:utf-8" 234 234 ** .pp 235 235 ** However, only the first content is valid for the message body. 236 - ** This variable is valid only if $$strict_mime is unset. 236 + */ 237 + { "attach_charset", DT_STR, R_NONE, UL &AttachCharset, UL 0 }, 238 + /* 239 + ** .pp 240 + ** This variable is a colon-separated list of character encoding 241 + ** schemes for text file attachments. 242 + ** If unset, $$charset value will be used instead. 243 + ** For example, the following configuration would work for Japanese 244 + ** text handling: 245 + ** .pp 246 + ** set attach_charset="iso-2022-jp:euc-jp:shift_jis:utf-8" 247 + ** .pp 248 + ** Note: "iso-2022-*" must be put at the head of the value as shown above 249 + ** if included. 237 250 */ 238 251 { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " }, 239 252 /* ··· 614 627 ** signed. 615 628 ** (PGP only) 616 629 */ 617 - { "file_charset", DT_STR, R_NONE, UL &FileCharset, UL 0 }, 630 + { "file_charset", DT_SYN, R_NONE, UL "attach_charset", 0 }, 618 631 /* 619 - ** .pp 620 - ** This variable is a colon-separated list of character encoding 621 - ** schemes for text file attatchments. 622 - ** If unset, $$charset value will be used instead. 623 - ** For example, the following configuration would work for Japanese 624 - ** text handling: 625 - ** .pp 626 - ** set file_charset="iso-2022-jp:euc-jp:shift_jis:utf-8" 627 - ** .pp 628 - ** Note: "iso-2022-*" must be put at the head of the value as shown above 629 - ** if included. 630 632 */ 631 633 { "folder", DT_PATH, R_NONE, UL &Maildir, UL "~/Mail" }, 632 634 /* ··· 845 847 ** Specifies the hostname to use after the ``@'' in local e-mail 846 848 ** addresses. This overrides the compile time definition obtained from 847 849 ** /etc/resolv.conf. 850 + */ 851 + { "ignore_linear_white_space", DT_BOOL, R_NONE, OPTIGNORELWS, 0 }, 852 + /* 853 + ** .pp 854 + ** This option replaces linear-white-space between encoded-word 855 + ** and *text to a single space to prevent the display of MIME-encoded 856 + ** ``Subject'' field from being divided into multiple lines. 848 857 */ 849 858 { "ignore_list_reply_to", DT_BOOL, R_NONE, OPTIGNORELISTREPLYTO, 0 }, 850 859 /* ··· 2807 2816 ** .pp 2808 2817 ** Setting this variable causes the ``status bar'' to be displayed on 2809 2818 ** the first line of the screen rather than near the bottom. 2810 - */ 2811 - { "strict_mime", DT_BOOL, R_NONE, OPTSTRICTMIME, 1 }, 2812 - /* 2813 - ** .pp 2814 - ** When unset, non MIME-compliant messages that doesn't have any 2815 - ** charset indication in ``Content-Type'' field can be displayed 2816 - ** (non MIME-compliant messages are often generated by old mailers 2817 - ** or buggy mailers like MS Outlook Express). 2818 - ** See also $$assumed_charset. 2819 - ** .pp 2820 - ** This option also replaces linear-white-space between encoded-word 2821 - ** and *text to a single space to prevent the display of MIME-encoded 2822 - ** ``Subject'' field from being devided into multiple lines. 2823 2819 */ 2824 2820 { "strict_threads", DT_BOOL, R_RESORT|R_RESORT_INIT|R_INDEX, OPTSTRICTTHREADS, 0 }, 2825 2821 /*
+2 -2
mutt.h
··· 370 370 OPTHIDETHREADSUBJECT, 371 371 OPTHIDETOPLIMITED, 372 372 OPTHIDETOPMISSING, 373 + OPTIGNORELWS, 373 374 OPTIGNORELISTREPLYTO, 374 375 #ifdef USE_IMAP 375 376 OPTIMAPCHECKSUBSCRIBED, ··· 428 429 OPTSORTRE, 429 430 OPTSPAMSEP, 430 431 OPTSTATUSONTOP, 431 - OPTSTRICTMIME, 432 432 OPTSTRICTTHREADS, 433 433 OPTSUSPEND, 434 434 OPTTEXTFLOWED, ··· 643 643 * If NULL, filename is used 644 644 * instead. 645 645 */ 646 - char *file_charset; /* charset of attached file */ 646 + char *charset; /* charset of attached file */ 647 647 CONTENT *content; /* structure used to store detailed info about 648 648 * the content of the attachment. this is used 649 649 * to determine what content-transfer-encoding
+4 -4
parse.c
··· 217 217 s++; 218 218 for (i=0; *s && i < sizeof (buffer) - 1; i++, s++) 219 219 { 220 - if (!option (OPTSTRICTMIME)) { 220 + if (AssumedCharset && *AssumedCharset) { 221 221 /* As iso-2022-* has a characer of '"' with non-ascii state, 222 222 * ignore it. */ 223 223 if (*s == 0x1b && i < sizeof (buffer) - 2) ··· 402 402 if (ct->type == TYPETEXT) 403 403 { 404 404 if (!(pc = mutt_get_parameter ("charset", ct->parameter))) 405 - mutt_set_parameter ("charset", option (OPTSTRICTMIME) ? "us-ascii" : 406 - (const char *) mutt_get_first_charset (AssumedCharset), 407 - &ct->parameter); 405 + mutt_set_parameter ("charset", (AssumedCharset && *AssumedCharset) ? 406 + (const char *) mutt_get_default_charset () 407 + : "us-ascii", &ct->parameter); 408 408 } 409 409 410 410 }
+65 -34
rfc2047.c
··· 87 87 return n; 88 88 } 89 89 90 + int convert_nonmime_string (char **ps) 91 + { 92 + const char *c, *c1; 93 + 94 + for (c = AssumedCharset; c; c = c1 ? c1 + 1 : 0) 95 + { 96 + char *u = *ps; 97 + char *s; 98 + char *fromcode; 99 + size_t m, n; 100 + size_t ulen = mutt_strlen (*ps); 101 + size_t slen; 102 + 103 + if (!u || !*u) 104 + return 0; 105 + 106 + c1 = strchr (c, ':'); 107 + n = c1 ? c1 - c : mutt_strlen (c); 108 + if (!n) 109 + return 0; 110 + fromcode = safe_malloc (n + 1); 111 + strfcpy (fromcode, c, n + 1); 112 + m = convert_string (u, ulen, fromcode, Charset, &s, &slen); 113 + FREE (&fromcode); 114 + if (m != (size_t)(-1)) 115 + { 116 + FREE (ps); /* __FREE_CHECKED__ */ 117 + *ps = s; 118 + return 0; 119 + } 120 + } 121 + mutt_convert_string (ps, 122 + (const char *)mutt_get_default_charset (AssumedCharset), 123 + Charset, M_ICONV_HOOK_FROM); 124 + return -1; 125 + } 126 + 90 127 char *mutt_choose_charset (const char *fromcode, const char *charsets, 91 128 char *u, size_t ulen, char **d, size_t *dlen) 92 129 { ··· 711 748 return 0; 712 749 } 713 750 714 - /* return length of linear white space */ 751 + /* return length of linear-white-space */ 715 752 static size_t lwslen (const char *s, size_t n) 716 753 { 717 754 const char *p = s; ··· 731 768 return len; 732 769 } 733 770 734 - /* return length of linear white space : reverse */ 771 + /* return length of linear-white-space : reverse */ 735 772 static size_t lwsrlen (const char *s, size_t n) 736 773 { 737 774 const char *p = s + n - 1; ··· 775 812 if (!(p = find_encoded_word (s, &q))) 776 813 { 777 814 /* no encoded words */ 778 - if (!option (OPTSTRICTMIME)) 815 + if (option (OPTIGNORELWS)) 779 816 { 780 817 n = mutt_strlen (s); 781 818 if (found_encoded && (m = lwslen (s, n)) != 0) 782 819 { 783 820 if (m != n) 784 821 *d = ' ', d++, dlen--; 785 - n -= m, s += m; 822 + s += m; 786 823 } 787 - if (ascii_strcasecmp (AssumedCharset, "us-ascii")) 788 - { 789 - char *t; 790 - size_t tlen; 824 + } 825 + if (AssumedCharset && *AssumedCharset) 826 + { 827 + char *t; 828 + size_t tlen; 791 829 792 - t = safe_malloc (n + 1); 793 - strfcpy (t, s, n + 1); 794 - if (mutt_convert_nonmime_string (&t) == 0) 795 - { 796 - tlen = mutt_strlen (t); 797 - strncpy (d, t, tlen); 798 - d += tlen; 799 - } 800 - else 801 - { 802 - strncpy (d, s, n); 803 - d += n; 804 - } 805 - FREE (&t); 806 - break; 807 - } 830 + n = mutt_strlen (s); 831 + t = safe_malloc (n + 1); 832 + strfcpy (t, s, n + 1); 833 + convert_nonmime_string (&t); 834 + tlen = mutt_strlen (t); 835 + strncpy (d, t, tlen); 836 + d += tlen; 837 + FREE (&t); 838 + break; 808 839 } 809 840 strncpy (d, s, dlen); 810 841 d += dlen; ··· 814 845 if (p != s) 815 846 { 816 847 n = (size_t) (p - s); 817 - /* ignore spaces between encoded words 818 - * and linear white spaces between encoded word and *text */ 819 - if (!option (OPTSTRICTMIME)) 848 + /* ignore spaces between encoded word 849 + * and linear-white-space between encoded word and *text */ 850 + if (option (OPTIGNORELWS)) 820 851 { 821 852 if (found_encoded && (m = lwslen (s, n)) != 0) 822 853 { ··· 838 869 } 839 870 else if (!found_encoded || strspn (s, " \t\r\n") != n) 840 871 { 841 - if (n > dlen) 842 - n = dlen; 843 - memcpy (d, s, n); 844 - d += n; 845 - dlen -= n; 872 + if (n > dlen) 873 + n = dlen; 874 + memcpy (d, s, n); 875 + d += n; 876 + dlen -= n; 846 877 } 847 - 848 878 } 849 879 850 880 rfc2047_decode_word (d, p, dlen); ··· 865 895 { 866 896 while (a) 867 897 { 868 - if (a->personal) 898 + if (a->personal && ((strstr (a->personal, "=?") != NULL) || 899 + (AssumedCharset && *AssumedCharset))) 869 900 rfc2047_decode (&a->personal); 870 901 #ifdef EXACT_ADDRESS 871 902 if (a->val && strstr (a->val, "=?") != NULL)
+1
rfc2047.h
··· 18 18 19 19 char *mutt_choose_charset (const char *fromcode, const char *charsets, 20 20 char *u, size_t ulen, char **d, size_t *dlen); 21 + int convert_nonmime_string (char **); 21 22 22 23 void _rfc2047_encode_string (char **, int, int); 23 24 void rfc2047_encode_adrlist (ADDRESS *, const char *);
+2 -5
rfc2231.c
··· 117 117 118 118 if (option (OPTRFC2047PARAMS) && p->value && strstr (p->value, "=?")) 119 119 rfc2047_decode (&p->value); 120 - else if (!option (OPTSTRICTMIME)) 121 - { 122 - if (ascii_strcasecmp (AssumedCharset, "us-ascii")) 123 - mutt_convert_nonmime_string (&p->value); 124 - } 120 + else if (AssumedCharset && *AssumedCharset) 121 + convert_nonmime_string (&p->value); 125 122 126 123 *last = p; 127 124 last = &p->next;
+5 -5
sendlib.c
··· 442 442 } 443 443 444 444 if (a->type == TYPETEXT && (!a->noconv)) 445 - fc = fgetconv_open (fpin, a->file_charset, 445 + fc = fgetconv_open (fpin, a->charset, 446 446 mutt_get_body_charset (send_charset, sizeof (send_charset), a), 447 447 0); 448 448 else ··· 842 842 CONTENT *info; 843 843 CONTENT_STATE state; 844 844 FILE *fp = NULL; 845 - char *fromcode = NULL; 845 + char *fromcode; 846 846 char *tocode; 847 847 char buffer[100]; 848 848 char chsbuf[STRING]; ··· 877 877 if (b != NULL && b->type == TYPETEXT && (!b->noconv && !b->force_charset)) 878 878 { 879 879 char *chs = mutt_get_parameter ("charset", b->parameter); 880 - char *fchs = b->use_disp ? ((FileCharset && *FileCharset) ? 881 - FileCharset : Charset) : Charset; 880 + char *fchs = b->use_disp ? ((AttachCharset && *AttachCharset) ? 881 + AttachCharset : Charset) : Charset; 882 882 if (Charset && (chs || SendCharset) && 883 883 convert_file_from_to (fp, fchs, chs ? chs : SendCharset, 884 884 &fromcode, &tocode, info) != (size_t)(-1)) ··· 888 888 mutt_canonical_charset (chsbuf, sizeof (chsbuf), tocode); 889 889 mutt_set_parameter ("charset", chsbuf, &b->parameter); 890 890 } 891 - b->file_charset = fromcode; 891 + b->charset = fromcode; 892 892 FREE (&tocode); 893 893 safe_fclose (&fp); 894 894 return info;