diff options
author | Jan Rękorajski | 2006-04-21 23:41:23 (GMT) |
---|---|---|
committer | cvs2git | 2012-06-24 12:13:13 (GMT) |
commit | d90aef01ad6a0c5df322f0a2d09a905cccec3d1f (patch) | |
tree | e92bf1fcc62d0556bc92e43f4b81adccb48c954f | |
parent | 4972086cad40e2a736700711cb634fa19e854045 (diff) | |
download | pine-d90aef01ad6a0c5df322f0a2d09a905cccec3d1f.zip pine-d90aef01ad6a0c5df322f0a2d09a905cccec3d1f.tar.gz |
- orphaned, outdated
Changed files:
pine-4.44-CAN-2003-0720-CAN-2003-0721.patch -> 1.2
pine-iconv-7e.patch -> 1.2
pine-terminit.patch -> 1.2
pine-timezone.patch -> 1.2
pine-utf_ra.patch -> 1.2
-rw-r--r-- | pine-4.44-CAN-2003-0720-CAN-2003-0721.patch | 81 | ||||
-rw-r--r-- | pine-iconv-7e.patch | 1548 | ||||
-rw-r--r-- | pine-terminit.patch | 179 | ||||
-rw-r--r-- | pine-timezone.patch | 10 | ||||
-rw-r--r-- | pine-utf_ra.patch | 24 |
5 files changed, 0 insertions, 1842 deletions
diff --git a/pine-4.44-CAN-2003-0720-CAN-2003-0721.patch b/pine-4.44-CAN-2003-0720-CAN-2003-0721.patch deleted file mode 100644 index 24bd88f..0000000 --- a/pine-4.44-CAN-2003-0720-CAN-2003-0721.patch +++ /dev/null @@ -1,81 +0,0 @@ -To fix CAN-2003-0720 CAN-2003-0721 ---- pine4.44/pine/mailview.c.orig 2002-01-08 20:56:02.000000000 +0000 -+++ pine4.44/pine/mailview.c 2003-09-10 09:36:25.000000000 +0100 -@@ -8377,7 +8377,7 @@ - - for(p = params; p; p = p->next) /* ok if we include *'s */ - if(p->attribute && (n = strlen(p->attribute)) > longest) -- longest = n; -+ longest = min(32, n); /* shouldn't be any bigger than 32 */ - - d = tmp_20k_buf; - if(parmlist = rfc2231_newparmlist(params)){ ---- pine4.44/pine/strings.c.orig 2001-10-18 20:19:04.000000000 +0100 -+++ pine4.44/pine/strings.c 2003-09-10 09:36:25.000000000 +0100 -@@ -3611,7 +3611,8 @@ - char *name, **charset, **lang; - { - char *buf, *p; -- int decode = 0, name_len, i, n; -+ int decode = 0, name_len, i; -+ unsigned n; - - name_len = strlen(name); - for(; parms ; parms = parms->next) -@@ -3632,15 +3633,19 @@ - n = 0; - do - n = (n * 10) + (*p - '0'); -- while(isdigit(*++p)); -+ while(isdigit(*++p) && n < RFC2231_MAX); - - if(n < RFC2231_MAX){ - pieces[n] = parms->value; - if(n > count) - count = n; - } -- else -+ else { -+ q_status_message1(SM_ORDER | SM_DING, 0, 3, -+ "Invalid attachment parameter segment number: %.25s", -+ name); - return(NULL); /* Too many segments! */ -+ } - - while(parms = parms->next) - if(!struncmp(name, parms->attribute, name_len)){ -@@ -3655,8 +3660,12 @@ - for(i = len = 0; i <= count; i++) - if(pieces[i]) - len += strlen(pieces[i]); -- else -+ else{ -+ q_status_message1(SM_ORDER | SM_DING, 0, 3, -+ "Missing attachment parameter sequence: %.25s", -+ name); - return(NULL); /* hole! */ -+ } - - buf = (char *) fs_get((len + 1) * sizeof(char)); - -@@ -3832,7 +3841,7 @@ - if(plist->value) - fs_give((void **) &plist->value); - -- for(pp = plist->list; pp; pp = pp->next) -+ for(pp = plist->list; pp; pp = pp->next){ - /* get a name */ - for(i = 0; i < 32; i++) - if(!(plist->attrib[i] = pp->attribute[i]) || pp->attribute[i] == '*'){ -@@ -3853,6 +3862,11 @@ - - break; - } -+ if(i >= 32) -+ q_status_message1(SM_ORDER | SM_DING, 0, 3, -+ "Overly long attachment parameter ignored: %.25s...", -+ pp->attribute); -+ } - - return(FALSE); - } diff --git a/pine-iconv-7e.patch b/pine-iconv-7e.patch deleted file mode 100644 index dbbd19b..0000000 --- a/pine-iconv-7e.patch +++ /dev/null @@ -1,1548 +0,0 @@ -diff -rNu pine4.58/doc/iconv.txt pine4.58.iconv/doc/iconv.txt ---- pine4.58/doc/iconv.txt 1970-01-01 01:00:00.000000000 +0100 -+++ pine4.58.iconv/doc/iconv.txt 2003-09-11 00:32:20.000000000 +0200 -@@ -0,0 +1,74 @@ -+ChangeLog of the iconv support: -+ -+7e - Release date: Sep 10 2003 -+------------------------------ -+ -+Updates from Bernhard Kaindl: -+ -+ Update to 4.58 and fix mislabeling the charset of message body -+ on reply with attachments included in reply -+ -+7d - Release date: Jun 7 2003 -+------------------------------ -+ -+Updates from Jungshik Shin: -+ -+ fix bounce command to not attempt to convert mail by temporarily -+ reseting SEND_CHAR_SET before calling the send function to keep -+ it from converting to send_charset -+ -+ fix the last char of the subject which was chopped off in the mail -+ index screen. -+ -+ fix list management editorial fix to apply assumed-charset to all -+ headers by changing format_editorial() to reset VAR_ASSUMED_CHAR_SET -+ before calling rfc1522_decode() -+ -+ overlong rfc2047 encoded words are now decoded -+ -+ send-charset help updated -+ -+Updates from Bernhard Kaindl: -+ -+ Remove strncpy_pad() - It's not used right now. -+ -+ minor tweaks and documentation improvements for conv_strncpy() -+ (ensure that the output string is always terminated) -+ -+ Reduce the lines of code in rfc1522_decode which are neccesary to -+ copy(and convert, if neccesary) strings which looked like encoded -+ words and remaining string parts. -+ -+7c - Release date: Jun 1 2003 -+------------------------------ -+ -+Updates from Bernhard Kaindl: -+ -+ Update to pine 4.56 which improved the charset conversion warning -+ and made it possible to merge gf_convert_iconv_opt() into convert_chartset() -+ which also allowed to omit the #ifdefs to call gf_convert_iconv_opt() if -+ iconv() is available. -+ -+ Also fixed the bug which the messed up the mailinglist management editoral -+ -+ The baseline of all changes done is that the unified diff -+ of 7c is 4k smaller then 7a. -+ -+7a - Release date: May 28 2003 -+------------------------------ -+ -+Updates from Junkshik Shin: -+ -+ Added 'send-charset' option and made necessary changes. -+ conv_sstrncpy() also has a new parameter because it's used for both -+ directions now. -+ -+ 'send-charset' option is global and I have yet to make some more changes -+ to let users change the charset of outgoing emails at the time of -+ composition. -+ -+Currently Known Bugs: -+--------------------- -+ -+- If pass-control-characters-as-is is not enabled, many Unicode characters -+ are not displayed correctly, filter functions need to be aware of UTF-8. -diff -rNu pine4.58/pine/filter.c pine4.58.iconv/pine/filter.c ---- pine4.58/pine/filter.c 2003-09-11 00:15:33.000000000 +0200 -+++ pine4.58.iconv/pine/filter.c 2003-09-11 00:16:25.000000000 +0200 -@@ -65,6 +65,9 @@ - - - #include "headers.h" -+#ifdef HAVE_ICONV -+#include <iconv.h> -+#endif - - - /* -@@ -707,6 +710,12 @@ - register unsigned char *GF_EOB_INIT(FI); \ - register unsigned char *GF_IP_INIT(FO); \ - register unsigned char *GF_EIB_INIT(FO); -+#ifdef HAVE_ICONV -+#define GF_ICINIT(I, O) unsigned char *GF_OP_INIT(I); \ -+ unsigned char *GF_EOB_INIT(I); \ -+ unsigned char *GF_IP_INIT(O); \ -+ unsigned char *GF_EIB_INIT(O); -+#endif - - #define GF_CH_RESET(F) (op = eob = GF_QUE_START(F), \ - (F)->queueout = (F)->queuein = 0) -@@ -2169,6 +2178,123 @@ - } - } - -+#ifdef HAVE_ICONV -+/* -+ * This filter converts the input buffer in the MIME charset of -+ * a message, for example) to another (the user's display charset) -+ * using iconv(3), POSIX/Single Unix Standard API. -+ */ -+void -+gf_convert_charset(f, flg) -+ FILTER_S *f; -+ int flg; -+{ -+ static iconv_t iconv_desc; -+ static int einval_inbytesleft; -+ GF_ICINIT(f, f->next); -+ -+ switch (flg) { -+ case GF_DATA: { -+ size_t conv, inbytesleft = eob - op, outbytesleft = eib - ip; -+ /* If einval_inbytesleft is set our iconv() encountered an incomplete -+ * multibyte sequence and we asked for more input. In case the number -+ * of chars left to convert did not change, we should be at the end -+ * of input and then we would have an incomplete multibyte sequence -+ * at the end of input. The only thing we could do is to tell the -+ * user and abort to prevent endlessly trying to convert the incomplete -+ * input. -+ */ -+ if (inbytesleft == einval_inbytesleft) { -+ char *einval_error = "[invalid multibyte seq at end of input]"; -+ dprint(2,(debugfile, "inval multibyte seq at end of input\n")); -+ for (;*einval_error;einval_error++) -+ GF_PUTC(f->next, *einval_error); -+ GF_FLUSH(f->next); -+ /* We need to throw the remaing invalid sequence away: */ -+ op = eob; -+ GF_CH_RESET(f); -+ break; -+ } -+ while (1) { -+ if (!outbytesleft || !inbytesleft) { -+ dprint(2,(debugfile, "gf_convert_iconv:flushing output:%d, %d\n", -+ inbytesleft, outbytesleft)); -+ GF_FLUSH(f->next); -+ outbytesleft = eib - ip; -+ } -+ if (!inbytesleft) { -+ dprint(2,(debugfile, "gf_convert_iconv:need input, outleft=%d\n", -+ outbytesleft)); -+ GF_CH_RESET(f); -+ break; -+ } -+ einval_inbytesleft = -1; -+ conv = iconv(iconv_desc, (char **)&op, &inbytesleft, -+ (char **)&ip, &outbytesleft); -+ if (conv != (size_t) (-1)) { /* iconv succeeded */ -+ dprint(2,(debugfile, "irres. conv. count: %d, il: %d, ol: %d\n", -+ conv, inbytesleft, outbytesleft)); -+ /* iconv failed. check errno */ -+ } else if (errno == E2BIG){ -+ dprint(2,(debugfile, "e2big: outbytesleft=%d\n", outbytesleft)); -+ outbytesleft = 0; -+ } else if (errno == EILSEQ){ -+ char hexout[3]; -+ dprint(2,(debugfile, "eilseq: ill.octet=0x%02x, il=%d, ol=%d\n", -+ *op, inbytesleft, outbytesleft)); -+ sprintf(hexout, "%2x", *op++); -+ inbytesleft--; -+ GF_PUTC(f->next, '['); -+ GF_PUTC(f->next, hexout[0]); -+ GF_PUTC(f->next, hexout[1]); -+ GF_PUTC(f->next, ']'); -+ outbytesleft = eib - ip; -+ iconv(iconv_desc, NULL, NULL, NULL, NULL); -+ } else if (errno == EINVAL){ -+ /* -+ * We have to return from this function now because our input -+ * buffer contains an incomplete multibyte character which we -+ * can't complete without the next bytes of input which the -+ * filter below us will send us when it as more input for us. -+ * Next time around we need the incomplete bytes in the input -+ * buffer and will complete them to a multibyte character. -+ */ -+ dprint(2,(debugfile, -+ "einval: %d, ol: %d, incomplete input: 0x%02x\n", -+ inbytesleft, outbytesleft, (unsigned char) *op)); -+ /* -+ * Before we abort here, we need to flush already converted -+ * output up the filter chain, otherwise we may loose this -+ * already converted content. Note: -+ * Don't use GF_CH_RESET(f) in this path, we have at least -+ * one byte in our input buffer which we need next time to -+ * complete the sequence to a valid multibyte character! -+ */ -+ GF_FLUSH(f->next); -+ /* -+ * In case we are at the end of all input, and we have -+ * an incomplete multibyte sequence left, we must find -+ * a way to not fall into a loop, remember the bytes left: -+ */ -+ einval_inbytesleft = inbytesleft; -+ /* Take the straigt way out now(see the comments above) */ -+ break; -+ } /* errno check */ -+ } /* while (1) */ -+ GF_END(f, f->next); -+ break; -+ } /* GF_DATA */ -+ case GF_RESET: -+ iconv_desc = (iconv_t)(f->opt); -+ iconv(iconv_desc, NULL, NULL, NULL, NULL); -+ einval_inbytesleft = -1; -+ break; -+ case GF_EOD: -+ GF_FLUSH(f->next); -+ (*f->next->f)(f->next, GF_EOD); -+ } /* switch (flg) */ -+} -+#else - - /* - * This filter converts characters in one character set (the character -@@ -2202,6 +2328,7 @@ - - } - } -+#endif - - - /* -@@ -2209,7 +2336,7 @@ - */ - void * - gf_convert_charset_opt(conv_table) -- unsigned char *conv_table; -+ conversion_t conv_table; - { - return((void *) conv_table); - } -@@ -6441,9 +6568,10 @@ - - while(GF_GETC(f, c)){ - -- if(iscntrl(c & 0x7f) -+ if(iscntrl(!f->opt ? c & 0x7f : c) - && !(isspace((unsigned char) c) - || c == '\016' || c == '\017' || c == '\033')){ -+ dprint(1, (debugfile, "-- gf_control filter: %x\n",c)); - GF_PUTC(f->next, '^'); - GF_PUTC(f->next, c + '@'); - } -diff -rNu pine4.58/pine/init.c pine4.58.iconv/pine/init.c ---- pine4.58/pine/init.c 2003-09-11 00:15:33.000000000 +0200 -+++ pine4.58.iconv/pine/init.c 2003-09-11 00:16:25.000000000 +0200 -@@ -218,6 +218,18 @@ - - CONF_TXT_T cf_text_character_set[] = "Reflects capabilities of the display you have. Default: US-ASCII.\n# Typical alternatives include ISO-8859-x, (x is a number between 1 and 9)."; - -+#ifdef HAVE_ICONV -+CONF_TXT_T cf_text_send_charset[] = "Specifies the MIME charset that a message will be sent in. If not set,\n# the value of character set will be used."; -+#endif -+ -+CONF_TXT_T cf_text_assumed_charset[] = "When MIME charset information is missing in Content-Type header field.\n# Message is assumed to be in this charset. Default: US-ASCII. Typical values\n# include ISO-8859-x, ISO-2022-JP, EUC-KR, GB2312, and Big5. The value of\n# header fields which are not encoded per RFC 2047\n# is also assumed to be\n# in this charset."; -+ -+CONF_TXT_T cf_text_charset_aliases[] = "List of charset aliases. Each alias is a pair of charsets delimetered by a\n# single colon, the first one being an alias to the second one. The latter is\n# usually standard/prefered MIME name while the former is non-standard name used\n# by some email clients. For instance, you may have 'x-big5:big5,x-x-big5:big5,euc-cn:gb2312'"; -+ -+#ifdef HAVE_ICONV -+CONF_TXT_T cf_text_iconv_aliases[] = "List of charset aliases to use with iconv(). Each alias is a pair of\n# charsets delimetered by a single colon, the first one being an alias to the\n# second one. The former is usually standard/prefered MIME name while the\n# latter is non-standard name used by iconv(3) on your system.\n#For example,\n# your iconv may use non-standard 'UTF8' for the standard 'UTF-8'. In that\n # case, you can put 'UTF-8:UTF8' here."; -+#endif -+ - CONF_TXT_T cf_text_editor[] = "Specifies the program invoked by ^_ in the Composer,\n# or the \"enable-alternate-editor-implicitly\" feature."; - - CONF_TXT_T cf_text_speller[] = "Specifies the program invoked by ^T in the Composer."; -@@ -511,6 +523,18 @@ - cf_text_thread_lastreply_char}, - {"character-set", 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, - cf_text_character_set}, -+#ifdef HAVE_ICONV -+{"send-charset", 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, -+ cf_text_send_charset}, -+#endif -+{"assumed-charset", 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, -+ cf_text_assumed_charset}, -+{"charset-aliases", 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, -+ cf_text_charset_aliases}, -+#ifdef HAVE_ICONV -+{"iconv-aliases", 0, 1, 0, 1, 1, 1, 0, 0, 0, 0, -+ cf_text_iconv_aliases}, -+#endif - {"editor", 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, - cf_text_editor}, - {"speller", 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, -@@ -2023,6 +2047,14 @@ - set_current_val(&vars[V_SIGNATURE_FILE], TRUE, TRUE); - set_current_val(&vars[V_LITERAL_SIG], TRUE, TRUE); - set_current_val(&vars[V_CHAR_SET], TRUE, TRUE); -+#ifdef HAVE_ICONV -+ set_current_val(&vars[V_SEND_CHAR_SET], TRUE, TRUE); -+#endif -+ set_current_val(&vars[V_ASSUMED_CHAR_SET], TRUE, TRUE); -+ set_current_val(&vars[V_CHAR_SET_ALIASES], TRUE, TRUE); -+#ifdef HAVE_ICONV -+ set_current_val(&vars[V_ICONV_ALIASES], TRUE, TRUE); -+#endif - set_current_val(&vars[V_GLOB_ADDRBOOK], TRUE, TRUE); - set_current_val(&vars[V_ADDRESSBOOK], TRUE, TRUE); - set_current_val(&vars[V_FORCED_ABOOK_ENTRY], TRUE, TRUE); -diff -rNu pine4.58/pine/mailindx.c pine4.58.iconv/pine/mailindx.c ---- pine4.58/pine/mailindx.c 2003-09-11 00:15:33.000000000 +0200 -+++ pine4.58.iconv/pine/mailindx.c 2003-09-11 00:16:25.000000000 +0200 -@@ -6048,7 +6048,9 @@ - if(l = prefix ? strlen(prefix) : 0) - strcpy(s, prefix); - -- sprintf(buftmp, "%.75s", addr->personal); -+ /* sprintf(buftmp, "%.75s", addr->personal); */ -+ strncpy(buftmp, addr->personal,75); -+ buftmp[75]='\0'; - p = (char *) rfc1522_decode((unsigned char *) tmp_20k_buf, - SIZEOF_20KBUF, buftmp, &dummy); - removing_leading_and_trailing_white_space(p); -diff -rNu pine4.58/pine/mailpart.c pine4.58.iconv/pine/mailpart.c ---- pine4.58/pine/mailpart.c 2003-08-30 00:40:00.000000000 +0200 -+++ pine4.58.iconv/pine/mailpart.c 2003-09-11 00:16:25.000000000 +0200 -@@ -4023,7 +4023,8 @@ - fs_give((void **) &p); - } - else -- passed = !strucmp(test + 9, "us-ascii"); -+ passed = !strucmp(test + 9, -+ ps_global->VAR_ASSUMED_CHAR_SET ? ps_global->VAR_ASSUMED_CHAR_SET : "us-ascii"); - } - else - dprint(1, (debugfile, -diff -rNu pine4.58/pine/mailview.c pine4.58.iconv/pine/mailview.c ---- pine4.58/pine/mailview.c 2003-09-11 00:15:34.000000000 +0200 -+++ pine4.58.iconv/pine/mailview.c 2003-09-11 00:16:25.000000000 +0200 -@@ -347,6 +347,8 @@ - int url_bogus PROTO((char *, char *)); - long doubleclick_handle PROTO((SCROLL_S *, HANDLE_S *, - int *, int *)); -+int get_charset_filters PROTO((FILTLIST_S *, BODY *, CONV_TABLE **)); -+ - #ifdef _WINDOWS - int format_message_popup PROTO((SCROLL_S *, int)); - int simple_text_popup PROTO((SCROLL_S *, int)); -@@ -1523,6 +1525,7 @@ - - if(text2 = (void *)pine_mail_fetch_text(ps_global->mail_stream, - msgno, NULL, NULL, NIL)){ -+ FILTLIST_S filters[8], *filtpnt; - if(!gf_puts(NEWLINE, pc)) /* write delimiter */ - goto write_error; - #if defined(DOS) && !defined(WIN32) -@@ -1531,11 +1534,13 @@ - gf_set_readc(&gc, text2, (unsigned long)strlen(text2), CharStar); - #endif - gf_filter_init(); -- /* link in filters, similar to what is done in decode_text() */ -- if(!ps_global->pass_ctrl_chars){ -- gf_link_filter(gf_escape_filter, NULL); -- gf_link_filter(gf_control_filter, NULL); -- } -+ -+ /* get the charset filters and link them in */ -+ get_charset_filters(filters, body, NULL); -+ for(filtpnt = filters ; filtpnt->filter; filtpnt++) -+ gf_link_filter(filtpnt->filter, filtpnt->data); -+ -+ /* link in more filters, similar to what is done in decode_text() */ - gf_link_filter(gf_tag_filter, NULL); - - if((F_ON(F_VIEW_SEL_URL, ps_global) -@@ -1888,6 +1893,9 @@ - char *t; - size_t n, len; - unsigned char *p, *tmp = NULL; -+#ifdef HAVE_ICONV -+ char *assumed_charset = NULL; -+#endif - - /* - * Warning. Some callers of this routine use the first half -@@ -1904,7 +1912,26 @@ - p = (unsigned char *)(tmp_20k_buf+10000); - } - -+ -+#ifdef HAVE_ICONV -+ /* -+ * reset VAR_ASSUMED_CHAR_SET to '' temporarily to avoid -+ * a 'conflict' between the charset conversion with iconv(3) -+ * and the list management editorial -+ */ -+ if (ps_global->VAR_ASSUMED_CHAR_SET && *(ps_global->VAR_ASSUMED_CHAR_SET)){ -+ assumed_charset = (char *) fs_get(strlen(ps_global->VAR_ASSUMED_CHAR_SET) + 1); -+ strcpy(assumed_charset, ps_global->VAR_ASSUMED_CHAR_SET); -+ (ps_global->VAR_ASSUMED_CHAR_SET)[0] = '\0'; -+ } -+#endif - t = (char *)rfc1522_decode(p, len, s, NULL); -+#ifdef HAVE_ICONV -+ if (assumed_charset){ -+ strcpy(ps_global->VAR_ASSUMED_CHAR_SET, assumed_charset); -+ fs_give((void **)&assumed_charset); -+ } -+#endif - - gf_set_readc(&gc, t, strlen(t), CharStar); - -@@ -5056,6 +5083,45 @@ - return(0); - } - -+get_charset_filters(filters, body, conv_table) -+ FILTLIST_S *filters; -+ BODY *body; -+ CONV_TABLE **conv_table; -+{ -+ int filtcnt = 0; -+ static int passctl; -+ char *charset; -+ -+#ifndef HAVE_ICONV -+ if(F_OFF(F_DISABLE_2022_JP_CONVERSIONS, ps_global)) -+ filters[filtcnt++].filter = gf_2022_jp_to_euc; -+#endif -+ if(body && body->parameter && F_OFF(F_DISABLE_CHARSET_CONVERSIONS, ps_global)){ -+ if((charset = rfc2231_get_param(body->parameter,"charset",NULL,NULL))){ -+ CONV_TABLE *ct = conversion_table(charset, ps_global->VAR_CHAR_SET); -+ dprint(2, (debugfile, "found charset: %s\n", charset)); -+ if(ct && ct->table){ -+ dprint(2, (debugfile, "Inserting filter for charset %s.\n", charset)); -+ filters[filtcnt].filter = gf_convert_charset; -+ filters[filtcnt++].data = gf_convert_charset_opt(ct->table); -+ } -+ if (conv_table) /* conversion table pointer requested? */ -+ *conv_table = ct; -+ fs_give((void **) &charset); -+ } -+ } -+ -+ if(!ps_global->pass_ctrl_chars){ -+ filters[filtcnt++].filter = gf_escape_filter; -+ filters[filtcnt].filter = gf_control_filter; -+ /* UTF-8 needs to send bytes between 0x80 and 0x9f to the utf-8 terminal */ -+ passctl = (ps_global->VAR_CHAR_SET && -+ !strucmp(ps_global->VAR_CHAR_SET, "utf-8")); -+ filters[filtcnt++].data = (void *) &passctl; -+ } -+ filters[filtcnt].filter = NULL; -+ return filtcnt; -+} - - - /*---------------------------------------------------------------------- -@@ -5089,27 +5155,8 @@ - column = (flags & FM_DISPLAY) ? ps_global->ttyo->screen_cols : 80; - wrapit = column; - -- memset(filters, 0, sizeof(filters)); -- if(F_OFF(F_DISABLE_2022_JP_CONVERSIONS, ps_global)) -- filters[filtcnt++].filter = gf_2022_jp_to_euc; -- -- if(charset = rfc2231_get_param(att->body->parameter,"charset",NULL,NULL)){ -- if(F_OFF(F_DISABLE_CHARSET_CONVERSIONS, ps_global)){ -- -- ct = conversion_table(charset, ps_global->VAR_CHAR_SET); -- if(ct && ct->table){ -- filters[filtcnt].filter = gf_convert_charset; -- filters[filtcnt++].data = gf_convert_charset_opt(ct->table); -- } -- } -- -- fs_give((void **) &charset); -- } -- -- if(!ps_global->pass_ctrl_chars){ -- filters[filtcnt++].filter = gf_escape_filter; -- filters[filtcnt++].filter = gf_control_filter; -- } -+ /* get the charset filters */ -+ filtcnt = get_charset_filters(filters, att->body, &ct); - - if(flags & FM_DISPLAY) - filters[filtcnt++].filter = gf_tag_filter; -@@ -5225,6 +5272,7 @@ - if(!rv) - goto write_error; - } -+ filters[filtcnt].filter = NULL; /* Terminate filter array */ - - err = detach(ps_global->mail_stream, msgno, att->number, - NULL, pc, filtcnt ? filters : NULL); -diff -rNu pine4.58/pine/osdep/os-lnx.h pine4.58.iconv/pine/osdep/os-lnx.h ---- pine4.58/pine/osdep/os-lnx.h 2003-09-11 00:15:32.000000000 +0200 -+++ pine4.58.iconv/pine/osdep/os-lnx.h 2003-09-11 00:16:25.000000000 +0200 -@@ -214,6 +214,9 @@ - ----*/ - #define DF_DEFAULT_PRINTER ANSI_PRINTER - -+/*----- Virtually all Linux distributions come with glibc 2.x. with an excellent -+ * iconv implemenation */ -+#define HAVE_ICONV - - - /*----- The usual sendmail configuration for sending mail on Unix ------*/ -diff -rNu pine4.58/pine/osdep/termout.unx pine4.58.iconv/pine/osdep/termout.unx ---- pine4.58/pine/osdep/termout.unx 2003-01-30 00:43:30.000000000 +0100 -+++ pine4.58.iconv/pine/osdep/termout.unx 2003-09-11 00:16:25.000000000 +0200 -@@ -746,7 +746,9 @@ - && _col + 1 == ps_global->ttyo->screen_cols)) - return; - -- if(!iscntrl(ch & 0x7f)){ -+ if(!iscntrl( -+ !ps_global->VAR_CHAR_SET || strucmp(ps_global->VAR_CHAR_SET, "utf-8") -+ ? ch & 0x7f : ch)){ - putchar(ch); - if(esc_len > 0) - esc_len--; -diff -rNu pine4.58/pine/other.c pine4.58.iconv/pine/other.c ---- pine4.58/pine/other.c 2003-09-11 00:15:34.000000000 +0200 -+++ pine4.58.iconv/pine/other.c 2003-09-11 00:16:25.000000000 +0200 -@@ -7308,6 +7308,10 @@ - return(h_config_fld_sort_rule); - case V_CHAR_SET : - return(h_config_char_set); -+#ifdef HAVE_ICONV -+ case V_SEND_CHAR_SET : -+ return(h_config_send_char_set); -+#endif - case V_EDITOR : - return(h_config_editor); - case V_SPELLER : -diff -rNu pine4.58/pine/pine.h pine4.58.iconv/pine/pine.h ---- pine4.58/pine/pine.h 2003-09-11 00:15:34.000000000 +0200 -+++ pine4.58.iconv/pine/pine.h 2003-09-11 00:16:25.000000000 +0200 -@@ -68,6 +68,7 @@ - #define PHONE_HOME_HOST "docserver.cac.washington.edu" - - #define UNKNOWN_CHARSET "X-UNKNOWN" -+#define US_ASCII_CHARSET "US-ASCII" - - #define OUR_HDRS_LIST "X-Our-Headers" - -@@ -586,6 +587,14 @@ - , V_THREAD_EXP_CHAR - , V_THREAD_LASTREPLY_CHAR - , V_CHAR_SET -+#ifdef HAVE_ICONV -+ , V_SEND_CHAR_SET -+#endif -+ , V_ASSUMED_CHAR_SET -+ , V_CHAR_SET_ALIASES -+#ifdef HAVE_ICONV -+ , V_ICONV_ALIASES -+#endif - , V_EDITOR - , V_SPELLER - , V_FILLCOL -@@ -822,6 +831,15 @@ - #define GLO_FLD_SORT_RULE vars[V_FLD_SORT_RULE].global_val.p - #define VAR_CHAR_SET vars[V_CHAR_SET].current_val.p - #define GLO_CHAR_SET vars[V_CHAR_SET].global_val.p -+#ifdef HAVE_ICONV -+#define VAR_SEND_CHAR_SET vars[V_SEND_CHAR_SET].current_val.p -+#define GLO_SEND_CHAR_SET vars[V_SEND_CHAR_SET].global_val.p -+#endif -+#define VAR_ASSUMED_CHAR_SET vars[V_ASSUMED_CHAR_SET].current_val.p -+#define VAR_CHAR_SET_ALIASES vars[V_CHAR_SET_ALIASES].current_val.l -+#ifdef HAVE_ICONV -+#define VAR_ICONV_ALIASES vars[V_ICONV_ALIASES].current_val.l -+#endif - #define VAR_EDITOR vars[V_EDITOR].current_val.l - #define GLO_EDITOR vars[V_EDITOR].global_val.l - #define VAR_SPELLER vars[V_SPELLER].current_val.p -@@ -2081,11 +2099,18 @@ - ColAdj adjustment; - } INDEX_COL_S; - -+#ifdef HAVE_ICONV -+#include <iconv.h> -+typedef iconv_t conversion_t; -+#else -+typedef unsigned char * conversion_t; -+#endif -+ - typedef struct conversion_table { - char *from_charset; - char *to_charset; - int quality; -- unsigned char *table; -+ conversion_t table; - } CONV_TABLE; - - -@@ -3945,7 +3970,7 @@ - void gf_2022_jp_to_euc PROTO((FILTER_S *, int)); - void gf_euc_to_2022_jp PROTO((FILTER_S *, int)); - void gf_convert_charset PROTO((FILTER_S *, int)); --void *gf_convert_charset_opt PROTO((unsigned char *)); -+void *gf_convert_charset_opt PROTO((conversion_t)); - void gf_escape_filter PROTO((FILTER_S *, int)); - void gf_control_filter PROTO((FILTER_S *, int)); - void gf_tag_filter PROTO((FILTER_S *, int)); -@@ -4749,6 +4774,12 @@ - unsigned char *trans_euc_to_2022_jp PROTO((unsigned char *)); - unsigned char *trans_2022_jp_to_euc PROTO((unsigned char *)); - -+#ifdef HAVE_ICONV -+iconv_t get_iconv_d PROTO((char *, char *)); -+unsigned char* resolve_charset_alias PROTO((char *, char **)); -+unsigned char *trans_with_iconv PROTO((unsigned char *, char *, char *)); -+#endif -+ - - /*-- takeaddr.c --*/ - char **detach_vcard_att PROTO ((MAILSTREAM *, long, BODY *, char *)); -diff -rNu pine4.58/pine/pine.hlp pine4.58.iconv/pine/pine.hlp ---- pine4.58/pine/pine.hlp 2003-09-11 00:15:35.000000000 +0200 -+++ pine4.58.iconv/pine/pine.hlp 2003-09-11 00:16:26.000000000 +0200 -@@ -17819,6 +17819,29 @@ - <End of help on this topic> - </BODY> - </HTML> -+====== h_config_send_char_set ===== -+<HTML> -+<HEAD> -+<TITLE>OPTION: Send-Charset</TITLE> -+</HEAD> -+<BODY> -+<H1>OPTION: Send-Charset</H1> -+ -+If it's set, the headers and the body of an outgoing message is converted -+from the value of character-set (display/terminal charset) to the value -+of this option. You have to set this option if your terminal/display charset -+(say, UTF-8) is different from the charset you want your outgoing messsages -+to be in (say, ISO-8859-1, EUC-KR, Big5, GB2312) because your correspondents -+can't handle emails in UTF-8. -+ -+<P> -+<UL> -+<LI><A HREF="h_finding_help">Finding more information and requesting -+help</A> -+</UL><P> -+<End of help on this topic> -+</BODY> -+</HTML> - ====== h_config_editor ===== - <HTML> - <HEAD> -diff -rNu pine4.58/pine/reply.c pine4.58.iconv/pine/reply.c ---- pine4.58/pine/reply.c 2003-09-11 00:15:33.000000000 +0200 -+++ pine4.58.iconv/pine/reply.c 2003-09-11 00:16:26.000000000 +0200 -@@ -1515,18 +1515,32 @@ - && (decoded[0] == 'R' || decoded[0] == 'r') - && (decoded[1] == 'E' || decoded[1] == 'e')){ - -- if(decoded[2] == ':') -- sprintf(buf, "%.200s", subject); -+ if(decoded[2] == ':'){ -+ strncpy(buf, subject,l); -+ buf[l]='\0'; -+ } - else if((decoded[2] == '[') && (p = strchr(decoded, ']'))){ - p++; - while(*p && isspace((unsigned char)*p)) p++; -- if(p[0] == ':') -- sprintf(buf, "%.200s", subject); -+ if(p[0] == ':'){ -+ strncpy(buf, subject,l); -+ buf[l]='\0'; -+ } - } - } -- if(!buf[0]) -- sprintf(buf, "Re: %.200s", (subject && *subject) ? subject : "your mail"); -- -+ if(!buf[0]) { -+ /* -+ * Used to be -+ * sprintf(buf, "Re: %.200s", (subject && *subject) ? subject : -+ * "your mail"); -+ * Some implementations of sprintf() are locale-dependent and -+ * don't pass through an invalid sequence of bytes blindly. -+ * Use strncpy() instead: -+ */ -+ strcpy(buf,"Re: "); -+ strncpy(buf+4, (subject && *subject) ? subject : "your mail",l); -+ buf[l+4]='\0'; -+ } - fs_give((void **) &tmp); - return(buf); - } -@@ -4483,6 +4497,7 @@ - ENVELOPE *outgoing; - BODY *body = NULL; - MESSAGECACHE *mc; -+ char *temp_send_cset = NULL; - - outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); -@@ -4565,6 +4580,18 @@ - - gf_clear_so_writec((STORE_S *) msgtext); - -+#ifdef HAVE_ICONV -+ /* -+ * reset VAR_SEND_CHAR_SET to '' temporarily NOT to -+ * apply the charset conversion to a bounced message. -+ */ -+ if (ps_global->VAR_SEND_CHAR_SET && *(ps_global->VAR_SEND_CHAR_SET)){ -+ temp_send_cset = (char *) fs_get(strlen(ps_global->VAR_SEND_CHAR_SET) + 1); -+ strcpy(temp_send_cset, ps_global->VAR_SEND_CHAR_SET); -+ (ps_global->VAR_SEND_CHAR_SET)[0] = '\0'; -+ } -+#endif -+ - if(pine_simple_send(outgoing, &body, pmt_who, pmt_cnf, to, - !(to && *to) ? SS_PROMPTFORTO : 0) < 0){ - errstr = ""; /* p_s_s() better have explained! */ -@@ -4573,6 +4600,13 @@ - mail_flag(stream, long2string(rawno), "\\SEEN", 0); - } - -+#ifdef HAVE_ICONV -+ if (temp_send_cset){ -+ strcpy(ps_global->VAR_SEND_CHAR_SET, temp_send_cset); -+ fs_give((void **)&temp_send_cset); -+ } -+#endif -+ - /* Just for good measure... */ - mail_free_envelope(&outgoing); - pine_free_body(&body); -@@ -4733,8 +4767,10 @@ - - i = 0; /* for start of filter list */ - -+#ifndef HAVE_ICONV - if(F_OFF(F_DISABLE_2022_JP_CONVERSIONS, ps_global)) - filters[i++].filter = gf_2022_jp_to_euc; -+#endif - - if(charset = rfc2231_get_param(body->parameter,"charset",NULL,NULL)){ - if(F_OFF(F_DISABLE_CHARSET_CONVERSIONS, ps_global)){ -diff -rNu pine4.58/pine/send.c pine4.58.iconv/pine/send.c ---- pine4.58/pine/send.c 2003-09-11 00:15:35.000000000 +0200 -+++ pine4.58.iconv/pine/send.c 2003-09-11 00:29:35.000000000 +0200 -@@ -94,6 +94,9 @@ - int filter_message_text PROTO((char *, ENVELOPE *, BODY *, STORE_S **, - METAENV *)); - void filter_msgtxt_euc_to_2022_jp PROTO((BODY *)); -+#ifdef HAVE_ICONV -+void filter_msgtxt_to_send_charset PROTO((BODY *)); -+#endif - void pine_send_newsgroup_name PROTO((char *, char*, size_t)); - long message_format_for_pico PROTO((long, int (*)(int))); - char *send_exit_for_pico PROTO((struct headerentry *, void (*)())); -@@ -6284,6 +6287,55 @@ - } - } - -+#ifdef HAVE_ICONV -+/* -+ * Take the PicoText pointed to and replace it with PicoText which has been -+ * filtered to change the 'character-set' (display/terminal-charset) to -+ * 'send-charset'. (based on filter_msgtxt_euc_to_2022_jp, above) -+ */ -+void -+filter_msgtxt_to_send_charset(body) -+ BODY *body; -+{ -+ STORE_S **so = (STORE_S **)((body->type == TYPEMULTIPART) -+ ? &body->nested.part->body.contents.text.data -+ : &body->contents.text.data); -+ STORE_S *filtered_so = NULL; -+ gf_io_t pc, gc; -+ char *errstr; -+ CONV_TABLE *ct; -+ char * assumed_save = ps_global->VAR_ASSUMED_CHAR_SET; -+ -+ ps_global->VAR_ASSUMED_CHAR_SET = NULL; -+ ct = conversion_table(ps_global->VAR_CHAR_SET, ps_global->VAR_SEND_CHAR_SET); -+ ps_global->VAR_ASSUMED_CHAR_SET = assumed_save; -+ -+ if(ct->table && (filtered_so = so_get(PicoText, NULL, EDIT_ACCESS))){ -+ so_seek(*so, 0L, 0); -+ gf_filter_init(); -+ gf_link_filter(gf_convert_charset, gf_convert_charset_opt(ct->table)); -+ gf_set_so_readc(&gc, *so); -+ gf_set_so_writec(&pc, filtered_so); -+ if(errstr = gf_pipe(gc, pc)){ -+ so_give(&filtered_so); -+ dprint(1, (debugfile, -+ "Error with converting to send-charset %s:%s\n", -+ ps_global->VAR_SEND_CHAR_SET, errstr)); -+ return; -+ } -+ -+ gf_clear_so_readc(*so); -+ gf_clear_so_writec(filtered_so); -+ -+ so_give(so); -+ *so = filtered_so; -+ } -+ dprint(5, (debugfile, -+ "Succeeded in converting %s to %s for outgoing email\n", -+ ps_global->VAR_CHAR_SET, ps_global->VAR_SEND_CHAR_SET)); -+} -+#endif -+ - - /*---------------------------------------------------------------------- - Pass the first text segment of the message thru the "send filter" -@@ -7515,7 +7567,8 @@ - src = pf->scratch ? pf->scratch - : (*pf->text) ? *pf->text : ""; - -- len = strlen(src)+1; -+ /* multiplyer 5 should be enough for EUC-JP -> ISO-2022-JP */ -+ len = strlen(src)*5+1; - p = (char *)fs_get(len * sizeof(char)); - if(rfc1522_decode((unsigned char *)p, len, src, &charset) - == (unsigned char *) p){ -@@ -7646,10 +7699,18 @@ - fs_give((void **)pf->text); - - if(*pf->scratch){ -+#ifndef HAVE_ICONV - if(ps_global->VAR_CHAR_SET && - !strucmp(ps_global->VAR_CHAR_SET, "iso-2022-jp")) - *pf->text = - (char *) trans_euc_to_2022_jp((unsigned char *) (pf->scratch)); -+#else -+ if(ps_global->VAR_CHAR_SET && ps_global->VAR_SEND_CHAR_SET && -+ !strucmp(ps_global->VAR_CHAR_SET, ps_global->VAR_SEND_CHAR_SET)) -+ *pf->text = -+ (char *) trans_with_iconv((unsigned char *) (pf->scratch), -+ ps_global->VAR_CHAR_SET, ps_global->VAR_SEND_CHAR_SET); -+#endif - else - *pf->text = cpystr(pf->scratch); - } -@@ -7661,6 +7722,7 @@ - fs_give((void **)&pf->scratch); /* free now useless text */ - } - -+#ifndef HAVE_ICONV - /* - * Change EUC (unix Pine) or Shift-JIS (PC-Pine) into ISO-2022-JP - * in the message body. -@@ -7676,6 +7738,35 @@ - && F_OFF(F_DISABLE_2022_JP_CONVERSIONS, ps_global)) - filter_msgtxt_euc_to_2022_jp(*bod); - -+#else -+ /* -+ * Convert the message body in display charset('characer set') to -+ * 'send-charset' -+ */ -+ if(bod && *bod && ps_global->VAR_CHAR_SET && ps_global->VAR_SEND_CHAR_SET -+ && strucmp(ps_global->VAR_CHAR_SET, ps_global->VAR_SEND_CHAR_SET)) -+ filter_msgtxt_to_send_charset(*bod); -+ /* -+ * If we've the global pine config option "character-set" set, -+ * we work in the respective encoding and in case of reply/forward, -+ * we converted the original/quoted mailtext to "character-set" -+ * and we also have the assume that the user used the same enconding -+ * for adding text, so to ensure we will get the new charset set, -+ * we've to forget the old charset of the edited message text here: -+ */ -+ if(bod && *bod && ps_global->VAR_CHAR_SET) { -+ PARAMETER *pm; -+ BODY *b = ((*bod |