ifile-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ifile-discuss] space vs tab


From: Bill Williamson
Subject: [Ifile-discuss] space vs tab
Date: Wed, 06 Oct 2004 15:38:42 +1000
User-agent: Mozilla Thunderbird 0.7.2 (Windows/20040707)

I am using ifile in a "crazy style" auto-filter arrangement on my courier imap server (with procmail). I have folders with spaces in their name, and currently do some odd substitution tricks to get it changed.

Attached is my procmailrc and my ifile.sh "autolearn" file which runs once every 15 minutes from cron. Any suggestions on de-crazifying this would be helpful as well.


#!/bin/bash
IFS="
"
for mail in $(find /home/batkiwi/Maildir -cmin -15 -path '*cur*' -type f | grep 
-v 'Trash' | grep -v 'Sent' | grep -v 'Spam' )
do
        if [ -f $mail ]
        then

        folder=`echo $mail | sed 's/.*Maildir\/\(.*\)\/.*/\1/'`
        if [ "$folder" = "cur" ]
        then
                folder="INBOX"
        else
                folder=`echo $folder | sed 's/\.\(.*\)\/cur/\1/' | sed 's/ 
/:/g'`
        fi

        oldfolder=`cat "$mail" | formail -z -x X-IFile-Guess | sed 's/ /:/g'`
        subject=`cat "$mail" | formail -z -x Subject`
        if [ "$oldfolder" = "$folder" ]
        then
                #echo "$oldfolder already correct for $subject"
                blah="blah"
        elif [ "$oldfolder" = "" ]
        then
                echo "old folder empty, new folder $folder for $subject"
                grep -E "^[-[:alnum:]]*: " "$mail" | /home/batkiwi/ifile -i 
"$folder"
        else
                echo "$oldfolder to $folder for $subject"
                grep -E "^[-[:alnum:]]*: " "$mail" | /home/batkiwi/ifile -d 
"$oldfolder" -i "$folder"
        fi

        fi
done
#Preliminaries
SHELL=/bin/sh               #Use the Bourne shell (check your path!)
MAILDIR=${HOME}/Maildir/            #First check what your mail directory is!
DEFAULT=${MAILDIR}
LOGFILE=${MAILDIR}/procmail.log
LOG="--- Logging ${LOGFILE} for ${LOGNAME}, "
IFILE=/home/batkiwi/ifile

#pass to spamc
:0fw
| spamc

#test ifile
:0wh
IFILECAT=| ${IFILE} -c -q 

#IFILECAT=| grep -E "^[-[:alnum:]]*: " | ${IFILE} -c -q
IFILECAT=`/bin/echo ${IFILECAT} | /bin/sed 's/:/ /g'`

:0fw
| formail -A "X-IFile-Guess: ${IFILECAT}"

IFILECAT=`/bin/echo ${IFILECAT} | /bin/sed 's/ /\\ /g'`

#get rid of hella-spam, 8 or more stars
:0:
* ^X-Spam-Level: \*\*\*\*\*\*\*\*
/dev/null

#filter out me spam, mateys!
:0:
* ^X-Spam-Flag:.*YES
.Trash/

:0:
* ^X-IFile-Guess: INBOX
${MAILDIR}

:0:
".${IFILECAT}/"

# Accept all the rest to your default mailbox
# should never hit this one
:0:
${MAILDIR}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]