Re: Custom libs and upgrades (was Re: copy/paste model in exmh
Joel Hatton <[email protected]>
| Newsgroups | gmane.mail.exmh.user |
|---|---|
| Message-ID | <[email protected]> |
> Are your custom libs site-specific, or possibly something that can be used > by others? (Or is it possible to meet halfway, inserting a documented hook > for your stuff, because it's someplace that others would sensibly want to > do other stuff?) They're site-specific, mainly just to fire off some external in-house message processing utilities that we call from a custom menu - not particularly interesting to anyone else I'm afraid but they should be relatively easy to correct. I've attached a library that has some extra functions for some gpg activities that didn't seem to be available at the time I created it, but may be now - I haven't checked lately on this front. They could have just as easily been patched into one of the existing pgp* libs but we call it pgpMsg.tcl (and, like the others we have, actually keep it in a separate /lib directory and symlinked into the usual place) so it is easy to upgrade. Again, this is nothing spectacular, but I'd be pleased if this sort of functionality was in the standard installation (and someone let me know if it already is!) so feel free to use it. Usual warnings about caveat emptor apply, naturally. Oh, some usage: Msg_Forward_PGP_MIME -mime -form foo Msg_Forward_PGP -form bar and so on. cheers, joel _______________________________________________ Exmh-users mailing list [email protected] https://www.redhat.com/mailman/listinfo/exmh-users
pgpMsg.tcl
(text/plain, 5.6 KB)
proc Msg_Compose_PGP { args } {
global mhProfile pgp
if {[string length $args] == 0} {
set args Mh_CompSetup
}
# Create draft
if {![eval MsgComp $args]} {
return
}
# Setup PGP to do what I want
if $pgp(enabled) {
set id [Mh_Cur $mhProfile(draft-folder)]
if {$id == {}} {
Exmh_Status "No draft message available."
return
}
set pgp(sign,$id) clearsign
set pgp(encrypt,$id) 0
}
# Go do it
Edit_Draft
}
proc Msg_Compose_PGP_Encrypt { args } {
global mhProfile pgp
if {[string length $args] == 0} {
set args Mh_CompSetup
}
# Create draft
if {![eval MsgComp $args]} {
return
}
# Setup PGP to do what I want
if $pgp(enabled) {
set id [Mh_Cur $mhProfile(draft-folder)]
if {$id == {}} {
Exmh_Status "No draft message available."
return
}
set pgp(version,$id) gpg
set pgp(sign,$id) encryptsign
set pgp(encrypt,$id) 0
}
# Go do it
Edit_Draft
}
proc Msg_Reply_PGP { args } {
global exmh msg mhProfile pgp
if {[string length $args] == 0} {
set args Mh_ReplySetup
}
if [MsgOk $msg(id) m] {
Quote_MakeFile $exmh(folder) $m
set edit 1
Exmh_Status "repl $args" purple
if [catch {
set ix [lsearch $args -noedit]
if {$ix >= 0} {
set edit 0
set args [lreplace $args $ix $ix]
}
set ix [lsearch $args -form]
if {$ix < 0} {
set path [Mh_FindFile "replcomps"]
if {0 != [string length $path]} {
lappend args -form $path/replcomps
Exmh_Status "repl $args" purple
}
}
eval {MhExec repl +$exmh(folder) $m -nowhatnowproc} $args
eval {MhAnnoSetup $exmh(folder) $m repl} $args
} err] { ;# Setup draft msg
Exmh_Status "repl: $err" purple
Quote_Cleanup ;# Nuke @ link
return
}
# Setup PGP to do what I want
if $pgp(enabled) {
set id [Mh_Cur $mhProfile(draft-folder)]
if {$id == {}} {
Exmh_Status "No draft message available."
return
}
set pgp(sign,$id) clearsign
set pgp(encrypt,$id) 0
}
if {$edit} {
Edit_Draft ;# Run the editor
} else {
Edit_Done send ;# Just send it
}
}
}
proc Msg_Forward_PGP_MIME { args } {
global exmh msg mhProfile pgp
if {[string length $args] == 0} {
set args Mh_ForwSetup
}
set ids {}
Ftoc_Iterate line {
set msgid [Ftoc_MsgNumber $line]
if {$msgid != {}} {
lappend ids $msgid
}
}
if {[llength $ids] > 0} {
global mhProfile
set mime 0
if [info exists mhProfile(forw)] {
if {[lsearch $mhProfile(forw) -mime] >= 0} {
set mime 1
}
}
Exmh_Status "forw +$exmh(folder) $ids $args"
if [catch {
if {[lsearch $args -mime] >= 0} {
set mime 1
}
set ix [lsearch $args -form]
if {$ix < 0} {
if [file exists $mhProfile(path)/$exmh(folder)/forwcomps] {
lappend args -form $exmh(folder)/forwcomps
Exmh_Status "forw +$exmh(folder) $ids $args"
}
}
eval {MhExec forw +$exmh(folder)} $ids -nowhatnowproc $args
eval {MhAnnoSetup $exmh(folder) $ids forw} $args
if {$mhProfile(forwtweak)} {
Mh_Forw_MungeSubj $exmh(folder) $ids
}
} err] {
Exmh_Status "forw: $err" purple
return
}
# sedit hack
global sedit
set old $sedit(mhnDefault)
if {$mime} {set sedit(mhnDefault) 1}
# Setup PGP to do what I want
if $pgp(enabled) {
set id [Mh_Cur $mhProfile(draft-folder)]
if {$id == {}} {
Exmh_Status "No draft message available."
return
}
set pgp(format,$id) pm
set pgp(sign,$id) clearsign
set pgp(encrypt,$id) 0
}
Edit_Draft ;# Run the editor
set sedit(mhnDefault) $old
}
}
proc Msg_Forward_PGP { args } {
global exmh msg mhProfile pgp
if {[string length $args] == 0} {
set args Mh_ForwSetup
}
set ids {}
Ftoc_Iterate line {
set msgid [Ftoc_MsgNumber $line]
if {$msgid != {}} {
lappend ids $msgid
}
}
if {[llength $ids] > 0} {
global mhProfile
set mime 0
if [info exists mhProfile(forw)] {
if {[lsearch $mhProfile(forw) -mime] >= 0} {
set mime 1
}
}
Exmh_Status "forw +$exmh(folder) $ids $args"
if [catch {
if {[lsearch $args -mime] >= 0} {
set mime 1
}
set ix [lsearch $args -form]
if {$ix < 0} {
if [file exists $mhProfile(path)/$exmh(folder)/forwcomps] {
lappend args -form $exmh(folder)/forwcomps
Exmh_Status "forw +$exmh(folder) $ids $args"
}
}
eval {MhExec forw +$exmh(folder)} $ids -nowhatnowproc $args
eval {MhAnnoSetup $exmh(folder) $ids forw} $args
if {$mhProfile(forwtweak)} {
Mh_Forw_MungeSubj $exmh(folder) $ids
}
} err] {
Exmh_Status "forw: $err" purple
return
}
# sedit hack
global sedit
set old $sedit(mhnDefault)
if {$mime} {set sedit(mhnDefault) 1}
# Setup PGP to do what I want
if $pgp(enabled) {
set id [Mh_Cur $mhProfile(draft-folder)]
if {$id == {}} {
Exmh_Status "No draft message available."
return
}
set pgp(sign,$id) clearsign
set pgp(encrypt,$id) 0
set pgp(format,$id) plain
}
Edit_Draft ;# Run the editor
set sedit(mhnDefault) $old
}
}