summaryrefslogtreecommitdiff
path: root/mh/repl.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2006-05-20 10:44:01 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2006-05-20 10:44:01 +0000
commitb264f32c7734360dd7307b669b94c1404ef6a31a (patch)
tree314c817c97092eec7d5ad7ffc26051d20cf021bb /mh/repl.c
parent8b47e90eab5bb17bf0d57aa0fdae925d9c8a3441 (diff)
downloadmailutils-b264f32c7734360dd7307b669b94c1404ef6a31a.tar.gz
mailutils-b264f32c7734360dd7307b669b94c1404ef6a31a.tar.bz2
(opt_handler, make_draft): Handle --fcc
Diffstat (limited to 'mh/repl.c')
-rw-r--r--mh/repl.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/mh/repl.c b/mh/repl.c
index cba36ab53..c47bf83a6 100644
--- a/mh/repl.c
+++ b/mh/repl.c
@@ -19,6 +19,7 @@
/* MH repl command */
#include <mh.h>
+#include <mh_format.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -52,7 +53,7 @@ static struct argp_option options[] = {
N_("Construct a group or followup reply") },
{"editor", ARG_EDITOR, N_("PROG"), 0, N_("Set the editor program to use")},
{"noedit", ARG_NOEDIT, 0, 0, N_("Suppress the initial edit")},
- {"fcc", ARG_FCC, N_("FOLDER"), 0, N_("* Set the folder to receive Fcc's")},
+ {"fcc", ARG_FCC, N_("FOLDER"), 0, N_("Set the folder to receive Fcc's")},
{"filter", ARG_FILTER, N_("MHL-FILTER"), 0,
N_("Set the mhl filter to preprocess the body of the message being replied")},
{"form", ARG_FORM, N_("FILE"), 0, N_("Read format from given file")},
@@ -123,6 +124,8 @@ static int use_draft = 0; /* --use flag */
static char *mhl_filter = NULL; /* --filter flag */
static int annotate; /* --annotate flag */
static char *draftmessage = "new";
+static struct obstack fcc_stack;
+static int has_fcc;
static int
decode_cc_flag (const char *opt, const char *arg)
@@ -243,6 +246,16 @@ opt_handler (int key, char *arg, void *unused, struct argp_state *state)
break;
case ARG_FCC:
+ if (!has_fcc)
+ {
+ obstack_init (&fcc_stack);
+ has_fcc = 1;
+ }
+ else
+ obstack_grow (&fcc_stack, ", ", 2);
+ obstack_grow (&fcc_stack, arg, strlen (arg));
+ break;
+
case ARG_INPLACE:
case ARG_WHATNOWPROC:
case ARG_NOWHATNOWPROC:
@@ -335,7 +348,22 @@ make_draft (mu_mailbox_t mbox, int disp, struct mh_whatnow_env *wh)
exit (1);
}
- mh_format (&format, msg, msgset.list[0], width, &buf);
+ if (has_fcc)
+ {
+ mu_message_t tmp_msg;
+ mu_header_t hdr;
+ char *text;
+
+ mu_message_create_copy (&tmp_msg, msg);
+ mu_message_get_header (tmp_msg, &hdr);
+ text = obstack_finish (&fcc_stack);
+ mu_header_set_value (hdr, MU_HEADER_FCC, text, 0);
+ mh_format (&format, tmp_msg, msgset.list[0], width, &buf);
+ mu_message_destroy (&tmp_msg, NULL);
+ }
+ else
+ mh_format (&format, msg, msgset.list[0], width, &buf);
+
mu_stream_sequential_write (str, buf, strlen (buf));
if (mhl_filter)

Return to:

Send suggestions and report system problems to the System administrator.