From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/55100 Path: main.gmane.org!not-for-mail From: Bijan Soleymani Newsgroups: gmane.emacs.gnus.general Subject: nnmaildir and info flags Date: Thu, 04 Dec 2003 22:46:00 -0500 Sender: ding-owner@lists.math.uh.edu Message-ID: <87fzg0dj0n.fsf@server.crasseux.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary_(ID_HgRJ+EzBVF2qGOz+hl0Mqw)" X-Trace: sea.gmane.org 1070596091 12366 80.91.224.253 (5 Dec 2003 03:48:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2003 03:48:11 +0000 (UTC) Original-X-From: ding-owner+M3640@lists.math.uh.edu Fri Dec 05 04:48:08 2003 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AS6wq-0003At-00 for ; Fri, 05 Dec 2003 04:48:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1AS6wc-0001Yr-00; Thu, 04 Dec 2003 21:47:54 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1AS6wX-0001Ym-00 for ding@lists.math.uh.edu; Thu, 04 Dec 2003 21:47:49 -0600 Original-Received: from VL-MO-MR001.ip.videotron.ca (relais.videotron.ca [24.201.245.36]) by justine.libertine.org (Postfix) with ESMTP id BB0313A003B for ; Thu, 4 Dec 2003 21:47:48 -0600 (CST) Original-Received: from server.crasseux.com ([69.70.70.36]) by VL-MO-MR001.ip.videotron.ca (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HPE00NREL4M1I@VL-MO-MR001.ip.videotron.ca> for ding@gnus.org; Thu, 04 Dec 2003 22:45:58 -0500 (EST) Original-To: ding@gnus.org User-Agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Xref: main.gmane.org gmane.emacs.gnus.general:55100 --Boundary_(ID_HgRJ+EzBVF2qGOz+hl0Mqw) Content-type: TEXT/PLAIN; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Hi everyone, Other MUAs (mutt, courier-imap) store certain information about the status of messages in the filename. Basically they add an S to the end of the message if it has been seen, R if it has been replied, etc. This is all decribed at: http://cr.yp.to/proto/maildir.html Gnus doesn't use these flags. So if you use gnus to read mails in a maildir and then access the same mail in mutt, the mails will appear to be unread. If you had read them in mutt first mutt will add the S (seen) flag, but gnus ignores it and the message would still appear to be unread. To fix this I've made a little perl script (~= 100 lines) for myself that syncs the two. It looks at gnus's marks and adds flags to the messages, then it looks at the messages' flags and adds gnus marks. The ideal solution would be to have gnus add the marks directly. I don't enough lisp to pull this off. --Boundary_(ID_HgRJ+EzBVF2qGOz+hl0Mqw) Content-type: application/x-perl; NAME=gnus_maildir_sync Content-disposition: attachment; filename=gnus_maildir_sync Content-description: syncs maildir status between gnus and other MUAs #!/usr/bin/perl mark("/home/bijan/Maildir/"); mark("/home/bijan/Maildir/debian-user/"); mark("/home/bijan/Maildir/ding/"); mark("/home/bijan/Maildir/hurd/"); mark("/home/bijan/Maildir/icebike/"); mark("/home/bijan/Maildir/mclug/"); mark("/home/bijan/Maildir/mlug/"); mark("/home/bijan/Maildir/spam/"); sub insert_flag { $old_flags = $_[0]; $new_flag = $_[1]; if($old_flags =~ /(.*)2,(.*)/) { $before = $1; $after = $2; } else { $before = $old_flags; $after = ""; } @flags = split("",$after); push(@flags,$new_flag); $new_flags=$before . "2,"; foreach $flag (sort @flags) { if($new_flags !~ /$flag/) { $new_flags.= $flag; } } return $new_flags; } sub mark { $maildir=$_[0]; #Store the flags for each messages in a hash and use the message #filename as the key. opendir(CUR,$maildir . "cur/"); while($file = readdir(CUR)) { if($file ne "." and $file ne "..") { $file =~ /(.*):(.*)/; $message{$1} = $2; } } closedir(CUR); #Take information from the .nnmaildir mark directory and add it to #the mail files. #Mark read. opendir(READ,$maildir . ".nnmaildir/marks/read/"); while($file = readdir(READ)) { if($message{$file} and $message{$file} !~ /S/) { $old_flags = $message{$file}; $new_flags = insert_flag($message{$file},"S"); rename($maildir . "cur/" . $file . ":" . $old_flags, $maildir . "cur/" . $file . ":" . $new_flags); } } closedir(READ); #Mark reply. opendir(REPLY,$maildir . ".nnmaildir/marks/reply/"); while($file = readdir(REPLY)) { if($message{$file} and $message{$file} !~ /R/) { $old_flags = $message{$file}; $new_flags = insert_flag($message{$file},"R"); rename($maildir . "cur/" . $file . ":" . $old_flags, $maildir . "cur/" . $file . ":" . $new_flags); } } closedir(REPLY); #Take information from the mail files and add it to the .nnmaildir #marks directory. mkdir($maildir . "nnmaildir/marks/"); mkdir($maildir . "nnmaildir/marks/read/"); mkdir($maildir . "nnmaildir/marks/reply/"); foreach (keys %message) { if($message{$_} =~ /S/) { $file = $maildir . ".nnmaildir/marks/read/" . $_; open(TOUCH,'>>',$file); close(TOUCH); } if($message{$_} =~ /R/) { $file = $maildir . ".nnmaildir/marks/reply/" . $_; open(TOUCH,'>>',$file); close(TOUCH); } } } --Boundary_(ID_HgRJ+EzBVF2qGOz+hl0Mqw) Content-type: TEXT/PLAIN; CHARSET=US-ASCII Content-transfer-encoding: 7BIT Bijan -- Bijan Soleymani http://www.crasseux.com --Boundary_(ID_HgRJ+EzBVF2qGOz+hl0Mqw)--