Peter Svanberg (psv@nada.kth.se)

Patches to pine 3.90



These are patches to get the following:

* Correction to the when-to-QP-encode code: The 30% limit must be
  paired with a lower length limit, or else very short letters could
  mysteriously sometimes be BASE64-encoded, because of a too high
  non-ASCII character ratio. (For getting just this correction, see
  the changes to line 3263-3266 in send.c.)

* New command line parameters:

  -use qp [0 or 1]	Use MIME encoding quoted printable for text,
			not 8-bit. (Default XX, 0=no, 1 or [none]=yes.)
  -mime_8 [0 or 1]	If text contains 8-bit text, use
			MIME. (Default YY, 0=no, 1 or [none]=yes.)

* New config parameters (on which the XX and YY defaults above
  depends): 

	DEFAULT_NOT_USE_QUOTED_PRINTABLE - Corresponds to "-use_qp 0"

  Enable this *only* if your sending software have the ESMTP 8BITMIME
  extension avaliable and enabled. (See RFC 1425 and RFC 1426.)

	DEFAULT_USE_NON_MIME_8BIT_LOCALLY - Corresponds to "-mime_8 0"

  Enable this *only* if your sending software transforms messages to
  7-bit before sending them outside your domain, or if it transforms
  it to MIME and uses ESMTP 8BITMIME (see above).

(I do *not* take any responsibility for the functionality of Pine 3.90
after applying this patch!)

---
Peter Svanberg,				    Email: psv@nada.kth.se
Dept of Num An & CS,
Royal Inst of Tech			    Phone: +46 8 790 71 40
S-100 44  Stockholm, SWEDEN		    Fax:   +46 8 790 09 30



*** pine.h.DIST Thu Aug 25 04:55:22 1994 --- pine.h Wed Aug 31 17:04:59 1994 *************** *** 1048,1049 **** --- 1048,1052 ---- + unsigned mime_encode_8bit_text:1; + unsigned mime_use_qp_encoding:1; + unsigned noshow_error:1; *** args.c.DIST Thu Aug 18 19:19:47 1994 --- args.c Mon Sep 5 22:12:13 1994 *************** *** 111,112 **** --- 111,124 ---- + #ifdef DEFAULT_USE_NON_MIME_8BIT_LOCALLY + pine_state->mime_encode_8bit_text = 0; + #else + pine_state->mime_encode_8bit_text = 1; + #endif + + #ifdef DEFAULT_NOT_USE_QUOTED_PRINTABLE + pine_state->mime_use_qp_encoding = 0; + #else + pine_state->mime_use_qp_encoding = 1; + #endif + /* while more arguments with leading - */ *************** *** 147,148 **** --- 159,174 ---- goto Loop; + }else if(strcmp(*av, "mime_8") == 0) { /* PSv */ + if(--ac){ + pine_state->mime_encode_8bit_text = atoi(*++av); + }else{ + pine_state->mime_encode_8bit_text = 1; + } + goto Loop; + }else if(strcmp(*av, "use_qp") == 0) { /* PSv */ + if(--ac){ + pine_state->mime_use_qp_encoding = atoi(*++av); + }else{ + pine_state->mime_use_qp_encoding = 1; + } + goto Loop; }else if(strcmp(*av, "sort") == 0){ *************** *** 367,368 **** --- 393,404 ---- { + int mime_encode_8bit_text = 1; + int mime_use_qp_encoding = 1; + + #ifdef DEFAULT_USE_NON_MIME_8BIT_LOCALLY + mime_encode_8bit_text = 0; + #endif + #ifdef DEFAULT_NOT_USE_QUOTED_PRINTABLE + mime_use_qp_encoding = 0; + #endif + /** print out possible starting arguments... **/ *************** *** 396,397 **** --- 432,439 ---- printf("\t -a\t\tSpecial anonymous mode for UWIN\n"); + + printf("\t -use_qp [0 or 1]\n\t\t\tUse MIME encoding quoted printable for text, not 8-bit.\n\t\t\t(Default %s, 0=no, 1 or [none]=yes.)\n", + mime_use_qp_encoding ? "yes" : "no"); + printf("\t -mime_8 [0 or 1]\n\t\t\tIf text contains 8-bit text, use MIME.\n\t\t\t(Default %s, 0=no, 1 or [none]=yes.)\n", + mime_encode_8bit_text ? "yes" : "no"); + /* WHILE TESTING FOLDERS */ *** send.c.DIST Fri Aug 26 20:36:55 1994 --- send.c Mon Sep 5 22:11:11 1994 *************** *** 3078,3079 **** --- 3078,3081 ---- + body->mime_allowed = 1; + #ifndef DOS *************** *** 3263,3266 **** } ! else if ((eight_bit_chars * 100L)/len < 30L) { /* * The 30% threshold is based on qp encoded readability --- 3265,3269 ---- } ! else if ((eight_bit_chars * 100L)/len < 30L || len < 100) { /* + * Less than 30% 8-bit or shorter than 100 chars. * The 30% threshold is based on qp encoded readability *************** *** 3273,3275 **** if (new_encoding != ENCBINARY) ! new_encoding = ENC8BIT; /* short lines, < 30% 8 bit chars */ }else { --- 3276,3281 ---- if (new_encoding != ENCBINARY) ! new_encoding = ENC8BIT; /* short lines, few 8 bit chars */ ! if (!ps_global->mime_encode_8bit_text) { ! body->mime_allowed = 0; ! } }else { *************** *** 3589,3591 **** ! if (body && !header->env->remail) { /* not if remail or no body */ if((f && !(*f)(s, MIME_VER)) --- 3595,3598 ---- ! if (body && !header->env->remail && body->mime_allowed) { /* PSv */ ! /* not [if remail or no body structure or !mime_allowed] */ if((f && !(*f)(s, MIME_VER)) *************** *** 3803,3805 **** case ENC8BIT: /* encode 8BIT into QUOTED-PRINTABLE */ ! gf_link_filter(gf_8bit_qp); break; --- 3810,3813 ---- case ENC8BIT: /* encode 8BIT into QUOTED-PRINTABLE */ ! if (body->mime_allowed && ps_global->mime_use_qp_encoding) ! gf_link_filter(gf_8bit_qp); break; *************** *** 3859,3861 **** body_encodings[body->encoding == ENCBINARY ? ENCBASE64 : ! body->encoding == ENC8BIT ? ENCQUOTEDPRINTABLE : body->encoding <= ENCMAX ? body->encoding : --- 3867,3872 ---- body_encodings[body->encoding == ENCBINARY ? ENCBASE64 : ! (body->encoding == ENC8BIT ! && body->mime_allowed ! && ps_global->mime_use_qp_encoding) ? ! ENCQUOTEDPRINTABLE : body->encoding <= ENCMAX ? body->encoding : *** makefile.???.DIST Tue Jul 26 00:21:59 1994 --- makefile.??? Mon Sep 5 02:27:17 1994 *************** If desired add -DDEFAULT_NOT_USE_QUOTED_PRINTABLE or -DDEFAULT_USE_NON_MIME_8BIT_LOCALLY to the line starting CFLAGS= ... *** ../c-client/mail.h.DIST Thu Aug 18 07:25:15 1994 --- ../c-client/mail.h Mon Sep 5 21:53:03 1994 *************** *** 238,239 **** --- 238,240 ---- } size; + unsigned short mime_allowed; /* (PSv) MIME allowed? (internal status) */ }; (pine-3.90-patch-8bit.txt END)