]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Quoted printable subjects are now matched against prefix as well
authormmj <none@none>
Tue, 22 Jun 2004 08:50:26 +0000 (18:50 +1000)
committermmj <none@none>
Tue, 22 Jun 2004 08:50:26 +0000 (18:50 +1000)
ChangeLog
VERSION
include/strgen.h
src/do_all_the_voodo_here.c
src/strgen.c

index 6ad1ce60ddb347aed1d3f67302aff8b9667758bf..cb02fc778e718dbaccca8b01e67d33fc943cbcc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/VERSION b/VERSION
index a3df0a6959e154733da89a5d6063742ce6d5b851..6f4eebdf6f68fc72411793cdb19e3f1715b117f3 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.8.0
+0.8.1
index df49a2f7b86c82f3741e303cfecbc6c4cc68f3b7..89ec68faa3fbf73f7754da2380ffac5a1ebcaff3 100644 (file)
@@ -33,5 +33,6 @@ char *concatstr(int count, ...);
 char *hostnamestr(void);
 char *mydirname(const char *path);
 char *mybasename(const char *path);
+char *cleanquotedp(char *qpstr);
 
 #endif /* STRGEN_H */
index 0cd58f770021ec9b16722a732c934ee833fdc58b..2679f0d019b53aec263fbbdc27dfd240a4369fcd 100644 (file)
@@ -79,7 +79,7 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd,
                 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 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd,
                /* 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 @@ int do_all_the_voodo_here(int infd, int outfd, int hdrfd, int footfd,
                                                        strlen(subject));
                                        myfree(subject);
                                        myfree(hdrline);
+                                       myfree(unqp);
                                        continue;
                                }
+                               myfree(unqp);
                        }
                }
                
index 6398f43589633f8dfb5b29ecbe3d93f0c994cbb4..4b6327031b8adc6f96680f6704accb73c4e6ef88 100644 (file)
@@ -175,3 +175,40 @@ char *mybasename(const char *path)
        
        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;
+}