[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: LYNX-DEV Re: MIME charset headers for mail
From: |
Hynek Med |
Subject: |
Re: LYNX-DEV Re: MIME charset headers for mail |
Date: |
Sun, 13 Apr 1997 22:15:41 +0200 (MET DST) |
OK, here's a patch that will make lynx add MIME headers for mailto: and
printing via "Mail the file". It also adds "Content-Transfer-Encoding:
8bit" for printing HMTL documents via "Mail the file", and X-Mailer:
Lynx.. for this printing. It doesn't do the checks Klaus suggested - yet,
and it doesn't take VMS into account.
BTW, Klaus, the printing of HTML source has something like
fprintf(outfile_fp, "Content-Type: text/html");
if (HTLoadedDocumentCharset() != NULL) {
fprintf(outfile_fp, "; charset=%s\n",
HTLoadedDocumentCharset());
} else {
fprintf(outfile_fp, "\n");
}
Is this enough in the current chartrans patches context?
Hynek
--
Hynek Med, address@hidden
*** lynx2-7-1/src/LYPrint.c.orig Wed Apr 9 14:36:37 1997
--- lynx2-7-1/src/LYPrint.c Sun Apr 13 21:29:18 1997
***************
*** 22,27 ****
--- 22,30 ----
#ifdef DOSPATH
#include "HTDOS.h"
#endif
+ #ifdef EXP_CHARTRANS
+ #include "LYCharSets.h" /* to get current charset for mail header */
+ #endif
#include "LYLeaks.h"
***************
*** 532,537 ****
--- 535,541 ----
* Add Content-Type, Content-Location, and
* Content-Base headers for HTML source. - FM
* Also add Mime-Version header. - HM
+ * Also add Content-Transfer-Encoding.
*/
fprintf(outfile_fp, "Mime-Version: 1.0\n");
fprintf(outfile_fp, "Content-Type: text/html");
***************
*** 541,555 ****
} else {
fprintf(outfile_fp, "\n");
}
fprintf(outfile_fp, "Content-Base: %s\n",
content_base);
fprintf(outfile_fp, "Content-Location: %s\n",
content_location);
}
fprintf(outfile_fp, "X-URL: %s\n", newdoc->address);
fprintf(outfile_fp, "To: %s\nSubject:%s\n\n",
user_response, sug_filename);
! if (HTisDocumentSource()) {
/*
* Added the document's base as a BASE tag to
* the top of the message body. May create
--- 545,575 ----
} else {
fprintf(outfile_fp, "\n");
}
+ fprintf(outfile_fp, "Content-Transfer-Encoding: 8BIT\n");
fprintf(outfile_fp, "Content-Base: %s\n",
content_base);
fprintf(outfile_fp, "Content-Location: %s\n",
content_location);
+ } else {
+ /*
+ * Add Mime-Version, Content-Type: text/plain and
+ * Content-Transfer-Encoding headers for non-source
+ * documents.
+ */
+ #ifdef EXP_CHARTRANS
+ fprintf(outfile_fp, "Mime-Version: 1.0\n");
+ fprintf(outfile_fp,
+ "Content-Type: TEXT/PLAIN; charset=%s\n",
+ LYCharSet_UC[current_char_set].MIMEname);
+ fprintf(outfile_fp, "Content-Transfer-Encoding: 8BIT\n");
+ #endif
}
fprintf(outfile_fp, "X-URL: %s\n", newdoc->address);
+ fprintf(outfile_fp, "X-Mailer: Lynx, Version %s\n",
+ LYNX_VERSION);
fprintf(outfile_fp, "To: %s\nSubject:%s\n\n",
user_response, sug_filename);
! if (HTisDocumentSource()) {
/*
* Added the document's base as a BASE tag to
* the top of the message body. May create
*** lynx2-7-1/src/LYMail.c.orig Wed Apr 9 14:52:55 1997
--- lynx2-7-1/src/LYMail.c Sun Apr 13 21:52:11 1997
***************
*** 11,17 ****
#include "LYGlobalDefs.h"
#include "HTParse.h"
#include "LYMail.h"
!
#include "LYLeaks.h"
#define FREE(x) if (x) {free(x); x = NULL;}
--- 11,19 ----
#include "LYGlobalDefs.h"
#include "HTParse.h"
#include "LYMail.h"
! #ifdef EXP_CHARTRANS
! #include "LYCharSets.h" /* to get current charset for mail header */
! #endif
#include "LYLeaks.h"
#define FREE(x) if (x) {free(x); x = NULL;}
***************
*** 722,727 ****
--- 724,742 ----
StrAllocCopy(header, buf);
#endif
/*
+ * Put the Mime-Version, Content-Type and
+ * Content-Transfer-Encoding in the header.
+ */
+ #ifdef EXP_CHARTRANS
+ sprintf(buf,"Mime-Version: 1.0\n");
+ StrAllocCat(header, buf);
+ sprintf(buf,"Content-Type: TEXT/PLAIN; charset=%s\n",
+ LYCharSet_UC[current_char_set].MIMEname);
+ StrAllocCat(header, buf);
+ sprintf(buf,"Content-Transfer-Encoding: 8BIT\n");
+ StrAllocCat(header, buf);
+ #endif
+ /*
* Put the X-URL and X-Mailer lines in the header.
*/
sprintf(buf, "X-URL: %s%s\n",
***************
*** 730,735 ****
--- 745,751 ----
StrAllocCat(header, buf);
sprintf(buf,"X-Mailer: Lynx, Version %s\n",LYNX_VERSION);
StrAllocCat(header, buf);
+
#endif /* VMS */
/*