procmail
[Top] [All Lists]

Re: maildir filename in recipe

2009-08-16 06:28:23
Am 2009-08-16 03:01:26, schrieb LuKreme:
On 15-Aug-2009, at 12:41, Jason wrote:
[1] - http://blog.raamdev.com/2007/11/14/using-procmail-to-mark-as- 
read

1) That is not the way to do that and 2) That's not safe.

:0
{ TRAP='mv "$LASTFOLDER" "${LASTFOLDER}:2,S"' }

That will mark a message stroed in Maildir as 'seen' which is the  
Maildir convention for 'read'.

No, even this is not right, because the message is in

   ${MAILDIR}.spome.path/new/1234567890.hostname

if you rename it to

   ${MAILDIR}.spome.path/new/1234567890.hostname:2,S
                         ^^^

then ist is NOT REALY marked as read because the  IMAP  specs  say,  you
have to move it to the /cur/ folder as:

   ${MAILDIR}.spome.path/cur/1234567890.hostname:2,S
                         ^^^

and if it is ONLY renamed, and you connect with "mutt" of  "Thinderbird"
it will go to the folder because it thinks it is  new.  This  mean,  the
right thing will be:

:0
{ TRAP='mv "$LASTFOLDER" "$(echo "${LASTFOLDER}" |sed 's|/new/|/cur/|'):2,S"' }

but now you have a problem with the "courierimapuiddb" where you have to
read:

    VERYLASTFOLDER="$(echo "${LASTFOLDER}" |sed 's|/new/|/cur/|'):2,S"
    FIRSTLINE=$(head -n1 <courierimapuiddb)
    LASTNUM=$(echo "${FIRSTLINE}" |cut -d ' ' -f3)
    SERTIME=$(date +%s)
    NEWNUM=$((LASTNUM+1))

    sed "s|${FIRSTLINE}|1 ${SERTIME} ${NEWNUM}|" <courierimapuiddb 
courierimapuiddb.tmp
    echo "${LASTNUM} ${SERTIME} $(echo "${LASTFOLDER}" |sed 
's|/new/|/cur/|'):2,S" >courierimapuiddb.tmp

    /bin/mv -f courierimapuiddb.tmp courierimapuiddb

this mean, you have to excange your

    :0
    { TRAP='mv "$LASTFOLDER" "${LASTFOLDER}:2,S"' }
                             ^^^^^^^^^^^^^^^^^^^

with the lines above into

    :0
    { TRAP='mv "$LASTFOLDER" "$(VERYLASTFOLDER=.... ; ... ; ... ; ...)"' }

and then "mutt" or "Thunderbird" wil not complain about it.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant

-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>                 Michelle Konzack
<http://www.can4linux.org/>                   Apt. 917
<http://www.flexray4linux.org/>               50, rue de Soultz
Jabber linux4michelle(_at_)jabber(_dot_)ccc(_dot_)de           67100 
Strabourg/France
IRC    #Debian (irc.icq.com)                  Tel. DE: +49 177 9351947
ICQ    #328449886                             Tel. FR: +33  6  61925193
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail