Re: unable to use send2-hook / group pattern for automatic

2007-11-07 Thread Gregor Zattler
Hi Kyle,

thank you very much for your help especially with respect to
infinite loops (I was traped in one).

* Kyle Wheeler [EMAIL PROTECTED] [05. Nov. 2007]:
 Don't trigger the hook except on messages that are not already 
 signed/encrypted:
 
  send2-hook '!~g !~G ^%C gpg-full' 'push pgp-menub'
 
 Then, of course, you want to disable things if you have other non-pgp 
 recipients, so you need another hook:
 
  send2-hook '(~G|~g) !~%C gpg-full' 'push pgp-menuf'
^ ^
The ~ in the second hooks pattern is a typo: ^ is what I
need.  I now have:

   send-hook . set crypt_autosign=no
   
   send-hook . set crypt_autoencrypt=no
   send-hook ^%Cgpg-full set crypt_autosign=yes
   send-hook ^%Cgpg-full set crypt_autoencrypt=yes
   
   send2-hook '!~g !~G ^%C gpg-full' 'push pgp-menub'
   send2-hook '(~G|~g) !^%C gpg-full' 'push pgp-menuc'

in my muttrc.  

 But that's relatively easy. The REALLY fancy stuff comes when you have 
 friends who are pine users and thus CANNOT use PGP-MIME and so require 
 *inline* pgp all the dang time. This is tough to do in mutt because 
 there's no pattern to match messages that use inline pgp signatures, 
 but it can be done. Any guesses how it's done? ;)
 
 (hint: think $my_* variables)

Puh! That's over my head.  My correspondents have to cope with my
PGP/MIME formatted emails or I'll have to tweak this with
per-user settings for now.

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-


Re: unable to use send2-hook / group pattern for automatic

2007-11-06 Thread Todd Zullinger
Gregor Zattler wrote:
 I configured a group gpg-full which matches all emailaddresses to
 which a valid gpg key exists in my keyring.  I'm able for instance
 to search for emails matching %Cgpg-full in the index and the scroll
 bar jumps to the next message which is addressed to somebody who's
 gpg key I trust.
 
 I want to use this group feature to switch encryption on and off
 depending on emailaddresses:

FWIW, another way I think you can achieve your goal is to use Nicolas
Rachinsky's crypt-autohook patch[1].  (Many thanks Nicolas!)

[1] http://www.rachinsky.de/nicolas/mutt.shtml

-- 
ToddOpenPGP - KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~
Wisdom has two parts: (1) having a lot to say and (2) not saying it.



pgpTQA025ecfj.pgp
Description: PGP signature


Re: unable to use send2-hook / group pattern for automatic

2007-11-06 Thread Nicolas Rachinsky
* Todd Zullinger [EMAIL PROTECTED] [2007-11-06 02:47 -0500]:
 Gregor Zattler wrote:
  I want to use this group feature to switch encryption on and off
  depending on emailaddresses:
 
 FWIW, another way I think you can achieve your goal is to use Nicolas
 Rachinsky's crypt-autohook patch[1].  (Many thanks Nicolas!)

I'm glad to hear that someone uses this patch. But I'm afraid it does
not solve the original poster's problem. The crypt-autohook patch
works at the same time send-hooks. I want to extend it to be able to
work together with send2-hooks, but until now I haven't found the time
to do it.

Nicolas

-- 
http://www.rachinsky.de/nicolas


unable to use send2-hook / group pattern for automatic encryption

2007-11-05 Thread Gregor Zattler
Dear Mutt users,

I configured a group gpg-full which matches all emailaddresses
to which a valid gpg key exists in my keyring.  I'm able for
instance to search for emails matching %Cgpg-full in the index
and the scroll bar jumps to the next message which is addressed
to somebody who's gpg key I trust.

I want to use this group feature to switch encryption on and off
depending on emailaddresses:

send2-hook . set crypt_autosign=no
send2-hook . set crypt_autoencrypt=no
send2-hook ^%Cgpg-full set crypt_autosign=yes
send2-hook ^%Cgpg-full set crypt_autoencrypt=yes

Accroding to the fine manual [...] patterns matching 'lists' of
addresses (notably c,C,p,P and t) match if there is at least one
match in the whole list. If you want to make sure that all
elements of that list match, you need to prefix your pattern with
^.  Therefore the pattern should only match emails which are
adressed only to fully trusted recipients.

The manual states: send2-hook is matched every time a
message is changed, either by editing it, or by using the compose
menu to change its recipients or subject.  Therefore the
encryption status should be evaluated every time I edit the email.

But this does not happen: When I compose a new email with this
configuration encryption is enabled when I enter a adress which
is a member of the group gpg-full at the prompt.  But it is *not*
disabled when I add the address of a non-member later.  It is
also not enabled when I address an email to a non-member and
later exchange this non-member with the address of a member.

Could someone please enlight me what's wrong with this
send2-hooks?

Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-


Re: unable to use send2-hook / group pattern for automatic

2007-11-05 Thread Kyle Wheeler
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Monday, November  5 at 05:01 PM, quoth Gregor Zattler:
 I want to use this group feature to switch encryption on and off 
 depending on emailaddresses:

:) I do that a lot myself.

 send2-hook . set crypt_autosign=no
 send2-hook . set crypt_autoencrypt=no
 send2-hook ^%Cgpg-full set crypt_autosign=yes
 send2-hook ^%Cgpg-full set crypt_autoencrypt=yes

These are bad hooks for several reasons. 

 The manual states: send2-hook is matched every time a message is 
 changed, either by editing it, or by using the compose menu to 
 change its recipients or subject.

Other changes trigger a send2-hook as well, such as every time a 
message's encryption status is changed. If the action you've specified 
did what you thought it did, you'd have essentially put mutt into an 
infinite loop.

 Therefore the encryption status should be evaluated every time I 
 edit the email.

Wrong. Configuration variables are ONLY consulted when setting up an 
email for the first time. You can think of them as defaults. Changing 
their value from the compose menu does not affect the message you are 
sending. The way to change whether a message is going to be encrypted 
or not from the compose menu is to use the pgp-menu that's right there 
in the middle of the screen rather than by changing configuration 
variables.

As an example, this would be more effective (DO NOT USE THIS HOOK! YOU 
WILL CREATE AN INFINITE LOOP IN MUTT!):

 send2-hook '^%C gpg-full' 'push pgp-menus'

Now, since we are actually getting something to happen now, the real 
question becomes: how do we avoid the infinite loop? Well, that's 
easy! Don't trigger the hook except on messages that are not already 
signed/encrypted:

 send2-hook '!~g !~G ^%C gpg-full' 'push pgp-menub'

Then, of course, you want to disable things if you have other non-pgp 
recipients, so you need another hook:

 send2-hook '(~G|~g) !~%C gpg-full' 'push pgp-menuf'

Exactly what you do, of course, depends on the behavior you want. For 
example, I prefer to sign *ALL* of my messages just to subtly 
encourage people to use encryption, but I only want to encrypt 
messages to people that do use encryption. Thus, I use the following 
hooks:

# note that this works because it triggers before $crypt_autoencrypt 
# is consulted by mutt
send-hook '!~G ^%C pgp' 'set crypt_autoencrypt=yes' 
# this one makes the above a little more active
send2-hook '((~g !~G)|(~G !~g)) ^%C pgp' 'push pgp-menub'
# this one makes sure that people who can't read it won't get 
# encrypted mail
send2-hook '~G !^%C pgp' 'push pgp-menus'

But that's relatively easy. The REALLY fancy stuff comes when you have 
friends who are pine users and thus CANNOT use PGP-MIME and so require 
*inline* pgp all the dang time. This is tough to do in mutt because 
there's no pattern to match messages that use inline pgp signatures, 
but it can be done. Any guesses how it's done? ;)

(hint: think $my_* variables)

~Kyle
- -- 
A man cannot be held responsible for what his mind does while he's 
asleep.
 -- Jean Luc Picard
-BEGIN PGP SIGNATURE-
Comment: Thank you for using encryption!

iD8DBQFHL0eQBkIOoMqOI14RAkHYAKDwLp1pEIEHWTza9ZPMmy+jmc6AygCghP4Z
6n/HKx5qKUdBo3ODF+TNahQ=
=1q7y
-END PGP SIGNATURE-