From 4a9ad157129463871877b787f4f168aac5383e5c Mon Sep 17 00:00:00 2001 From: jkar8572 Date: Wed, 9 Jul 2008 15:26:37 +0000 Subject: * Implement setting of charset for emails sent by warnquota (Michael Meskes) --- Changelog | 1 + warnquota.c | 15 ++++++++++++--- warnquota.conf | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index b0fdeb7..a4431b9 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ Changes in quota-tools from 3.16 to 3.17 +* Implement setting of charset for emails sent by warnquota (Michael Meskes) * Added quota_nld to the list of installed programs (Jan Kara) * some typos fixes (Matthew Boyle) * fixed possible segfault when unpriviledged user run edquota (Matthew Boyle) diff --git a/warnquota.c b/warnquota.c index f8188ad..56adbc0 100644 --- a/warnquota.c +++ b/warnquota.c @@ -10,7 +10,7 @@ * * Author: Marco van Wieringen * - * Version: $Id: warnquota.c,v 1.30 2007/08/23 14:05:49 jkar8572 Exp $ + * Version: $Id: warnquota.c,v 1.31 2008/07/09 15:26:37 jkar8572 Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -102,6 +102,7 @@ struct configparams { char cc_to[CNF_BUFFER]; char support[CNF_BUFFER]; char phone[CNF_BUFFER]; + char charset[CNF_BUFFER]; char *user_message; char *user_signature; char *group_message; @@ -501,6 +502,11 @@ static int mail_user(struct offenderlist *offender, struct configparams *config) fprintf(fp, "To: %s\n", to); if (should_cc(offender, config)) fprintf(fp, "Cc: %s\n", config->cc_to); + if ((config->charset)[0] != '\0') { /* are we supposed to set the encoding */ + fprintf(fp, "Content-Type: text/plain; charset=%s\n", config->charset); + fprintf(fp, "Content-Disposition: inline\n"); + fprintf(fp, "Content-Transfer-Encoding: 8bit\n"); + } fprintf(fp, "\n"); free(to); @@ -708,6 +714,7 @@ static int readconfigfile(const char *filename, struct configparams *config) sstrncpy(config->cc_to, CC_TO, CNF_BUFFER); sstrncpy(config->support, SUPPORT, CNF_BUFFER); sstrncpy(config->phone, PHONE, CNF_BUFFER); + (config->charset)[0] = '\0'; maildev[0] = 0; config->user_signature = config->user_message = config->group_signature = config->group_message = NULL; config->use_ldap_mail = 0; @@ -773,10 +780,12 @@ static int readconfigfile(const char *filename, struct configparams *config) sstrncpy(config->support, value, CNF_BUFFER); else if (!strcmp(var, "PHONE")) sstrncpy(config->phone, value, CNF_BUFFER); - else if (!strcmp(var, "MAILDEV")) { + else if (!strcmp(var, "CHARSET")) + sstrncpy(config->charset, value, CNF_BUFFER); + else if (!strcmp(var, "MAILDEV")) /* set the global */ sstrncpy(maildev, value, CNF_BUFFER); - } else if (!strcmp(var, "MESSAGE")) { + else if (!strcmp(var, "MESSAGE")) { config->user_message = sstrdup(value); create_eoln(config->user_message); verify_format(config->user_message, "MESSAGE"); diff --git a/warnquota.conf b/warnquota.conf index 2347e80..929998c 100644 --- a/warnquota.conf +++ b/warnquota.conf @@ -41,6 +41,8 @@ GROUP_SIGNATURE = See you!| Your admin| #devices. #MAILDEV = # +#Here you can set a charset for emails sent by warnquota (e.g. UTF-8) +#CHARSET = # If you are using LDAP mail lookups. # host, port, tls, binddn, and bindpw are straight forward. # LDAP_BASEDN is your search base dn -- cgit v1.2.3