nmh-workers
[Top] [All Lists]

compose, while MM_CHARSET != us-ascii (with patch)

1992-11-06 00:04:50
Below the patch for mhn.c (update #9), which allow
to use your favorite charset. If message body contains
eight bit chars and MM_CHARSET present, then this part
would have marked with charset=(value from MM_CHARSET)
and transfer encoding 8bit. Patch marked with

        #ifdef KOI8
        ...
        #endif

Actually it did not depend on any charset.

*** mhn.c.orig  Wed Oct  7 18:57:15 1992
--- mhn.c       Thu Nov  5 23:13:55 1992
***************
*** 874,880 ****
--- 874,884 ----
  static struct str2init str2ces[] = {
      "base64",         CE_BASE64,      InitBase64,
      "quoted-printable", CE_QUOTED,    InitQuoted,
+ #ifdef KOI8
+     "8bit",           CE_8BIT,        Init7Bit,
+ #else
      "8bit",           CE_8BIT,        NULL,
+ #endif
      "7bit",           CE_7BIT,        Init7Bit,
      "binary",         CE_BINARY,      NULL,

***************
*** 5312,5317 ****
--- 5316,5326 ----
                                   **ep;
                    register struct text *t;

+ #ifdef KOI8
+                   if(charset == CHARSET_UNKNOWN && mm_charset)
+                       charset = (-2);
+ #endif
+
                    if (charset == -1)
                        charset = CHARSET_USASCII;

***************
*** 5322,5333 ****
                             *ap;
                             ap++, ep++)
                        continue;
!                   cp = index (*ap++ =
!                                   add ((t -> tx_charset = charset)
!                                               == CHARSET_USASCII
!                                            ? "charset=us-ascii"
!                                            : "charset=x-unknown", NULLCP),
!                               '=');
                    *ap = NULL;
                    *cp++ = NULL;
                    *ep = cp;
--- 5331,5359 ----
                             *ap;
                             ap++, ep++)
                        continue;
!                   switch((t->tx_charset = charset)) {
!
!                   case CHARSET_USASCII:
!                       *ap = add("charset=us-ascii", NULLCP);
!                       break;
!
!                   case CHARSET_UNKNOWN:
!                       *ap = add("charset=x-unknown", NULLCP);
!                       break;
!
! #ifdef KOI8
!                   case (-2):
!                       {
!                               char    lbuf[64];
!
!                               strcpy(lbuf, "charset=");
!                               strcat(lbuf, mm_charset);
!                               *ap = add(lbuf, NULLCP);
!                       }
!                       break;
! #endif
!                   }
!                   cp = index (*ap++, '=');
                    *ap = NULL;
                    *cp++ = NULL;
                    *ep = cp;
***************
*** 5447,5452 ****
--- 5473,5482 ----
        case CT_TEXT:
            if (ct -> c_subtype != TEXT_PLAIN
                    || (ct -> c_ctparams
+ #ifdef KOI8
+                           && ((struct text *) ct -> c_ctparams) -> tx_charset
+                                       != (-2)
+ #endif
                            && ((struct text *) ct -> c_ctparams) -> tx_charset
                                        != CHARSET_USASCII)) {
  quoted_printable: ;
***************
*** 5459,5475 ****

        case CT_MESSAGE:
  seven_bit: ;
-           fprintf (out, "\n");
            if (ct -> c_type == CT_MESSAGE
                    && ct -> c_subtype == MESSAGE_EXTERNAL) {
                register struct exbody *e = (struct exbody *) ct -> c_ctparams;

                (void) output_content (e -> eb_content, out);
                if (e -> eb_body)
                    fprintf (out, "\n%s\n", e -> eb_body);
            }
            else
                (void) write7Bit (ct, out);
            break;

        case CT_APPLICATION:
--- 5489,5516 ----

        case CT_MESSAGE:
  seven_bit: ;
            if (ct -> c_type == CT_MESSAGE
                    && ct -> c_subtype == MESSAGE_EXTERNAL) {
                register struct exbody *e = (struct exbody *) ct -> c_ctparams;

+               fprintf (out, "\n");
                (void) output_content (e -> eb_content, out);
                if (e -> eb_body)
                    fprintf (out, "\n%s\n", e -> eb_body);
            }
+           else {
+ #ifdef KOI8
+           if (ct->c_type == CT_TEXT && ct->c_subtype == TEXT_PLAIN
+               && (ct -> c_ctparams
+                   && ((struct text *) ct -> c_ctparams) -> tx_charset
+                                       == (-2)))
+               fprintf (out, "%s: %s\n\n", ENCODING_FIELD,
+                        "8bit");
            else
+ #endif
+               fprintf (out, "\n");
                (void) write7Bit (ct, out);
+           }
            break;

        case CT_APPLICATION:

<Prev in Thread] Current Thread [Next in Thread>