Blame SOURCES/quota-4.01-define_charset_in_mail.patch

370c56
From aebb8189069f24e6f4e59cf79f179bcbafe7a098 Mon Sep 17 00:00:00 2001
370c56
From: Jan Kara <jack@suse.cz>
370c56
Date: Tue, 6 Nov 2012 11:04:44 +0100
370c56
Subject: [PATCH 1/2] warnquota: Add MIME-Version header
370c56
370c56
Warnquota forgot to add MIME-Version header to sent email when Content-type
370c56
etc. fields were set.
370c56
370c56
Signed-off-by: Jan Kara <jack@suse.cz>
370c56
---
370c56
 warnquota.c | 1 +
370c56
 1 file changed, 1 insertion(+)
370c56
370c56
diff --git a/warnquota.c b/warnquota.c
370c56
index 08827f2..80f528c 100644
370c56
--- a/warnquota.c
370c56
+++ b/warnquota.c
370c56
@@ -503,6 +503,7 @@ static int mail_user(struct offenderlist *offender, struct configparams *config)
370c56
 	if (should_cc(offender, config))
370c56
 		fprintf(fp, "Cc: %s\n", config->cc_to);
370c56
 	if ((config->charset)[0] != '\0') { /* are we supposed to set the encoding */
370c56
+		fprintf(fp, "MIME-Version: 1.0\n");
370c56
 		fprintf(fp, "Content-Type: text/plain; charset=%s\n", config->charset);
370c56
 		fprintf(fp, "Content-Disposition: inline\n");
370c56
 		fprintf(fp, "Content-Transfer-Encoding: 8bit\n");
370c56
-- 
370c56
1.7.11.7
370c56
370c56
From d8bb9ec3cef26cd3fb62534d896bf9c8feea67f9 Mon Sep 17 00:00:00 2001
370c56
From: Jan Kara <jack@suse.cz>
370c56
Date: Tue, 6 Nov 2012 12:12:19 +0100
370c56
Subject: [PATCH 2/2] warnquota: Use current locale as default charset
370c56
370c56
If charset in warnquota.conf is not specified, use charset from current
370c56
locale as the charset of the warning email. This is to accomodate possible
370c56
translations of messages via gettext.
370c56
370c56
Signed-off-by: Jan Kara <jack@suse.cz>
370c56
---
370c56
 warnquota.c | 9 +++++++++
370c56
 1 file changed, 9 insertions(+)
370c56
370c56
diff --git a/warnquota.c b/warnquota.c
370c56
index 80f528c..5c5a1b9 100644
370c56
--- a/warnquota.c
370c56
+++ b/warnquota.c
370c56
@@ -29,6 +29,8 @@
370c56
 #include <grp.h>
370c56
 #include <time.h>
370c56
 #include <getopt.h>
370c56
+#include <locale.h>
370c56
+#include <langinfo.h>
370c56
 #include <sys/types.h>
370c56
 #include <sys/wait.h>
370c56
 #include <sys/utsname.h>
370c56
@@ -707,6 +709,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
370c56
 	char *value;
370c56
 	char *pos;
370c56
 	int line, len, bufpos;
370c56
+	char *locale;
370c56
 
370c56
 	/* set default values */
370c56
 	sstrncpy(config->mail_cmd, MAIL_CMD, CNF_BUFFER);
370c56
@@ -716,6 +719,12 @@ static int readconfigfile(const char *filename, struct configparams *config)
370c56
 	sstrncpy(config->support, SUPPORT, CNF_BUFFER);
370c56
 	sstrncpy(config->phone, PHONE, CNF_BUFFER);
370c56
 	(config->charset)[0] = '\0';
370c56
+	setlocale(LC_ALL, NULL);
370c56
+	locale = setlocale(LC_MESSAGES, NULL);
370c56
+	if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) {
370c56
+		locale = nl_langinfo(CODESET);
370c56
+		sstrncpy(config->charset, locale, CNF_BUFFER);
370c56
+	}
370c56
 	maildev[0] = 0;
370c56
 	config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
370c56
 	config->use_ldap_mail = 0;
370c56
-- 
370c56
1.7.11.7
370c56