PGP key selection (Was Re: automatically changing email address...)

2000-10-26 Thread Dave Ewart

On Wednesday, 25.10.2000 at 21:24 -0400, Josh Huber wrote:

 ...
 Another (completely unrelated) question I had was regarding the PGP
 support.  I've been using it for a while now, but I'd like to have
 some way to select a key for encryption automatically.  Well, it does
 already do that, but I still get a list of all the uids listed for the
 GPG key.  Selecting any of them works because gpg automatically
 selects the right key for encryption, but automatically having this
 done would be nice.  I immagine this could be done with a macro, but
 is there a cleaner solution?

I've posted about this in the past, and I don't think I've ever seen any
suggestions, macros, or workarounds for this problem ...  Even if you
specify the key-ID to use in a "pgp-hook", it _still_ gives you this
prompt, which seems bizarre ...

Dave.
-- 
Dave Ewart
[EMAIL PROTECTED]
Computing Manager
ICRF Cancer Epidemiology Unit, Oxford UK

 PGP signature


Re: PGP key selection (Was Re: automatically changing email address...)

2000-10-26 Thread Josh Huber

On Thu, Oct 26, 2000 at 11:51:42AM +0100, Dave Ewart wrote:
 I've posted about this in the past, and I don't think I've ever seen any
 suggestions, macros, or workarounds for this problem ...  Even if you
 specify the key-ID to use in a "pgp-hook", it _still_ gives you this
 prompt, which seems bizarre ...

Yes, I've gone so far as to wrap the output of gpg so that only one
key show up as selectable, but most of the time mutt segfaulted.  I
didn't have enough time to look into it, so I'm not sure what I was
missing from the gpg output format to make mutt happy.

ttyl,

-- 
Josh Huber   | [EMAIL PROTECTED] |
1024D/6B21489A 61F0 6138 BE7B FEBF A223  E9D1 BFE1 2065 6B21 489A

 PGP signature


Re: automatically changing email address...

2000-10-26 Thread Mikko Hänninen

Josh Huber [EMAIL PROTECTED] wrote on Wed, 25 Oct 2000:
 I'm using the following rules to differentiate between internal work
 email and external email.  I'd like however, to be able to bind a key
 (for example, 'M') to mean send but always use my work email address
 as the From: header.

Well, here's a suggested solution:
1) put all your send-hook commands in a separate muttrc-style file
2) make "M" into a macro that
   - does "unhook send-hook"
   - sets up your From header (my_hdr From ... or set from=...)

Then you also need some method to restore the settings.  The easiest
solution would be to set up a macro that just reads the send-hook file
again, and undoes whatever settings you did in the M-macro.  But that's
not automatic.

If you want to automatically restore the settings once that email has
been finished, it does get quite tricky.  There's no way to make a macro
that will "do this, then send email, and after the 'send email' step has
completed, do this".  But, there is only a limited amount of ways you
can get out of the compose menu.  You just have to create macros for all
the possible exit keys in the compose menu, that restore your usual
setup.  They could also un-macro all the compose menu bindings, although
that's strictly speaking not necessary (it won't hurt to leave them in
every time).


I hope this helps,
Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy  scifi, the Corrs /
It really is just the little things that bug a person.



Re: automatically changing email address...

2000-10-26 Thread Josh Huber

On Thu, Oct 26, 2000 at 04:06:31PM +0300, Mikko H?nninen wrote:
 Well, here's a suggested solution:
 1) put all your send-hook commands in a separate muttrc-style file
 2) make "M" into a macro that
- does "unhook send-hook"
- sets up your From header (my_hdr From ... or set from=...)
 
 Then you also need some method to restore the settings.  The easiest
 solution would be to set up a macro that just reads the send-hook file
 again, and undoes whatever settings you did in the M-macro.  But that's
 not automatic.

Hmm, ok...

How about I just make it always set the values depending on what I
press:

bind index Y mail
bind index E reply
macro index m ":source ~/.mutt/autoselect^mY"
macro index M ":source ~/.mutt/workselect^mY"
macro index r ":source ~/.mutt/autoselect^mE"
macro index R ":source ~/.mutt/workselect^mE"

~/.mutt/autoselect:
source ~/.mutt/send-hook.default
# send hooks to automatically select From: header

~/.mutt/workselect:
source ~/.mutt/send-hook.default
send-hook . my_hdr From: ...

more brute force, but less of a pain to implement? (haven't tried it
yet though)

 If you want to automatically restore the settings once that email has
 been finished, it does get quite tricky.  There's no way to make a macro
 that will "do this, then send email, and after the 'send email' step has
 completed, do this".  But, there is only a limited amount of ways you
 can get out of the compose menu.  You just have to create macros for all
 the possible exit keys in the compose menu, that restore your usual
 setup.  They could also un-macro all the compose menu bindings, although
 that's strictly speaking not necessary (it won't hurt to leave them in
 every time).

This, I think, would be more trouble than it's worth...

-- 
Josh Huber   | [EMAIL PROTECTED] |
1024D/6B21489A 61F0 6138 BE7B FEBF A223  E9D1 BFE1 2065 6B21 489A

 PGP signature


Re: automatically changing email address...

2000-10-26 Thread Josh Huber

On Thu, Oct 26, 2000 at 04:06:31PM +0300, Mikko H?nninen wrote:
[snip]

Here's what I ended up doing:

# ~/.mutt/sending
bind index Y mail
bind index E reply
bind index H group-reply
macro index m ":source ~/.mutt/autoselect^mY"
macro index M ":source ~/.mutt/workselect^mY"
macro index r ":source ~/.mutt/autoselect^mE"
macro index R ":source ~/.mutt/workselect^mE"
macro index g ":source ~/.mutt/autoselect^mH"
macro index G ":source ~/.mutt/workselect^mH"


# ~/.mutt/autoselect
source ~/.mutt/send-hook.default

# work email (used internally)
send-hook (missioncriticallinux|mclinux|mclx).com my_hdr 'From: Josh Huber 
[EMAIL PROTECTED]'
send-hook (missioncriticallinux|mclinux|mclx).com 'set signature=~/.mutt/sig.work'

# mailing list setup
send-hook '~t debian-' my_hdr 'From: Josh Huber [EMAIL PROTECTED]
send-hook '~t mutt-' my_hdr 'From: Josh Huber [EMAIL PROTECTED]


# ~/.mutt/workselect
source ~/.mutt/send-hook.default

# work email (used internally)
send-hook . my_hdr 'From: Josh Huber [EMAIL PROTECTED]'
send-hook . 'set signature=~/.mutt/sig.work'


# ~/.mutt/send-hook.default

unhook send-hook

# gpg defaults
send-hook . 'set pgp_autosign=yes'
send-hook . 'set pgp_autosign=yes'
send-hook . 'set pgp_replysignencrypted=yes'
send-hook . 'set pgp_replyencrypt=yes'
send-hook . 'set pgp_replysignencrypted=yes'
send-hook . 'set pgp_replysign=yes'

# nightshade email (default)
send-hook . my_hdr From: Josh Huber [EMAIL PROTECTED]
send-hook . 'set signature=~/.mutt/sig.nightshade'

# don't use a sig or gnupg when dealing with listservs...
send-hook majordomo|listserv 'set pgp_autosign=no; set pgp_replysign=no'
send-hook majordomo|listserv 'set signature=""; set attribution=""'

Works great so far...

now for that pgp problem...

-- 
Josh Huber   | [EMAIL PROTECTED] |
1024D/6B21489A 61F0 6138 BE7B FEBF A223  E9D1 BFE1 2065 6B21 489A

 PGP signature


Re: automatically changing email address...

2000-10-26 Thread Mikko Hänninen

Josh Huber [EMAIL PROTECTED] wrote on Thu, 26 Oct 2000:
 How about I just make it always set the values depending on what I
 press:

That would work.

 macro index m ":source ~/.mutt/autoselect^mY"

You don't need to have a separate binding for the mail-function to Y,
you can just put "mail" instead there.

You will also have to remember to define macros for the pager, but I
guess you know that. :-)

 more brute force, but less of a pain to implement? (haven't tried it
 yet though)

I'd say that's a better solution actually, than what I suggested. :-)
Just don't forget the unhook's where appropriate.  Not that it won't
work without them, but send-hooks accumulate, so after writing a few
emails you will have quite a lot of various send-hooks defined, most
of which override previous send-hook definitions.  Not that I've ever
seen Mutt slow down because of using too many send-hooks, but it's a
good practice anyway to clean up after yourself. :-)


Mikko
-- 
// Mikko Hänninen, aka. Wizzu  //  [EMAIL PROTECTED]  //  http://www.iki.fi/wiz/
// The Corrs list maintainer  //   net.freak  //   DALnet IRC operator /
// Interests: roleplaying, Linux, the Net, fantasy  scifi, the Corrs /
"Scotty, beam us aboard."  "Aye, sir.  Will a 2x4 do?"



Re: automatically changing email address...

2000-10-26 Thread Josh Huber

On Thu, Oct 26, 2000 at 05:05:58PM +0300, Mikko H?nninen wrote:
 You don't need to have a separate binding for the mail-function to Y,
 you can just put "mail" instead there.

Ah, ok.  That's good to know.  Definately better than binding the
extra keys as I have been doing.

 You will also have to remember to define macros for the pager, but I
 guess you know that. :-)

Actually, thanks for reminding me. :)

 of which override previous send-hook definitions.  Not that I've ever
 seen Mutt slow down because of using too many send-hooks, but it's a
 good practice anyway to clean up after yourself. :-)

Yeah, I've been very happy with mutt's performance on dealing with
very large mailboxes, especially while threading the messages.

thanks again,

-- 
Josh Huber   | [EMAIL PROTECTED] |
1024D/6B21489A 61F0 6138 BE7B FEBF A223  E9D1 BFE1 2065 6B21 489A

 PGP signature


automatically changing email address...

2000-10-25 Thread Josh Huber

I've got a question for you guys,

I'm using the following rules to differentiate between internal work
email and external email.  I'd like however, to be able to bind a key
(for example, 'M') to mean send but always use my work email address
as the From: header.

# nightshade email (default)
send-hook . my_hdr From: Josh Huber [EMAIL PROTECTED]
send-hook . 'set signature=~/.mutt/sig.nightshade'

# work email (used internally)
send-hook (missioncriticallinux|mclinux|mclx).com my_hdr 'From: Josh Huber 
[EMAIL PROTECTED]'
send-hook (missioncriticallinux|mclinux|mclx).com 'set signature=~/.mutt/sig.work'

That works, but how could I override this (for just one message)?

Another (completely unrelated) question I had was regarding the PGP
support.  I've been using it for a while now, but I'd like to have
some way to select a key for encryption automatically.  Well, it does
already do that, but I still get a list of all the uids listed for the
GPG key.  Selecting any of them works because gpg automatically
selects the right key for encryption, but automatically having this
done would be nice.  I immagine this could be done with a macro, but
is there a cleaner solution?

Thanks,

-- 
Josh Huber   | [EMAIL PROTECTED] |
1024D/6B21489A 61F0 6138 BE7B FEBF A223  E9D1 BFE1 2065 6B21 489A

 PGP signature