<<< Date Index >>>     <<< Thread Index >>>

Re: fcc-hooks for nested groups of addresses



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday, July 28 at 03:31 PM, quoth Ludo Pagie:
> I recently switched from pine to mutt and have a bunch of things I 
> would like to settle in mutt. But one at a time.

Welcome!

> I use aliases to define some groups of addresses I regularly use.  
> Some of these groups are subgroups of other groups, or partially 
> overlap.

Unless you use these alias "groups" to *send* mail (and maybe even 
then), I think you probably want to use mutt's own "groups" feature.

> For all these separate groups I want to write FCC to files named 
> after the alias. But also for the individual members of these groups 
> I want to write FCC when I write mail to each of them personally.

Sounds reasonable.

> So, I want something like the following:
>
> alias a1 a1@xxxxxxxxxxx 
> alias a2 a2@xxxxxxxxxxx 
> alias a3 a3@xxxxxxxxxxx 
> alias a12 a1, a2 
> alias a123 a1,a2,a3 
> fcc-hook '^~C a1@xxxxxxxxxxx' +a1 
> fcc-hook '^~C a2@xxxxxxxxxxx' +a2 
> fcc-hook '^~C a3@xxxxxxxxxxx' +a3 
> fcc-hook '^(~C a1@xxxxxxxxxxx ~C a2@xxxxxxxxxxx)' =a12 
> fcc-hook '^~C a[123]@example.org' =a123

Try this:

alias -group a12 -group a123 a1 <a1@xxxxxxxxxxx>
alias -group a12 -group a123 a2 <a2@xxxxxxxxxxx>
alias -group a123 a3 <a3@xxxxxxxxxxx>
fcc-hook '^~C a1@xxxxxxxxxxx' =a1
fcc-hook '^~C a2@xxxxxxxxxxx' =a2
fcc-hook '^~C a3@xxxxxxxxxxx' =a3
fcc-hook '^%C a12' =a12
fcc-hook '^%C a123' =a123

So, if you send to a1, it gets caught by the first hook. Send to a2, 
it gets caught by the second hook. Send to a1 and a2, and it'll get 
caught by the a12 hook. Of course, this only works because there are 
only two members of a12.

The real problem here is that the a123 rule (or any group rule with 
more than two members) triggers even if only  some of the members of 
group a123 are present. For example, if you send to a1 and a3, it 
won't get caught by any of the previous hooks, but will be caught by 
the a123 hook. The only thing the ^ guarantees is that all addresses 
you're sending to are in the a123 group (which, in this case, they 
are).

There isn't a really *simple* way of doing that. The only ways I can 
think of to guarantee that all members of the group are present end up 
long and need to be modified every time you modify a group (which is a 
bit of a pain). Something like this:

fcc-hook '~C a1@xxxxxxxxxxx ~C a2@xxxxxxxxxxx ~C a3@xxxxxxxxxxx ^%C a123' =a123

Literally, what that says is:

     1. The message must be addressed to a1
     2. The message must be addressed to a2
     3. The message must be addressed to a3
     4. The message must not be addressed to anyone else

But this idea of group expansion such that all members of a group must 
be present is interesting. You may want to file a feature-request with 
the developers. Maybe syntax like "%^ GROUP"

~Kyle
- -- 
If man was meant to be nude, he would have been born that way.
                                                         -- Oscar Wilde
-----BEGIN PGP SIGNATURE-----
Comment: Thank you for using encryption!

iEYEARECAAYFAkiN7QcACgkQBkIOoMqOI15irgCfYTvBg6cUoGyaVSga1LzP6crD
EIYAnj+FiAnv+8BWVq3+QjxfWeWbZkuI
=+QzG
-----END PGP SIGNATURE-----