I'm using procmail with gziped boxes, with no problems with a patch and lockfiles :

first, my .muttrc :

<cut>-------------------------

append-hook     \\.gz$  "touch $HOME/.mutt_gzip.lock ; gzip -c %t >> %f ; rm -f 
$HOME/.mutt_gzip.lock"
open-hook       \\.gz$  "touch $HOME/.mutt_gzip.lock ; gzip -cd %f > %t"
close-hook      \\.gz$  "gzip -c %t > %f ; rm -f $HOME/.mutt_gzip.lock"

</cut>-------------------------


.mutt_gzip.lock is my lockfile



second, the patch :

<cut>-------------------------

diff -urN mutt-1.2/mx.c mutt-1.1.12/mx.c
--- mutt-1.2/mx.c       Wed May 10 10:44:09 2000
+++ mutt-1.1.12/mx.c    Tue May  2 17:16:08 2000
@@ -915,6 +915,15 @@
   else if (!ctx->changed && ctx->deleted == 0)
   {
     mutt_message _("Mailbox is unchanged.");
+    #ifdef USE_COMPRESSED
+    if (ctx->compressinfo) {
+       char * home = getenv("HOME");
+       char fichlock[256];
+       strcpy(fichlock,home);
+       strcat(fichlock,"/.mutt_gzip.lock");
+       unlink(fichlock);
+    }
+    #endif
     mx_fastclose_mailbox (ctx);
     return 0;
   }

</cut>-------------------------


third, my .procmailrc :


<cut>-------------------------

:0w                    # Anything from Antoine Martin
* ^From.*martina.*
| proczip Antoine.gz                                   

</cut>-------------------------



finally, the script proczip :

<cut>-------------------------
#!/bin/sh

if [ -f ${HOME}/.mutt_gzip.lock ] ;then \
  cat >> $DEFAULT ;                     \
else                                    \
  /usr/local/gnu/bin/gzip -fcq9 >> ${MAILDIR}/$1 ;      \
fi      
</cut>-------------------------



Now, I'll explain how it works  :
When I open a gzipped mailbox with mutt, I create a lockfile.
When procmail want to deliver a mail, it will put it in the
compressed mailbox ONLY if this mailbox is not used by mutt.
If the mailbox is used, the mail will be delivered in the
$DEFAULT mbox, which should NOT be compressed, of course.



Any idea to make this better ?

Antoine



On Sat, May 20, 2000 at 04:25:29PM +0200, Roland Rosenfeld wrote:
> On Sat, 20 May 2000, Zhendong wrote:
> 
> > Then what about the supporting for compressed mail folders in procmail
> > when using mutt? I use procmail to deliver mails to different mail 
> > folders. After I've changed the mutt folders to gz format, procmail 
> > still delivers mails as uncompressed format, they can not work well 
> > together.
> 
> It's possible to append mails to gzipped folders by something like
> 
> | gzip >> folder
> 
> in your .procmailrc.
> 
> BUT DON'T DO THIS, if you do not want to loose mail!
> IIRC, there is no mechanism to merge changes in the compressed folder
> into the temporary uncompressed folder, so if you have a compressed
> folder open for reading, while a new mail arrives and is appended to
> this compressed folder, it will never been shown, but simply
> overwritten, when leaving the compressed folder with mutt.
> 
> I suggest to use compressed folders only for archive folders but not
> for incoming folders.
> 
> Tschoeeee
> 
>         Roland
> 
> -- 
>  * [EMAIL PROTECTED] * http://www.spinnaker.de/ *

Reply via email to