diff --git a/root/var/spool/hylafax/bin/faxrcvd-sme b/root/var/spool/hylafax/bin/faxrcvd-sme index 8a644d6..6826776 100755 --- a/root/var/spool/hylafax/bin/faxrcvd-sme +++ b/root/var/spool/hylafax/bin/faxrcvd-sme @@ -1,20 +1,5 @@ #! /bin/bash -# $Id: faxrcvd.sh.in,v 1.32 2008/04/29 23:34:25 faxguy Exp $ -# -# ============================================ -# -# A NOTE ON CUSTOMIZING this script: -# -# You are welcome (even encouraged) to customize this script to suit the -# needs of the deployment. However, be advised that this script is -# considered part of the package distribution and is subject to being -# overwritten by subsequent upgrades. Please consider copying this file -# to something like "etc/faxrcvd-custom", modifying that copy of the file, -# and then setting "FaxRcvdCmd: etc/faxrcvd-custom" in your modem config -# file to prevent your customizations from being overwritten during an -# upgrade process. -# -# ============================================ +# $Id: faxrcvd.sh.in,v 1.49.4.1 2007/09/24 19:13:47 aidan Exp $ # # HylaFAX Facsimile Software # @@ -29,11 +14,11 @@ # Sam Leffler and Silicon Graphics may not be used in any advertising or # publicity relating to the software without the specific, prior written # permission of Sam Leffler and Silicon Graphics. -# +# # THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, # EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY # WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. -# +# # IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR # ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, # OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, @@ -50,165 +35,6 @@ if [ $# -lt 4 ]; then exit 1 fi -# -# If you want to change the presentation of the e-mail notification -# then this is the place to change that. We put it here, up-front, -# because this is most likely what most customizations will deal with. -# -faxrcvd_mail() -{ - MAILTYPE="$1" - MAILTO="$2" - CCTO="$3" - BCCTO="$4" - - (echo "Mime-Version: 1.0" - echo "Content-Type: Multipart/Mixed; Boundary=\"$MIMEBOUNDARY\"" - echo "Content-Transfer-Encoding: 7bit" - echo "To: $MAILTO" - if [ -n "$CCTO" ]; then echo "Cc: $CCTO"; fi - if [ -n "$BCCTO" ]; then echo "Bcc: $BCCTO"; fi - printf "From: " - printf "$DICTRECEIVEAGENT" | LANG=C $AWK -f bin/rfc2047-encode.awk -v charset="$CHARSET" - echo " <$FROMADDR>" - printf "Subject: " - ( - if [ -f "$FILE" ]; then - eval echo "$DICTRECEIVEDFROM"; - else - eval echo "$DICTNOTRECEIVED"; - fi - ) | LANG=C $AWK -f bin/rfc2047-encode.awk -v charset="$CHARSET"; echo - echo "" - echo "--$MIMEBOUNDARY" - echo "Content-Type: text/plain; charset=$CHARSET" - echo "Content-Transfer-Encoding: quoted-printable" - echo "" - ( - if [ -f $FILE ]; then - case "$MAILTYPE" in - textonly) - echo "$FILE (ftp://$HOSTNAME:$PORT/$FILE):";; - esac - faxInfo $FILE - echo "$DICTRECEIVEDON| $DEVICE" | printFormatted $INFOSIZE - if [ -z "$MSG" ]; then - case "$MAILTYPE" in - withattached) - echo "$DICTCOMMID| c$COMMID" | printFormatted $INFOSIZE - ;; - textonly) - echo "$DICTCOMMID| c$COMMID (ftp://$HOSTNAME:$PORT/log/c$COMMID)" | printFormatted $INFOSIZE - if [ -f $FILE ] && [ -n "$SENDTO" ]; then - echo "" - eval echo "$DICTDISPATCHEDTO" - fi - ;; - esac - fi - else - eval echo "$DICTATTEMPTEDFAXFAILED" - fi - ) | LANG=C $AWK -f bin/qp-encode.awk - if [ "$MSG" ] || [ ! -f $FILE ]; then - ( - echo "" - echo "$DICTMSGINTRO" - echo "" - echo " $ERRMSG" - echo "" - echo "$DICTLOGFOLLOWS" - echo "" - ) | LANG=C $AWK -f bin/qp-encode.awk - if [ -f log/c$COMMID ]; then - echo "" - echo "--$MIMEBOUNDARY" - echo "Content-Type: text/plain; charset=US-ASCII; name=c$COMMID" - echo "Content-Description: FAX session log" - echo "Content-Transfer-Encoding: 7bit" - echo "Content-Disposition: inline" - echo "" - $SED -e '/-- data/d' \ - -e '/start.*timer/d' -e '/stop.*timer/d' \ - log/c$COMMID - elif [ -n "$COMMID" ]; then - ( echo "$DICTNOLOGAVAIL ($DICTCOMMID c$COMMID)." ) | LANG=C $AWK -f bin/qp-encode.awk - else - ( echo "$DICTNOLOGAVAIL." ) | LANG=C $AWK -f bin/qp-encode.awk - fi - fi - if [ -f $FILE ]; then - if [ "$MAILTYPE" = "withattached" ]; then - for type in $FILETYPE; do - echo "" - echo "--$MIMEBOUNDARY" - if [ "$type" = "tif" ]; then - echo "Content-Type: image/tiff; name=\"$FILENAME.tif\"" - echo "Content-Description: FAX document" - echo "Content-Transfer-Encoding: $ENCODING" - echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\"" - echo "" - # This is useful because the majority of TIFF viewers won't - # be able to read JBIG compressed TIFF files, while - # G4 (MMR) is a much older and supported format. - if (tiffinfo $FILE | grep "JBIG" > /dev/null) then - tiffcp -c g4 $FILE $FILE.g4.tif - encode $FILE.g4.tif - $RM -f $FILE.g4.tif 2>$ERRORSTO - else - encode $FILE - fi - elif [ "$type" = "tif-r" ]; then - echo "Content-Type: image/tiff; name=\"$FILENAME.tif\"" - echo "Content-Description: FAX document" - echo "Content-Transfer-Encoding: $ENCODING" - echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\"" - echo "" - if (tiffinfo $FILE | grep "JPEG" > /dev/null) then - tiffcp -c jpeg:R $FILE $FILE.r.tif - encode $FILE.r.tif - $RM -f $FILE.r.tif 2>$ERRORSTO - else - encode $FILE - fi - elif [ "$type" = "tif-y" ]; then - echo "Content-Type: image/tiff; name=\"$FILENAME.tif\"" - echo "Content-Description: FAX document" - echo "Content-Transfer-Encoding: $ENCODING" - echo "Content-Disposition: attachment; filename=\"$FILENAME.tif\"" - echo "" - if (tiffinfo $FILE | grep "JPEG" > /dev/null) then - tiffcp -c jpeg:Y $FILE $FILE.y.tif - encode $FILE.y.tif - $RM -f $FILE.y.tif 2>$ERRORSTO - else - encode $FILE - fi - elif [ "$type" = "pdf" ]; then - echo "Content-Type: application/pdf; name=\"$FILENAME.pdf\"" - echo "Content-Description: FAX document" - echo "Content-Transfer-Encoding: $ENCODING" - echo "Content-Disposition: attachment; filename=\"$FILENAME.pdf\"" - echo "" - $TIFF2PDF -o $FILE.pdf $FILE - encode $FILE.pdf - $RM -f $FILE.pdf 2>$ERRORSTO - else # default as Postscript - echo "Content-Type: application/postscript; name=\"$FILENAME.ps\"" - echo "Content-Description: FAX document" - echo "Content-Transfer-Encoding: 7bit" - echo "Content-Disposition: attachment; filename=\"$FILENAME.ps\"" - echo "" - $FAX2PS $FILE 2>$ERRORSTO - fi - done - fi - fi - echo "" - echo "--$MIMEBOUNDARY--" - ) 2>$ERRORSTO | $SENDMAIL -f$FROMADDR -oi -t -} - test -f etc/setup.cache || { SPOOL=`pwd` cat< +## Email the template,adding the attachments according +## to $FILETYPE to $SENDTO +## +## We use the common CreateMailMessage