]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
Bug 853: Add multiple file formats to notify/faxrcvd/pollrcvd emails
authorAidan Van Dyk <aidan@ifax.com>
Wed, 28 Feb 2007 13:18:01 +0000 (13:18 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Wed, 28 Feb 2007 13:18:01 +0000 (13:18 +0000)
This patch allows to convert received faxes to multiple files, e.g.

FILETYPE="tiff pdf"                   # separated by whitespace

will create two attachments: one (original, unchanged) TIFF file, and a PDF
file. This is meant both as a safety belt to protect against failing
TIFF-to-something conversion, and as a convenience for users using different
fax readers.

From: Helge Oldach <hylafax@oldach.net>

man/faxrcvd.1m
man/notify.1m
util/faxrcvd.sh.in
util/notify.sh.in
util/pollrcvd.sh.in

index 6acd94e1037e8c941a955df1c706863d2fff524d..18400c906eca006465eae150c2302624878412ce 100644 (file)
@@ -127,6 +127,9 @@ above.
 .I FILETYPE
 controls the filetype of the image attachment.  Current
 filetype options are ``ps'', ``tif'', and ``pdf''.
+Multiple values may be specified by separating them with
+whitespace. In that case a separate attachment is created
+for each filetype.
 .TP
 .I FROMADDR
 controls the sender of the received fax notification.  It is
index d5dee2dd7cf1100c9a61a24123ebfc86a4bc1e49..432df3795a62c0e841a7a4bf75ad813ba89fdd39 100644 (file)
@@ -119,6 +119,9 @@ to return a copy of the submitted documents to the
 .B SENDER
 address along with the notification message.  The ``original'' setting
 uses the format type that was used in the submission.
+Multiple values may be specified by separating them with
+whitespace. In that case a separate attachment is created
+for each filetype.
 .TP
 .I RETURNTECHINFO
 defaults to ``yes'' and is used to indicate whether or not technical
index 0073fb31376972cf0ce7ca45df85abfd609b8545..8f908be2ddf6b00e941acd42fd44b5dbe099ebb9 100644 (file)
@@ -83,6 +83,9 @@ fi
 # Permit various types of attachment types: ps, tif, pdf
 # Note that non-ASCII filetypes require an encoder.
 # pdf requires tiff2ps and tiff2pdf
+# Multiple file types may be specified by separating them with
+# whitespace; in that case a separate attachment for each filetype
+# will be created.
 #
 FILETYPE=ps
 SENDTO=
@@ -163,7 +166,10 @@ MailWithFAX ()
     files_1=$FILE;
     filetype_1=TIFF;
     nfiles=1;
-    ATTACH_ARGS=`BuildAttachArgs $FILETYPE`
+    for ft in $FILETYPE
+    do
+       ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs $ft`
+    done
     eval CreateMailMessage $template $ATTACH_ARGS \
        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$SENDTO"
 
index ef504a4ddc86f01d94fa317cdf6c6c062ac68e08..aece9a6d242b943f4cb2ad2925583263c76b098f 100644 (file)
 # If it is a pager job, and notify-$WHY-page.txt does *not* exist, it
 # will use the notify-$WHY.txt template.
 #
-# It honours the RETURNFILETYPE varialbe that can be set by FaxNotify.
+# It honours the RETURNFILETYPE variable that can be set by FaxNotify.
 # If it is set, it will return *all* the submitted documents as attachments
 # with the e-mail, converted to the RETURNFILETYPE.
+# Multiple file types may be specified by separating them with
+# whitespace; in that case a separate attachment for each filetype
+# will be created.
 
 if [ $# != 3 ] && [ $# != 4 ]; then
     echo "Usage: $0 qfile why jobtime [nextTry]"
@@ -125,7 +128,7 @@ export SENDTO FROMADDR TOADDR SESSION_LOG DESTINATION WHY JTIME NEXT JOBINFO
 # be set to their non-customized defaults prior to this.
 #
 if [ -f etc/FaxNotify ]; then
-    # source notify preferecnes
+    # source notify preferences
     . etc/FaxNotify
 fi
 
@@ -137,7 +140,10 @@ fi
 
 
 if [ -n "$RETURNFILETYPE" ]; then
-    ATTACH_ARGS=`BuildAttachArgs $RETURNFILETYPE`
+    for ft in $RETURNFILETYPE
+    do
+       ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs $ft`
+    done
 fi
 
 template="etc/templates/$TEMPLATE/notify-$WHY.txt"
index 09eb49257746e15c50b72e3803f3a06b9ba4b7c0..8acc87e79f467ef6fef012233b2c2638ace87c89 100644 (file)
@@ -84,6 +84,9 @@ fi
 # Permit various types of attachment types: ps, tif, pdf
 # Note that non-ASCII filetypes require an encoder.
 # pdf requires tiff2ps and tiff2pdf
+# Multiple file types may be specified by separating them with
+# whitespace; in that case a separate attachment for each filetype
+# will be created.
 # 
 FILETYPE=ps
 
@@ -161,7 +164,10 @@ MailWithFAX ()
     files_1=$FILE;
     filetype_1=TIFF;
     nfiles=1;
-    ATTACH_ARGS=`BuildAttachArgs $FILETYPE`
+    for ft in $FILETYPE
+    do
+       ATTACH_ARGS="$ATTACH_ARGS "`BuildAttachArgs $ft`
+    done
     eval CreateMailMessage "$template" $ATTACH_ARGS \
        2>$ERRORSTO | $SENDMAIL -f"$FROMADDR" -oi "$SENDTO"