CardDAV addressbook support?

2011-03-11 Thread Thomas Klausner
Hi!

I googled and searched the wiki but didn't find any reference to using
a CardDAV addressbook with mutt.

Has someone implemented this already?

Thanks,
 Thomas


Default save-mbox for list email

2011-03-11 Thread Thomas Klausner
Hi!

Is there a way to set the default "save" mailbox depending on if the
mail went to a list or not? I've already "subscribe"d the list in the
config file.

I tried playing around with (fcc-)save-hook, but didn't manage.

For example, mail sent to "com...@example.org" should be saved to
~/Mail/example-commits by default.
 Thomas


Re: Default save-mbox for list email

2011-03-11 Thread Thomas Klausner
Ok, my original question doesn't make sense without more context:
.aliases:alias example-dev EXAMPLE Development 
.mutt-hooks:save-hook example-...@example.com =example/gras
.mutt-hooks:save-hook .*@example.com =example/received
.muttrc:subscribe example-dev
.muttrc.example:mailboxes =example/incoming =example/svn =example/example-dev

When I try to save a mail from .*@example.com to
example-...@example.com, mutt suggests "=example-dev" and I don't
understand why. What am I missing?
 Thomas


Re: rsync removes the "N" from mailboxes with new mail

2011-03-11 Thread Chris G
On Tue, Mar 08, 2011 at 03:26:41PM -0600, Derek Martin wrote:
> On Tue, Mar 08, 2011 at 09:11:59PM +, Chris G wrote:
> > On Tue, Mar 08, 2011 at 02:50:26PM -0600, Derek Martin wrote:
> > > On Tue, Mar 08, 2011 at 06:29:47PM +, Chris G wrote:
> > > > On Tue, Mar 08, 2011 at 10:54:23AM -0600, Derek Martin wrote:
> > > > > On Mon, Mar 07, 2011 at 03:37:45PM -0800, John Magolske wrote:
> > > > > > After doing an rsync backup, the "N" preceding mailboxes with new 
> > > > > > mail
> > > > > > is removed from all mailboxes. I suppose this is a result of the 
> > > > > > mbox
> > > > > > files being touched somehow by the rsync process. Is there any way 
> > > > > > to
> > > > > > prevent this?
> > > > > 
> > > > > Use rsync -t.  This preserves the file modification times on the
> > > > > mailboxes.  Note that it may be possible that there will be a race
> > > > > condition causing mail folders which have mail delivered during the
> > > > > rsync to not show new mail.  If this happens at all, it will most
> > > > > likely be pretty rare (i.e. it will still be much better than losing
> > > > > the N flag on *all* mailboxes every time).
> > > > > 
> > > > Surely "rsync -t" means *copy* the modification time to the destination,
> > > > what the OP wants is to preserve the modification and access times of
> > > > the source files being copied (I think).
> > > 
> > > Surely you are mistaken.  :)
> > > 
> > In what the "rsync -t" means or in what the OP wanted?  :-)
> 
> The former.  It does what I said, and (at least when the destination
> is local and you do not specify an alternative program to use) does
> *not* do what you said, though I admit, it seems like it ought to, or
> that there should be two separate flags that control access time
> preservation for each source and destination files.  If you don't
> believe me, try it... then run stat on all the files you copied.
> I did.
> 
Er, surely copying a file won't change the modification time of the
copied file anyway will it?

-- 
Chris Green


Re: rsync removes the "N" from mailboxes with new mail

2011-03-11 Thread Chris G
On Tue, Mar 08, 2011 at 02:40:06PM -0800, John Magolske wrote:
> * Chris G  [110308 14:30]:
> > On Tue, Mar 08, 2011 at 02:50:26PM -0600, Derek Martin wrote:
> > > On Tue, Mar 08, 2011 at 06:29:47PM +, Chris G wrote:
> > > > On Tue, Mar 08, 2011 at 10:54:23AM -0600, Derek Martin wrote:
> > > > > On Mon, Mar 07, 2011 at 03:37:45PM -0800, John Magolske wrote:
> > > > > > After doing an rsync backup, the "N" preceding mailboxes with new 
> > > > > > mail
> > > > > > is removed from all mailboxes. I suppose this is a result of the 
> > > > > > mbox
> > > > > > files being touched somehow by the rsync process. Is there any way 
> > > > > > to
> > > > > > prevent this?
> > > > > 
> > > > > Use rsync -t.  This preserves the file modification times on the
> > > > > mailboxes.  Note that it may be possible that there will be a race
> > > > > condition causing mail folders which have mail delivered during the
> > > > > rsync to not show new mail.  If this happens at all, it will most
> > > > > likely be pretty rare (i.e. it will still be much better than losing
> > > > > the N flag on *all* mailboxes every time).
> > > > > 
> > > > Surely "rsync -t" means *copy* the modification time to the destination,
> > > > what the OP wants is to preserve the modification and access times of
> > > > the source files being copied (I think).
> > > 
> > > Surely you are mistaken.  :)
> > > 
> > In what the "rsync -t" means or in what the OP wanted?  :-)
> > 
> > OP, tell us what you want, do you want the *original* mailboxes to be
> > 'N' still or do you want the copies to have the 'N'?
> 
> I'd like the original (source) mailboxes to retain their N's, I'm not
> concerned about copying over this to the backup copy.
> 
That's because rsync is changing the *access* time of the 'source'
mailboxes isn't it, I'm not sure you can stop it doing this.

-- 
Chris Green


Re: how to set a default subject via send-hook?

2011-03-11 Thread Will Fiveash
On Thu, Mar 10, 2011 at 09:40:17PM -0400, Monte Stevens wrote:
> On Thu, Mar 10, 2011 at 07:11:19PM -0600, Will Fiveash wrote:
> > 
> > I'm talking about when I create mail for a particular recipient I want
> > the Subject: set.  Like this:
> > 
> > $ mutt expe...@foo.com
> > 
> > and when mutt launched my editor (vim) I would see in the message
> > template I'm editing:
> > 
> >  From: Will Fiveash 
> >  To: expe...@foo.com
> >  Cc: 
> >  Bcc: 
> >  Subject: Expense Report #
> >  Reply-To: 
> 
> 
> OK, if you're calling mutt from a shell, you can replace 'mutt' with
> 'mutt.sh', where mutt.sh contains something like:
> 
> case "$1" in
> expe...@foo.com)
>   /usr/bin/mutt -s "Expense Report # " "$1"
> ;;
> mark.h...@oracle.com)
>   /usr/bin/mutt -s "Nice tie" "$1"
> ;;
> esac

I thought about that but it's not a general enough solution because I
sometime create a new e-mail via a running mutt session (using the 'm'
command).

-- 
Will Fiveash


Re: rsync removes the "N" from mailboxes with new mail

2011-03-11 Thread Derek Martin
On Fri, Mar 11, 2011 at 05:49:23PM +, Chris G wrote:
> On Tue, Mar 08, 2011 at 03:26:41PM -0600, Derek Martin wrote:
> > The former.  It does what I said, and (at least when the destination
> > is local and you do not specify an alternative program to use) does
> > *not* do what you said, though I admit, it seems like it ought to, or
> > that there should be two separate flags that control access time
> > preservation for each source and destination files.  If you don't
> > believe me, try it... then run stat on all the files you copied.
> > I did.
> > 
> Er, surely copying a file won't change the modification time of the
> copied file anyway will it?

No, it does not change the modification time.  However it does change
the *access time*, which mutt compares to the modification time to
determine if the mailbox contains new mail.  It uses this shortcut
instead of parsing the file to determine if a mailbox contains new
mail, because it's much faster and reasonably (but not completely)
reliable.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



pgp9u5JbJcdA5.pgp
Description: PGP signature


Re: rsync removes the "N" from mailboxes with new mail

2011-03-11 Thread Derek Martin
On Fri, Mar 11, 2011 at 05:50:34PM +, Chris G wrote:
> On Tue, Mar 08, 2011 at 02:40:06PM -0800, John Magolske wrote:
> > I'd like the original (source) mailboxes to retain their N's, I'm not
> > concerned about copying over this to the backup copy.
> > 
> That's because rsync is changing the *access* time of the 'source'
> mailboxes isn't it, I'm not sure you can stop it doing this.

YOU ABSOLUTELY CAN, by using rsync -t as I've said several times now.

Please pay attention:

$ mkdir rsyncto
$ stat rsyncfrom/*
  File: `rsyncfrom/bar'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41984   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500
  File: `rsyncfrom/baz'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41985   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500
  File: `rsyncfrom/foo'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41983   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500

$ rsync -t rsyncfrom/* rsyncto/
$ stat rsyncto/*
  File: `rsyncto/bar'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 736801  Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-11 15:11:12.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-11 15:11:12.0 -0500
  File: `rsyncto/baz'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 736802  Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-11 15:11:12.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-11 15:11:12.0 -0500
  File: `rsyncto/foo'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 736803  Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-11 15:11:12.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-11 15:11:12.0 -0500

$ stat rsyncfrom/*
  File: `rsyncfrom/bar'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41984   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500
  File: `rsyncfrom/baz'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41985   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500
  File: `rsyncfrom/foo'
  Size: 0   Blocks: 0  IO Block: 4096   regular empty file
Device: 805h/2053d  Inode: 41983   Links: 1
Access: (0644/-rw-r--r--)  Uid: (24574/demartin)   Gid: (  600/   staff)
Access: 2011-03-08 15:45:52.0 -0500
Modify: 2011-03-08 15:45:52.0 -0500
Change: 2011-03-08 15:45:52.0 -0500

When the rsync runs, the files are copied, and the copies retain
*only* the modification time of the original; the access and change
time of the copied files are different (not preserved from the
original files).

HOWEVER, NONE OF THE TIMES OF THE SOURCE FILES HAVE BEEN UPDATED.

So, as I've already said several times now, rsync -t absolutely is the
solution.

-- 
Derek D. Martinhttp://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.



pgpJ7pAtVozFF.pgp
Description: PGP signature


Re: rsync removes the "N" from mailboxes with new mail

2011-03-11 Thread Richard
On Fri, Mar 11, 2011 at 05:50:34PM +, Chris G wrote:
> On Tue, Mar 08, 2011 at 02:40:06PM -0800, John Magolske wrote:
> > * Chris G  [110308 14:30]:
> > > On Tue, Mar 08, 2011 at 02:50:26PM -0600, Derek Martin wrote:
> > > > On Tue, Mar 08, 2011 at 06:29:47PM +, Chris G wrote:
> > > > > On Tue, Mar 08, 2011 at 10:54:23AM -0600, Derek Martin wrote:
> > > > > > On Mon, Mar 07, 2011 at 03:37:45PM -0800, John Magolske wrote:
> > > > > > > After doing an rsync backup, the "N" preceding mailboxes with new 
> > > > > > > mail
> > > > > > > is removed from all mailboxes. I suppose this is a result of the 
> > > > > > > mbox
> > > > > > > files being touched somehow by the rsync process. Is there any 
> > > > > > > way to
> > > > > > > prevent this?
> > > > > > 
> > > > > > Use rsync -t.  This preserves the file modification times on the
> > > > > > mailboxes.  Note that it may be possible that there will be a race
> > > > > > condition causing mail folders which have mail delivered during the
> > > > > > rsync to not show new mail.  If this happens at all, it will most
> > > > > > likely be pretty rare (i.e. it will still be much better than losing
> > > > > > the N flag on *all* mailboxes every time).
> > > > > > 
> > > > > Surely "rsync -t" means *copy* the modification time to the 
> > > > > destination,
> > > > > what the OP wants is to preserve the modification and access times of
> > > > > the source files being copied (I think).
> > > > 
> > > > Surely you are mistaken.  :)
> > > > 
> > > In what the "rsync -t" means or in what the OP wanted?  :-)
> > > 
> > > OP, tell us what you want, do you want the *original* mailboxes to be
> > > 'N' still or do you want the copies to have the 'N'?
> > 
> > I'd like the original (source) mailboxes to retain their N's, I'm not
> > concerned about copying over this to the backup copy.
> > 
> That's because rsync is changing the *access* time of the 'source'
> mailboxes isn't it, I'm not sure you can stop it doing this.

one neat thing, in Linux you can control enable or disable setting of atime 
with 

chattr +A file
chattr -A file

works for directories as well.

Richard

---
Name and OpenPGP keys available from pgp key servers



Re: how to set a default subject via send-hook?

2011-03-11 Thread Monte Stevens
On Fri, Mar 11, 2011 at 12:38:03PM -0600, Will Fiveash wrote:
> On Thu, Mar 10, 2011 at 09:40:17PM -0400, Monte Stevens wrote:
> > On Thu, Mar 10, 2011 at 07:11:19PM -0600, Will Fiveash wrote:
> > > 
> > > I'm talking about when I create mail for a particular recipient I want
> > > the Subject: set.  Like this:
> > > 
> > > $ mutt expe...@foo.com
> > > 
> > > and when mutt launched my editor (vim) I would see in the message
> > > template I'm editing:
> > > 
> > >  From: Will Fiveash 
> > >  To: expe...@foo.com
> > >  Cc: 
> > >  Bcc: 
> > >  Subject: Expense Report #
> > >  Reply-To: 
> > 
> > 
> > OK, if you're calling mutt from a shell, you can replace 'mutt' with
> > 'mutt.sh', where mutt.sh contains something like:
> > 
> > case "$1" in
> > expe...@foo.com)
> >   /usr/bin/mutt -s "Expense Report # " "$1"
> > ;;
> > mark.h...@oracle.com)
> >   /usr/bin/mutt -s "Nice tie" "$1"
> > ;;
> > esac
> 
> I thought about that but it's not a general enough solution because I
> sometime create a new e-mail via a running mutt session (using the 'm'
> command).

OK, try the below.  I tested it once on expe...@foo.com and it did what
I expected it to. (I also adjusted a bit after testing so I hope it
still works.)


set editor=new-mutt-message.sh

contents of new-mutt-message.sh...

#!/bin/bash

FILE="$1"
DIR=$(echo "$1" | grep -o '.*\/')
TMP=$(echo "$1" | grep -o '[^\/]*$')

cd "$DIR"
csplit -qf "$TMP.parts" "$TMP" '/^$/'
RECIP=$(cat $TMP.parts00 | grep -im 1 '^To: ' | sed 's/To: \(.*\)/\1/')

case "$RECIP" in
expe...@foo.com)
sed -i 's/^Subject: .*/Subject: Expense Report # /' "$TMP"
;;
mark.h...@oracle.com)
sed -i 's/^Subject: .*/Subject: Did you bring a lunch?/' "$TMP"
;;
esac

rm $TMP.parts*
$EDITOR $TMP


Re: Default save-mbox for list email

2011-03-11 Thread Michael Elkins

On Fri, Mar 11, 2011 at 06:23:55PM +0100, Thomas Klausner wrote:

Ok, my original question doesn't make sense without more context:
.aliases:alias example-dev EXAMPLE Development 
.mutt-hooks:save-hook example-...@example.com =example/gras
.mutt-hooks:save-hook .*@example.com =example/received
.muttrc:subscribe example-dev
.muttrc.example:mailboxes =example/incoming =example/svn =example/example-dev

When I try to save a mail from .*@example.com to
example-...@example.com, mutt suggests "=example-dev" and I don't
understand why. What am I missing?


If the pattern specified in a save-hook doesn't explicitly have an
operator, it gets expanded by $simple_search, which by default only
searches the From: address and subject.  You need to use this instead:

save-hook '~C example-...@example.com' =example/gras

me
~