36 |
static struct argp_option options[] = { |
static struct argp_option options[] = { |
37 |
{"annotate", 'a', N_("BOOL"), OPTION_ARG_OPTIONAL, |
{"annotate", 'a', N_("BOOL"), OPTION_ARG_OPTIONAL, |
38 |
N_("Add Replied: header to the message being replied to")}, |
N_("Add Replied: header to the message being replied to")}, |
39 |
|
{"build", 'b', 0, 0, |
40 |
|
N_("Build the draft and quit immediately.")}, |
41 |
{"draftfolder", 'd', N_("FOLDER"), 0, |
{"draftfolder", 'd', N_("FOLDER"), 0, |
42 |
N_("Invoke the draftfolder facility")}, |
N_("Specify the folder for message drafts")}, |
43 |
|
{"nodraftfolder", ARG_NODRAFTFOLDER, 0, 0, |
44 |
|
N_("Undo the effect of the last --draftfolder option")}, |
45 |
{"draftmessage" , 'm', N_("MSG"), 0, |
{"draftmessage" , 'm', N_("MSG"), 0, |
46 |
N_("Invoke the draftmessage facility")}, |
N_("Invoke the draftmessage facility")}, |
47 |
{"cc", 'c', "{all|to|cc|me}", 0, |
{"cc", 'c', "{all|to|cc|me}", 0, |
55 |
{"filter", ARG_FILTER, N_("PROG"), 0, |
{"filter", ARG_FILTER, N_("PROG"), 0, |
56 |
N_("Set the filter program to preprocess the body of the message being replied")}, |
N_("Set the filter program to preprocess the body of the message being replied")}, |
57 |
{"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, |
{"form", 'F', N_("FILE"), 0, N_("Read format from given file")}, |
58 |
{"inplace", ARG_INPLACE, N_("BOOL"), 0, N_("Annotate the message in place")}, |
{"inplace", ARG_INPLACE, N_("BOOL"), OPTION_ARG_OPTIONAL, |
59 |
{"query", ARG_QUERY, N_("BOOL"), 0, N_("Query for addresses to place in To: and Cc: lists")}, |
N_("Annotate the message in place")}, |
60 |
|
{"query", ARG_QUERY, N_("BOOL"), OPTION_ARG_OPTIONAL, |
61 |
|
N_("Query for addresses to place in To: and Cc: lists")}, |
62 |
{"width", 'w', N_("NUMBER"), 0, N_("Set output width")}, |
{"width", 'w', N_("NUMBER"), 0, N_("Set output width")}, |
63 |
{"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0, |
{"whatnowproc", ARG_WHATNOWPROC, N_("PROG"), 0, |
64 |
N_("Set the replacement for whatnow program")}, |
N_("Set the replacement for whatnow program")}, |
69 |
/* Traditional MH options */ |
/* Traditional MH options */ |
70 |
struct mh_option mh_option[] = { |
struct mh_option mh_option[] = { |
71 |
{"annotate", 1, 'a', MH_OPT_BOOL }, |
{"annotate", 1, 'a', MH_OPT_BOOL }, |
72 |
|
{"build", 1, 'b', }, |
73 |
{"cc", 1, 'c', MH_OPT_ARG, "all/to/cc/me"}, |
{"cc", 1, 'c', MH_OPT_ARG, "all/to/cc/me"}, |
74 |
{"nocc", 3, 'n', MH_OPT_ARG, "all/to/cc/me"}, |
{"nocc", 3, 'n', MH_OPT_ARG, "all/to/cc/me"}, |
75 |
{"form", 4, 'F', MH_OPT_ARG, "formatfile"}, |
{"form", 4, 'F', MH_OPT_ARG, "formatfile"}, |
101 |
|
|
102 |
static mh_format_t format; |
static mh_format_t format; |
103 |
static int width = 80; |
static int width = 80; |
104 |
|
static char *draft_folder; |
105 |
static char *draft_file; |
static char *draft_file; |
106 |
static mh_msgset_t msgset; |
static mh_msgset_t msgset; |
107 |
static mailbox_t mbox; |
static mailbox_t mbox; |
108 |
|
static int build_only = 0; /* --build flag */ |
109 |
|
static int query_mode = 0; /* --query flag */ |
110 |
|
|
111 |
static int |
static int |
112 |
opt_handler (int key, char *arg, void *unused) |
opt_handler (int key, char *arg, void *unused) |
113 |
{ |
{ |
114 |
switch (key) |
switch (key) |
115 |
{ |
{ |
116 |
|
case 'b': |
117 |
|
build_only = 1; |
118 |
|
break; |
119 |
|
|
120 |
|
case 'd': |
121 |
|
draft_folder = arg; |
122 |
|
break; |
123 |
|
|
124 |
case '+': |
case '+': |
125 |
case 'f': |
case 'f': |
126 |
current_folder = arg; |
current_folder = arg; |
139 |
} |
} |
140 |
break; |
break; |
141 |
|
|
142 |
|
case ARG_NODRAFTFOLDER: |
143 |
|
draft_folder = NULL; |
144 |
|
break; |
145 |
|
|
146 |
|
case ARG_QUERY: |
147 |
|
query_mode = is_true (arg); |
148 |
|
break; |
149 |
|
|
150 |
case 'a': |
case 'a': |
|
case 'd': |
|
151 |
case 'm': |
case 'm': |
152 |
case 'c': |
case 'c': |
153 |
case 'n': |
case 'n': |
156 |
case ARG_FCC: |
case ARG_FCC: |
157 |
case ARG_FILTER: |
case ARG_FILTER: |
158 |
case ARG_INPLACE: |
case ARG_INPLACE: |
|
case ARG_QUERY: |
|
159 |
case ARG_WHATNOWPROC: |
case ARG_WHATNOWPROC: |
160 |
mh_error (_("option is not yet implemented")); |
mh_error (_("option is not yet implemented")); |
161 |
exit (1); |
exit (1); |
214 |
exit (1); |
exit (1); |
215 |
} |
} |
216 |
|
|
217 |
|
if (!draft_folder) |
218 |
|
draft_folder = mh_global_profile_get ("Draft-Folder", mu_path_folder_dir); |
219 |
|
|
220 |
mbox = mh_open_folder (current_folder, 0); |
mbox = mh_open_folder (current_folder, 0); |
221 |
mh_msgset_parse (mbox, &msgset, argc - index, argv + index, "cur"); |
mh_msgset_parse (mbox, &msgset, argc - index, argv + index, "cur"); |
222 |
if (msgset.count != 1) |
if (msgset.count != 1) |
225 |
return 1; |
return 1; |
226 |
} |
} |
227 |
|
|
228 |
draft_file = mh_expand_name ("draft", 0); |
draft_file = mh_expand_name (draft_folder, "reply", 0); |
229 |
|
|
230 |
make_draft (); |
make_draft (); |
231 |
|
|