Mercurial > hg > mlmmj
changeset 265:f28ab75abba7
Quoted printable subjects are now matched against prefix as well
author | mmj |
---|---|
date | Tue, 22 Jun 2004 18:50:26 +1000 |
parents | d3ade2c1f058 |
children | a34cc2ec2cf6 |
files | ChangeLog VERSION include/strgen.h src/do_all_the_voodo_here.c src/strgen.c |
diffstat | 5 files changed, 47 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jun 22 17:07:10 2004 +1000 +++ b/ChangeLog Tue Jun 22 18:50:26 2004 +1000 @@ -1,3 +1,5 @@ + o Make sure we check if the Subject: prefix might be present in the + de-quoted printable version of the Subject. If so, don't add it. o Fix bug with queuefilename containing all kinds og chars when sending standard mails o Let mlmmj-send be capable of handling relayhost local users bounce probes
--- a/VERSION Tue Jun 22 17:07:10 2004 +1000 +++ b/VERSION Tue Jun 22 18:50:26 2004 +1000 @@ -1,1 +1,1 @@ -0.8.0 +0.8.1
--- a/include/strgen.h Tue Jun 22 17:07:10 2004 +1000 +++ b/include/strgen.h Tue Jun 22 18:50:26 2004 +1000 @@ -33,5 +33,6 @@ char *hostnamestr(void); char *mydirname(const char *path); char *mybasename(const char *path); +char *cleanquotedp(char *qpstr); #endif /* STRGEN_H */
--- a/src/do_all_the_voodo_here.c Tue Jun 22 17:07:10 2004 +1000 +++ b/src/do_all_the_voodo_here.c Tue Jun 22 18:50:26 2004 +1000 @@ -79,7 +79,7 @@ const char **delhdrs, struct mailhdr *readhdrs, struct strlist *allhdrs, const char *prefix) { - char *hdrline, *subject; + char *hdrline, *subject, *unqp; allhdrs->count = 0; allhdrs->strs = NULL; @@ -114,7 +114,9 @@ /* Add Subject: prefix if wanted */ if(prefix) { if(strncmp(hdrline, "Subject: ", 9) == 0) { - if(strstr(hdrline + 9, prefix) == NULL) { + unqp = cleanquotedp(hdrline + 9); + if(strstr(hdrline + 9, prefix) == NULL && + strstr(unqp, prefix) == NULL) { subject = concatstr(4, "Subject: ", prefix, " ", hdrline + 9); @@ -122,8 +124,10 @@ strlen(subject)); myfree(subject); myfree(hdrline); + myfree(unqp); continue; } + myfree(unqp); } }
--- a/src/strgen.c Tue Jun 22 17:07:10 2004 +1000 +++ b/src/strgen.c Tue Jun 22 18:50:26 2004 +1000 @@ -175,3 +175,40 @@ return ret; } + +char *cleanquotedp(char *qpstr) +{ + char *retstr = mymalloc(strlen(qpstr)); + char qc[3], *c = qpstr; + long qcval; + int i = 0; + + /* XXX: We only use this function for checking whether the subject + * prefix is only present, so the recoding is neither guaranteed + * complete nor correct */ + + qc[2] = '\0'; + while(*c != '\0') { + switch(*c) { + case '=': + qc[0] = *(++c); + qc[1] = *(++c); + c++; + qcval = strtol(qc, NULL, 16); + if(qcval) + retstr[i++] = (char)qcval; + break; + case '_': + retstr[i++] = ' '; + c++; + break; + default: + retstr[i++] = *(c++); + break; + } + } + + retstr[i] = '\0'; + + return retstr; +}