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
is also allowed.
** The -F option
The -F option (record outgoing messages in a file named after the
first recipient) is implemented.
** error locations
Diagnostic messages issued while processing `source' command
......
......@@ -2244,7 +2244,10 @@ user's @file{mbox} file. @xref{Reading Mail} for more details about
using this option.
@item -F
@itemx --byname
Save messages according to sender. Currently this option is not implemented.
Record outgoing messages in a file named after the first recipient.
The name is the login-name portion of the address found first on the
@samp{To:} line in the mail header. This option sets the @samp{byname}
variable, which see (@xref{byname}).
@item -H
@itemx --headers
Print header summary to stdout and exit.
......@@ -3528,6 +3531,19 @@ message, the next one will be typed automatically.
When set, every occurrence of @code{!} in arguments to @code{!}
command is replaced with the last executed command.
@anchor{byname}
@item byname
@*Type: Boolean
@*Default: Unset
@vrindex byname, mail variable
Record outgoing messages in a file named after the first recipient.
The name is the login-name portion of the address found first on the
@samp{To:} line in the mail header. This variable overrides the
@samp{record} variable.
It is set by the @option{--byname} (@option{-F}) command line option.
@anchor{datefield}
@item datefield
@*Type: Boolean.
......
......@@ -141,8 +141,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
break;
case 'F':
/* FIXME */
util_cache_command (&command_list, "setq byname");
util_cache_command (&command_list, "set byname");
break;
case ARGP_KEY_ARG:
......
......@@ -66,6 +66,10 @@ struct mailvar_symbol mailvar_tab[] =
{ { "autoprint", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("delete command behaves like dp") },
{ { "byname" },
MAILVAR_TYPEMASK (mailvar_type_boolean),
N_("record outgoing messages in a file named after the first recipient; "
"overrides the `record' variable") },
{ { "bang", },
MAILVAR_TYPEMASK (mailvar_type_boolean),
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)
make_in_reply_to (&env, msg);
make_references (&env, msg);
status = mail_send0 (&env, 0);
status = mail_send0 (&env,
mailvar_get (NULL, "byname", mailvar_type_boolean, 0)
== 0);
compose_destroy (&env);
return status;
......
......@@ -713,7 +713,7 @@ util_outfolder_name (char *str)
return strdup (str);
}
/* Save an outgoing message. "savefile" allows to override the setting
/* Save an outgoing message. The SAVEFILE argument overrides the setting
of the "record" variable. */
void
util_save_outgoing (mu_message_t msg, char *savefile)
......