]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Allow more characters in control and text filenames for substitutions.
authorBen Schmidt <none@none>
Mon, 16 Jan 2012 10:29:19 +0000 (21:29 +1100)
committerBen Schmidt <none@none>
Mon, 16 Jan 2012 10:29:19 +0000 (21:29 +1100)
ChangeLog
README.listtexts
src/prepstdreply.c

index e8f526399cd49bf1ec16d802592c4ed021f46f7d..e9ed29f6f4f8ec650193145eeedd5cd20439d938 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+ o Allow more characters in control and text filenames for substitutions
  o Add %%, %^%, %comment%, %control C% and %text T% formatting directives
  o Allow a space in $originalmail N$ substitution
  o Improve algorithm for list text substitutions
index b7c0f82321495f624d365e4c78300429f09960fc..f0e5bb295bf3781258b48ddfaddee305e9c54d4a 100644 (file)
@@ -251,13 +251,13 @@ not appropriate for use in headers. They are:
 
 - %text T%
   text from the file named T in the listdir/text directory; the name may only
-  include letters and digits; note that there is an unformatted version of
-  this directive
+  include letters, digits, underscore, dot and hyphen; note that there is an
+  unformatted version of this directive
 
 - %control C%
-  the contents of the control file named C in listir/control; the name may
-  only include letters and digits; note that there is an unformatted version
-  of this directive
+  the contents of the control file named C in listir/control; the name may only
+  include letters, digits, underscore, dot and hyphen; note that there is an
+  unformatted version of this directive
 
 - %originalmail%
 - %originalmail N%
@@ -331,8 +331,8 @@ Unformatted substitutions
 
 - $control C$
   the contents of the control file named C in listdir/control, with its final
-  newline stripped; the name may only include letters and digits; note that
-  there is a formatted version of this directive
+  newline stripped; the name may only include letters, digits, underscore, dot
+  and hyphen; note that there is a formatted version of this directive
 
 - $digestfirst$
   (available only in digest)
@@ -463,8 +463,8 @@ Unformatted substitutions
 
 - $text T$
   text from the file named T in the listdir/text directory, with its final
-  newline stripped; the name may only include letters and digits; note that
-  there is a formatted version of this directive
+  newline stripped; the name may only include letters, digits, underscore, dot
+  and hyphen; note that there is a formatted version of this directive
 
 - $$
   a single $
index 3c777599c03e16e9679ee8d128292fdaa3e0489b..54b3b28ee5019b9177a53a0277a00fcc2e35a1cd 100644 (file)
@@ -62,13 +62,16 @@ struct text {
 };
 
 
-static char *alphanum_token(char *token) {
+static char *filename_token(char *token) {
        char *pos;
        if (*token == '\0') return NULL;
        for(pos = token; *pos != '\0'; pos++) {
                if(*pos >= '0' && *pos <= '9') continue;
                if(*pos >= 'A' && *pos <= 'Z') continue;
                if(*pos >= 'a' && *pos <= 'z') continue;
+               if(*pos == '_') continue;
+               if(*pos == '-') continue;
+               if(*pos == '.') continue;
                break;
        }
        if (*pos != '\0') return NULL;
@@ -146,10 +149,10 @@ static void substitute_one(char **line_p, char **pos_p, const char *listaddr,
                value = concatstr(4, listname, listdelim, "subscribe-nomail@",
                                  fqdn);
        } else if(strncmp(token, "control ", 8) == 0) {
-               token = alphanum_token(token + 8);
+               token = filename_token(token + 8);
                if (token != NULL) value = ctrlcontent(listdir, token);
        } else if(strncmp(token, "text ", 5) == 0) {
-               token = alphanum_token(token + 5);
+               token = filename_token(token + 5);
                if (token != NULL) value = textcontent(listdir, token);
        } else if(data) {
                for(i = 0; i < datacount; i++) {
@@ -357,7 +360,7 @@ static void handle_directive(text *txt, char **line_p, char **pos_p,
                *pos_p = pos;
                return;
        } else if(strncmp(token, "control ", 8) == 0) {
-               token = alphanum_token(token + 8);
+               token = filename_token(token + 8);
                if (token != NULL) {
                        filename = concatstr(3, listdir, "/control/", token);
                        begin_new_source_file(txt, line_p, pos_p, filename);
@@ -365,7 +368,7 @@ static void handle_directive(text *txt, char **line_p, char **pos_p,
                        return;
                }
        } else if(strncmp(token, "text ", 5) == 0) {
-               token = alphanum_token(token + 5);
+               token = filename_token(token + 5);
                if (token != NULL) {
                        filename = concatstr(3, listdir, "/text/", token);
                        begin_new_source_file(txt, line_p, pos_p, filename);