rfc822_write_address (buf, sizeof (buf), adr);
#define extra_space (15 + 7 + 2)
- /*
- * This is the printing width of "...? ([y=yes]/n=no): ?" plus 2
- * for good measure. This is not ideal. FIXME.
- *
- * While you fix this, please go to recvcmd.c, and do the same thing there.
- */
- snprintf (prompt, sizeof (prompt) - 4,
+ snprintf (prompt, sizeof (prompt),
(h ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
- mutt_format_string (prompt, sizeof (prompt) - 4,
- 0, COLS-extra_space, 0, 0,
- prompt, sizeof (prompt), 0);
- strcat (prompt, "...?"); /* __STRCAT_CHECKED__ */
- if (mutt_yesorno (prompt, M_YES) != M_YES)
+
+ if (mutt_strwidth (prompt) > COLS - extra_space)
+ {
+ mutt_format_string (prompt, sizeof (prompt),
+ 0, COLS-extra_space, 0, 0,
+ prompt, sizeof (prompt), 0);
+ strncat (prompt, "...?", sizeof (prompt));
+ }
+ else
+ strncat (prompt, "?", sizeof (prompt));
+
+ if (query_quadoption (OPT_BOUNCE, prompt) == M_NO)
{
rfc822_free_address (&adr);
- CLEARLINE (LINES-1);
+ CLEARLINE (LINES - 1);
+ mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
return;
}
+ CLEARLINE (LINES - 1);
+
rc = mutt_bounce_message (NULL, h, adr);
rfc822_free_address (&adr);
/* If no error, or background, display message. */
set delete=yes # purge deleted messages without asking
set edit_headers # let me edit the message header when composing
#set editor="emacs -nw" # editor to use when composing messages
+#set fast_bounce # don't ask about bouncing messages, just do it
#set fast_reply # skip initial prompts when replying
#set fcc_attach # keep attachments in copies of sent messages?
#set force_name # fcc by recipient, create if mailbox doesn't exist
you for the ``Subject:'' field for the message, providing a default if
you are replying to or forwarding a message. See also <ref id="askcc"
name="$askcc">, <ref id="askbcc" name="$askbcc">, <ref
-id="autoedit" name="$autoedit">, and <ref id="fast_reply"
+id="autoedit" name="$autoedit">, <ref id="bounce"
+name="$bounce">, and <ref id="fast_reply"
name="$fast_reply"> for changing how Mutt asks these
questions.
** notifying you of new mail. This is independent of the setting of the
** ``$$beep'' variable.
*/
+ { "bounce", DT_QUAD, R_NONE, OPT_BOUNCE, M_ASKYES },
+ /*
+ ** Controls whether you will be asked to confirm bouncing messages.
+ ** If set to \fIyes\fP you don't get asked if you want to bounce a
+ ** message. Setting this variable to \fIno\fP is not generally useful,
+ ** and thus not recommended, because your are unable to bounce message.
+ */
{ "bounce_delivered", DT_BOOL, R_NONE, OPTBOUNCEDELIVERED, 1 },
/*
** .pp
OPT_SUBJECT,
OPT_MIMEFWDREST,
OPT_FORWEDIT,
- OPT_MAX
+ OPT_MAX,
+ OPT_BOUNCE
};
/* flags to ci_send_message() */
ATTACHPTR ** idx, short idxlen, BODY * cur)
{
short i;
- short ntagged;
char prompt[STRING];
char buf[HUGE_STRING];
ADDRESS *adr = NULL;
+ int ret = 0;
+ int p = 0;
if (check_all_msg (idx, idxlen, cur, 1) == -1)
return;
- ntagged = count_tagged (idx, idxlen);
-
- if (cur || ntagged == 1)
+ /* one or more messages? */
+ p = (cur || count_tagged (idx, idxlen) == 1);
+
+ if (p)
strfcpy (prompt, _("Bounce message to: "), sizeof (prompt));
else
strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt));
* See commands.c.
*/
snprintf (prompt, sizeof (prompt) - 4,
- cur ? _("Bounce message to %s...?") : _("Bounce messages to %s...?"), buf);
-
- mutt_format_string (prompt, sizeof (prompt) - 4,
- 0, COLS-extra_space, 0, 0,
- prompt, sizeof (prompt), 0);
- strcat (prompt, "...?"); /* __STRCAT_CHECKED__ */
-
- if (mutt_yesorno (prompt, M_YES) != M_YES)
- goto bail;
+ (p ? _("Bounce message to %s") : _("Bounce messages to %s")), buf);
+
+ if (mutt_strwidth (prompt) > COLS - extra_space)
+ {
+ mutt_format_string (prompt, sizeof (prompt) - 4,
+ 0, COLS-extra_space, 0, 0,
+ prompt, sizeof (prompt), 0);
+ strncat (prompt, "...?", sizeof (prompt));
+ }
+ else
+ strncat (prompt, "?", sizeof (prompt));
+ if (query_quadoption (OPT_BOUNCE, prompt) == M_NO)
+ {
+ rfc822_free_address (&adr);
+ CLEARLINE (LINES - 1);
+ mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
+ return;
+ }
+
+ CLEARLINE (LINES - 1);
+
if (cur)
- mutt_bounce_message (fp, cur->hdr, adr);
+ ret = mutt_bounce_message (fp, cur->hdr, adr);
else
{
for (i = 0; i < idxlen; i++)
{
if (idx[i]->content->tagged)
- mutt_bounce_message (fp, idx[i]->content->hdr, adr);
+ if (mutt_bounce_message (fp, idx[i]->content->hdr, adr))
+ ret = 1;
}
}
-bail:
-
- rfc822_free_address (&adr);
- CLEARLINE (LINES - 1);
+ if (!ret)
+ mutt_message (p ? _("Message bounced.") : _("Messages bounced."));
+ else
+ mutt_error (p ? _("Error bouncing message!") : _("Error bouncing messages!"));
}