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

Re: Unsetting GPG after setting it with send-hook



* Kyle Wheeler <kyle-mutt@xxxxxxxxxxxxxx>:
> On Friday, October  6 at 01:43 PM, quoth Patrick Ben Koetter:
> >Any idea what I am missing? Should I use
> >
> >    send-hook . unset pgp_autoencrypt
> >
> >to set things back to normal?
> 
> Yup. Generally, when you set something with a particular hook, you 
> usually want to set it back to your default with the same sort of 
> hook. Keep in mind: folder hooks only get triggered when you change 
> folders, while send-hooks get triggered whenever you send a message. 
> Thus, if you set pgp_autoencrypt in a send hook and unset it in a 
> folder hook, once it is set it will only become unset once you change 
> folders.

Ah! That explains it very well.


> One gotcha, however, is that the ordering of hooks in your muttrc is 
> important. For example, this will not do what you want:
> 
>     send-hook '~C pgpguy' set pgp_autoencrypt
>     send-hook . unset pgp_autoencrypt
> 
> While this will:
> 
>     send-hook . unset pgp_autoencrypt
>     send-hook '~C pgpguy' set pgp_autoencrypt
> 
> The reason is that in the first case, when you compose a message to 
> "pgpguy", mutt will see that it matches the first hook, and will set 
> pgp_autoencrypt. Then it will see that it matches the second hook, and 
> will unset pgp_autoencrypt. In the second one, however, it will be 
> just the reverse, and so will do what you want: normal messages will 
> only match the first hook and not the second, while messages to pgpguy 
> will match both, and will be encrypted.

Thanks for taking the time to explain that at this length.

p@rick

-- 
Das Postfix-Buch
<http://www.postfix-buch.com>
saslfinger (debugging SMTP AUTH):
<http://postfix.state-of-mind.de/patrick.koetter/saslfinger/>