Commit cf774696 cf774696f4f81e021d6946e185c3df146bb66d5a by Sergey Poznyakoff

(mail_send, mail_send0): Use `mailx'

to control mailx compatibility mode. Thanks Peter S Galbraith
<p.galbraith@globetrotter.net> for the idea.
1 parent d674dc7d
...@@ -25,6 +25,17 @@ ...@@ -25,6 +25,17 @@
25 static int isfilename __P ((const char *)); 25 static int isfilename __P ((const char *));
26 static void msg_to_pipe __P ((const char *cmd, message_t msg)); 26 static void msg_to_pipe __P ((const char *cmd, message_t msg));
27 27
28 static void
29 read_cc_bcc (compose_env_t *env)
30 {
31 if (util_getenv (NULL, "askcc", Mail_env_boolean, 0) == 0)
32 compose_header_set (env, MU_HEADER_CC,
33 ml_readline ("Cc: "), COMPOSE_REPLACE);
34 if (util_getenv (NULL, "askbcc", Mail_env_boolean, 0) == 0)
35 compose_header_set (env, MU_HEADER_BCC,
36 ml_readline ("Bcc: "), COMPOSE_REPLACE);
37 }
38
28 /* 39 /*
29 * m[ail] address... 40 * m[ail] address...
30 if address is starting with 41 if address is starting with
...@@ -75,12 +86,8 @@ mail_send (int argc, char **argv) ...@@ -75,12 +86,8 @@ mail_send (int argc, char **argv)
75 } 86 }
76 } 87 }
77 88
78 if (util_getenv (NULL, "askcc", Mail_env_boolean, 0) == 0) 89 if (util_getenv (NULL, "mailx", Mail_env_boolean, 0))
79 compose_header_set (&env, MU_HEADER_CC, 90 read_cc_bcc (&env);
80 ml_readline ("Cc: "), COMPOSE_REPLACE);
81 if (util_getenv (NULL, "askbcc", Mail_env_boolean, 0) == 0)
82 compose_header_set (&env, MU_HEADER_BCC,
83 ml_readline ("Bcc: "), COMPOSE_REPLACE);
84 91
85 if (util_getenv (NULL, "asksub", Mail_env_boolean, 0) == 0) 92 if (util_getenv (NULL, "asksub", Mail_env_boolean, 0) == 0)
86 compose_header_set (&env, MU_HEADER_SUBJECT, 93 compose_header_set (&env, MU_HEADER_SUBJECT,
...@@ -327,6 +334,11 @@ mail_send0 (compose_env_t * env, int save_to) ...@@ -327,6 +334,11 @@ mail_send0 (compose_env_t * env, int save_to)
327 334
328 fclose (env->file); /* FIXME: freopen would be better */ 335 fclose (env->file); /* FIXME: freopen would be better */
329 336
337 /* In mailx compatibility mode, ask for Cc and Bcc after editing
338 the body of the message */
339 if (util_getenv (NULL, "mailx", Mail_env_boolean, 0) == 0)
340 read_cc_bcc (env);
341
330 /* Prepare the header */ 342 /* Prepare the header */
331 header_set_value (env->header, "X-Mailer", argp_program_version, 1); 343 header_set_value (env->header, "X-Mailer", argp_program_version, 1);
332 344
......