Mercurial > hg > mlmmj
changeset 803:43979253cf97
Add $text T$ substitution
author | Ben Schmidt |
---|---|
date | Fri, 30 Dec 2011 00:13:54 +1100 |
parents | 0f9082bde7ef |
children | 8d2b8248ac9f |
files | ChangeLog include/ctrlvalue.h src/ctrlvalue.c src/prepstdreply.c |
diffstat | 4 files changed, 36 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Dec 30 00:09:33 2011 +1100 +++ b/ChangeLog Fri Dec 30 00:13:54 2011 +1100 @@ -1,3 +1,4 @@ + o Add $text T$ substitution o Add $$ substitution o Allow list texts to include real UTF-8 characters, as documented o Fix bug where the normal listtext would be sent when unsubscribing from the @@ -17,7 +18,7 @@ o Better techniques for locating support files in php-admin -- existing installations will need to have their conf/config.php altered to set the variable $confdir - o Add $controlN$ substitution + o Add $control C$ substitution o Fix theoretically possible memory corruption by chomp() o Remove .sh from mlmmj-make-ml.sh; symlink original name o Correct spelling of 'receive' and 'voodoo' throughout the code and
--- a/include/ctrlvalue.h Fri Dec 30 00:09:33 2011 +1100 +++ b/include/ctrlvalue.h Fri Dec 30 00:13:54 2011 +1100 @@ -26,5 +26,6 @@ char *ctrlvalue(const char *listdir, const char *ctrlstr); char *ctrlcontent(const char *listdir, const char *ctrlstr); +char *textcontent(const char *listdir, const char *ctrlstr); #endif /* CTRLVALUE_H */
--- a/src/ctrlvalue.c Fri Dec 30 00:09:33 2011 +1100 +++ b/src/ctrlvalue.c Fri Dec 30 00:13:54 2011 +1100 @@ -34,7 +34,8 @@ #include "chomp.h" #include "memory.h" -static char *ctrlval(const char *listdir, const char *ctrlstr, int oneline) +static char *ctrlval(const char *listdir, const char *subdir, + const char *ctrlstr, int oneline) { char *filename, *value = NULL; int ctrlfd, i; @@ -42,7 +43,7 @@ if(listdir == NULL) return NULL; - filename = concatstr(3, listdir, "/control/", ctrlstr); + filename = concatstr(5, listdir, "/", subdir, "/", ctrlstr); ctrlfd = open(filename, O_RDONLY); myfree(filename); @@ -71,10 +72,16 @@ char *ctrlvalue(const char *listdir, const char *ctrlstr) { - return ctrlval(listdir, ctrlstr, 1); + return ctrlval(listdir, "control", ctrlstr, 1); } char *ctrlcontent(const char *listdir, const char *ctrlstr) { - return ctrlval(listdir, ctrlstr, 0); + return ctrlval(listdir, "control", ctrlstr, 0); } + +char *textcontent(const char *listdir, const char *ctrlstr) +{ + return ctrlval(listdir, "text", ctrlstr, 0); +} +
--- a/src/prepstdreply.c Fri Dec 30 00:09:33 2011 +1100 +++ b/src/prepstdreply.c Fri Dec 30 00:13:54 2011 +1100 @@ -180,8 +180,28 @@ if (value == NULL) value = mystrdup(""); goto concatandreturn; + } else if(strncmp(token, "text ", 5) == 0) { + value = token + 5; + if(*value == '\0') { + value = mystrdup(""); + goto concatandreturn; } - if(data) { + for(; *value != '\0'; value++) { + if(*value >= '0' && *value <= '9') continue; + if(*value >= 'A' && *value <= 'Z') continue; + if(*value >= 'a' && *value <= 'z') continue; + break; + } + if(*value != '\0') { + value = mystrdup(token + 5); + goto concatandreturn; + } + value = token + 5; + value = textcontent(listdir, value); + if (value == NULL) + value = mystrdup(""); + goto concatandreturn; + } else if(data) { for(i = 0; i < datacount; i++) { if(strcmp(token, data[i*2]) == 0) { value = mystrdup(data[(i*2)+1]);