Source: nn
Version: 6.7.3-14
Severity: normal
Tags: patch

Dear Maintainer,

>From e05d9f839fafa7bc9ba5308d8be7456604626823 Mon Sep 17 00:00:00 2001
>From: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
>Date: Fri, 26 Feb 2021 00:46:52 +0000
>Subject: [PATCH] answer.c: add MIME header if charset is not us-ascii

  answer.c: add MIME header if charset is not us-ascii

Signed-off-by: Bjarni Ingi Gislason <bjarn...@rhi.hi.is>
---
 answer.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/answer.c b/answer.c
index 69330ce..d602c80 100644
--- a/answer.c
+++ b/answer.c
@@ -13,6 +13,7 @@
 #include "global.h"
 #include "answer.h"
 #include "aux.h"
+#include "chset.h"
 #include "db.h"
 #include "fullname.h"
 #include "group.h"
@@ -99,8 +100,10 @@ static int      ed_line;
 #include <time.h>
 #include <pwd.h>
 
-extern struct tm *gmtime();
-extern char    *asctime();
+/* defined in <time.h>
+ extern struct tm *gmtime();
+ extern char    *asctime();
+*/
 #endif
 
 static int
@@ -866,6 +869,9 @@ post_menu(void)
     group_header    gh;
     char            group_name[FILENAME], subject[FILENAME], 
distribution[FILENAME],
                     keywords[FILENAME], summary[FILENAME];
+    const char     *cp;
+    const char mime_header_format[]="MIME-Version: 1.0\nContent-Type: 
text/plain; charset=%s\nContent-Transfer-Encoding: 8bit\n";
+
 
     if (checkhold(NULL, K_POST))
        return 1;
@@ -992,6 +998,14 @@ again_group:
        fprintf(t, "Keywords: %s\n", keywords);
        ed_line++;
     }
+
+/* Add MIME header if charset is not us-ascii */
+    if (strcmp(curchset->cs_name, "us-ascii") != 0) {
+       fprintf(t, mime_header_format, curchset->cs_name);
+       for (cp = mime_header_format; *cp != NUL; cp++)
+           if (*cp == '\n') ed_line++;
+    }
+
     end_header(t, extra_news_headers);
 
     if (post_source_file) {
-- 
2.30.0



-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.9-1 (SMP w/2 CPU threads)
Locale: LANG=is_IS.iso88591, LC_CTYPE=is_IS.iso88591 (charmap=ISO-8859-1), 
LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

-- debconf information excluded

-- 
Bjarni I. Gislason

Reply via email to