Commit 1184b4a5 1184b4a5c89edabc5f951647460b284062d5abda by Sergey Poznyakoff

Implement `mail -F'.

* NEWS, doc/texinfo/programs.texi: Update.
* mail/mail.c (parse_opt): Remove the fixme.
* mail/mailvar.c (mailvar_tab): Add `byname'.
* mail/reply.c (reply0): Use `byname' when deciding where to
save the message.
* mail/util.c: Fix comment.
1 parent 4f12cc0c
...@@ -48,6 +48,11 @@ In addition, the form ...@@ -48,6 +48,11 @@ In addition, the form
48 48
49 is also allowed. 49 is also allowed.
50 50
51 ** The -F option
52
53 The -F option (record outgoing messages in a file named after the
54 first recipient) is implemented.
55
51 ** error locations 56 ** error locations
52 57
53 Diagnostic messages issued while processing `source' command 58 Diagnostic messages issued while processing `source' command
......
...@@ -2244,7 +2244,10 @@ user's @file{mbox} file. @xref{Reading Mail} for more details about ...@@ -2244,7 +2244,10 @@ user's @file{mbox} file. @xref{Reading Mail} for more details about
2244 using this option. 2244 using this option.
2245 @item -F 2245 @item -F
2246 @itemx --byname 2246 @itemx --byname
2247 Save messages according to sender. Currently this option is not implemented. 2247 Record outgoing messages in a file named after the first recipient.
2248 The name is the login-name portion of the address found first on the
2249 @samp{To:} line in the mail header. This option sets the @samp{byname}
2250 variable, which see (@xref{byname}).
2248 @item -H 2251 @item -H
2249 @itemx --headers 2252 @itemx --headers
2250 Print header summary to stdout and exit. 2253 Print header summary to stdout and exit.
...@@ -3528,6 +3531,19 @@ message, the next one will be typed automatically. ...@@ -3528,6 +3531,19 @@ message, the next one will be typed automatically.
3528 When set, every occurrence of @code{!} in arguments to @code{!} 3531 When set, every occurrence of @code{!} in arguments to @code{!}
3529 command is replaced with the last executed command. 3532 command is replaced with the last executed command.
3530 3533
3534 @anchor{byname}
3535 @item byname
3536 @*Type: Boolean
3537 @*Default: Unset
3538 @vrindex byname, mail variable
3539
3540 Record outgoing messages in a file named after the first recipient.
3541 The name is the login-name portion of the address found first on the
3542 @samp{To:} line in the mail header. This variable overrides the
3543 @samp{record} variable.
3544
3545 It is set by the @option{--byname} (@option{-F}) command line option.
3546
3531 @anchor{datefield} 3547 @anchor{datefield}
3532 @item datefield 3548 @item datefield
3533 @*Type: Boolean. 3549 @*Type: Boolean.
......
...@@ -141,8 +141,7 @@ parse_opt (int key, char *arg, struct argp_state *state) ...@@ -141,8 +141,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
141 break; 141 break;
142 142
143 case 'F': 143 case 'F':
144 /* FIXME */ 144 util_cache_command (&command_list, "set byname");
145 util_cache_command (&command_list, "setq byname");
146 break; 145 break;
147 146
148 case ARGP_KEY_ARG: 147 case ARGP_KEY_ARG:
......
...@@ -66,6 +66,10 @@ struct mailvar_symbol mailvar_tab[] = ...@@ -66,6 +66,10 @@ struct mailvar_symbol mailvar_tab[] =
66 { { "autoprint", }, 66 { { "autoprint", },
67 MAILVAR_TYPEMASK (mailvar_type_boolean), 67 MAILVAR_TYPEMASK (mailvar_type_boolean),
68 N_("delete command behaves like dp") }, 68 N_("delete command behaves like dp") },
69 { { "byname" },
70 MAILVAR_TYPEMASK (mailvar_type_boolean),
71 N_("record outgoing messages in a file named after the first recipient; "
72 "overrides the `record' variable") },
69 { { "bang", }, 73 { { "bang", },
70 MAILVAR_TYPEMASK (mailvar_type_boolean), 74 MAILVAR_TYPEMASK (mailvar_type_boolean),
71 N_("replace every occurrence of ! in arguments to the shell command" 75 N_("replace every occurrence of ! in arguments to the shell command"
......
...@@ -123,7 +123,9 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data) ...@@ -123,7 +123,9 @@ reply0 (msgset_t *mspec, mu_message_t msg, void *data)
123 123
124 make_in_reply_to (&env, msg); 124 make_in_reply_to (&env, msg);
125 make_references (&env, msg); 125 make_references (&env, msg);
126 status = mail_send0 (&env, 0); 126 status = mail_send0 (&env,
127 mailvar_get (NULL, "byname", mailvar_type_boolean, 0)
128 == 0);
127 compose_destroy (&env); 129 compose_destroy (&env);
128 130
129 return status; 131 return status;
......
...@@ -713,7 +713,7 @@ util_outfolder_name (char *str) ...@@ -713,7 +713,7 @@ util_outfolder_name (char *str)
713 return strdup (str); 713 return strdup (str);
714 } 714 }
715 715
716 /* Save an outgoing message. "savefile" allows to override the setting 716 /* Save an outgoing message. The SAVEFILE argument overrides the setting
717 of the "record" variable. */ 717 of the "record" variable. */
718 void 718 void
719 util_save_outgoing (mu_message_t msg, char *savefile) 719 util_save_outgoing (mu_message_t msg, char *savefile)
......