]> diplodocus.org Git - nmh/blob - docs/contrib/replaliases
Added links to David Malone's MH 6.x archives.
[nmh] / docs / contrib / replaliases
1 #### replaliases
2 ####
3 #### convenience functions for various repl(1) commands
4 ####
5 #### They're functions instead of aliases for portability. This file
6 #### is intended to be sourced from a Bourne-compatible shell, e.g.,
7 #### source `mhparam docdir`/contrib/replaliases
8 #### to declare the functions.
9 ####
10 #### Author: David Levine <levinedl@acm.org>
11
12 #### If using par (see mhn.defaults), it helps to have its PARINIT
13 #### environment variable set. If you really want it to be null,
14 #### either comment this out or set it to, e.g., ' '.
15 #### Removed "R" from PARINIT recommendation in par(1) man page so
16 #### that it doesn't consider words that are too long to be an error.
17 if [ -z "$PARINIT" ]; then
18 PARINIT='rTbgq B=.,?_A_a Q=_s>|'
19 export PARINIT
20 fi
21
22
23 #### Reply, including text/html (converted to text/plain) and
24 #### text/plain parts.
25 ####
26 #### Optional arguments:
27 #### -h to disable conversion of text/html parts
28 #### -p to disable conversion of text/plain parts
29 #### All other arguments are passed to repl.
30 #### The -p argument can be useful with improperly structured
31 #### messages, such as those that use multipart/related when they
32 #### should have used multipart/alternative.
33 rt() {
34 if [ "$1" = -h ]; then
35 shift
36 \repl -filter mhl.replywithoutbody -convertargs text/plain '' "$@"
37 elif [ "$1" = -p ]; then
38 shift
39 \repl -filter mhl.replywithoutbody -convertargs text/html '' "$@"
40 else
41 \repl -filter mhl.replywithoutbody \
42 -convertargs text/html '' -convertargs text/plain '' "$@"
43 fi
44 }
45
46
47 #### Add -editor mhbuild to above. Useful only when attachments
48 #### won't be added to the message.
49 ####
50 #### To ease editing at the What now? prompt, add a line like this to
51 #### your .mh_profile:
52 #### mhbuild-next: $EDITOR
53 #### assuming that your EDTIOR environment variable is set; if not,
54 #### replace $EDITOR above with the name of your editor. Without that
55 #### profile entry, enter "e[dit] $EDITOR" at the What now? prompt.
56 rtm() {
57 rt -editor mhbuild "$@"
58 }
59
60
61 #### Internal function for use by calendar response functions below.
62 #### Pulls "-a address" out of command line arguments.
63 mhical_attendee() {
64 mhical_prev=
65 mhical_attendee=
66 for arg in "$@"; do
67 test "$mhical_prev" = -a && mhical_attendee="$arg"
68 mhical_prev="$arg"
69 done
70 unset arg
71 unset mhical_prev
72 echo "$mhical_attendee"
73 }
74
75
76 #### accept a calendar request
77 #### usage: calaccept [-a address] [repl switches]
78 #### -a specifies attendee, see mhical(1)
79 #### Other arguments passed to repl(1).
80 calaccept() {
81 if [ "$1" = -a ]; then
82 attendee=' -attendee '`mhical_attendee "$@"`
83 shift; shift
84 else
85 attendee=
86 fi
87 \repl -noformat -editor mhbuild \
88 -convertargs text/calendar "-reply accept -contenttype${attendee}" \
89 "$@"
90 unset attendee
91 }
92
93
94 #### decline a calendar request
95 #### usage: caldecline [-a address] [repl switches]
96 #### -a specifies attendee, see mhical(1)
97 #### Other arguments passed to repl(1).
98 caldecline() {
99 if [ "$1" = -a ]; then
100 attendee=' -attendee '`mhical_attendee "$@"`
101 shift; shift
102 else
103 attendee=
104 fi
105 \repl -noformat -editor mhbuild \
106 -convertargs text/calendar "-reply decline -contenttype${attendee}" \
107 "$@"
108 unset attendee
109 }
110
111
112 #### reply as tentative to a calendar request
113 #### usage: caltentative [-a address] [repl switches]
114 #### -a specifies attendee, see mhical(1)
115 #### Other arguments passed to repl(1).
116 caltentative() {
117 if [ "$1" = -a ]; then
118 attendee=' -attendee '`mhical_attendee "$@"`
119 shift; shift
120 else
121 attendee=
122 fi
123 \repl -noformat -editor mhbuild \
124 -convertargs text/calendar "-reply tentative -contenttype${attendee}" \
125 "$@"
126 unset attendee
127 }
128
129
130 #### cancel a calendar request
131 calcancel() {
132 \repl -noformat -editor mhbuild \
133 -convertargs text/calendar '-cancel -contenttype' "$@"
134 }
135
136
137 # Local Variables:
138 # mode: sh
139 # End: