fix dist
authorPhilipp Takacs <philipp@bureaucracy.de>
Thu, 11 Aug 2016 15:22:49 +0000 (17:22 +0200)
committerPhilipp Takacs <philipp@bureaucracy.de>
Thu, 11 Aug 2016 15:22:49 +0000 (17:22 +0200)
Because of always mimeify the dist hasn't work anymore.
This is fixed by skipping attach() and signandenc(), if
it's handled as a redistribution message.

test/tests/dist/test-dist [new file with mode: 0755]
uip/send.c

diff --git a/test/tests/dist/test-dist b/test/tests/dist/test-dist
new file mode 100755 (executable)
index 0000000..ced6595
--- /dev/null
@@ -0,0 +1,41 @@
+# Test dist
+
+. "$MH_TEST_COMMON"
+
+msgfile=`mhpath b +inbox`
+cat >"$msgfile" <<EOF
+From: juergen <juergen@example.net>
+To: bob@example.com
+Subject: test dist
+Date: Mon, 18 Apr 2016 08:36:14 +0200
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Message-ID: <1as2n8-1Q9-00@deseo.home.schnalke.org>
+
+foo
+EOF
+
+runandcheck 'dist -whatnow true l +inbox' <<!
+!
+
+export mhdist=1
+export mhaltmsg=$msgfile
+
+echo 'Resent-To: test@example.com' > `mhpath +drafts l`
+
+runandcheck 'send -debug +drafts l |sed "s/^Resent-Date:.*/Resent-Date:/" |sed "s/^Resent-From:.*/Resent-From:/"' <<!
+From: juergen <juergen@example.net>
+To: bob@example.com
+Subject: test dist
+Date: Mon, 18 Apr 2016 08:36:14 +0200
+MIME-Version: 1.0
+Content-Type: text/plain; charset="us-ascii"
+Message-ID: <1as2n8-1Q9-00@deseo.home.schnalke.org>
+Resent-To: test@example.com
+Resent-Date:
+Resent-From:
+
+foo
+----EOM----
+test@example.com
+!
index 9ad124f..eac15ae 100644 (file)
@@ -336,6 +336,10 @@ attach(char *draft_file_name)
        int length = strlen(attach_hdr);
        char *p;
 
+       if(distfile) {
+               return DONE;
+       }
+
        if (!(draft_file = fopen(draft_file_name, "r"))) {
                adios(EX_IOERR, NULL, "can't open draft file `%s'.", draft_file_name);
        }
@@ -438,6 +442,10 @@ signandenc(char *draft_file_name)
        int doenc = 0;
        int ret;
 
+       if(distfile) {
+               return DONE;
+       }
+
        if (!(draft_file = fopen(draft_file_name, "r"))) {
                adios(EX_IOERR, NULL, "can't open draft file `%s'.", draft_file_name);
        }