26 Feb 16:15
Introducing fast_reply / Cleanup of the two bounce functions
Thomas Glanzmann <sithglan <at> stud.uni-erlangen.de>
2003-02-26 15:15:35 GMT
2003-02-26 15:15:35 GMT
I implemented the fast_bounce option as quadoption as requested by Thomas Roessler. While I was around I removed the bug, which was yesterday introduced showing "...? ...?" while bouncing messages. Bounce message to Thomas Glanzmann <sithglan <at> stargo.gernoth.loc>...?...? ([no]/yes): When bouncing tagged messages or attachments the user is now informed about the sucess of the bouncing. When fast_reply is set to no ... the user is informed about the fact that he can't bounce messages and why when he tries to. Maybe we should rename 'fast_bounce' into simply 'bounce' (it is now good for other things that just fast bouncing.) Thomas
? cscope.out
? csope.files
Index: commands.c
===================================================================
RCS file: /home/roessler/cvs/mutt/commands.c,v
retrieving revision 3.15
diff -u -r3.15 commands.c
--- commands.c 25 Feb 2003 22:00:38 -0000 3.15
+++ commands.c 26 Feb 2003 15:11:21 -0000
@@ -229,6 +229,15 @@
ADDRESS *adr = NULL;
int rc;
+ if (quadoption (OPT_BOUNCE) == M_NO) {
+ if(h)
+ mutt_message _("Unable to bounce message because fast_bounce=NO.");
+ else
+ mutt_message _("Unable to bounce messages because fast_bounce=NO.");
+
+ return;
+ }
+
if(h)
strfcpy(prompt, _("Bounce message to: "), sizeof(prompt));
else
@@ -256,6 +265,9 @@
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr);
+ if (quadoption (OPT_BOUNCE) == M_YES)
+ goto ci_bounce_message__bounce;
+
#define extra_space (15 + 7 + 2)
/*
* This is the printing width of "...? ([y=yes]/n=no): ?" plus 2
@@ -269,12 +281,22 @@
0, COLS-extra_space, 0, 0,
prompt, sizeof (prompt), 0);
strcat (prompt, "...?"); /* __STRCAT_CHECKED__ */
- if (mutt_yesorno (prompt, M_YES) != M_YES)
+ if (quadoption (OPT_BOUNCE) == M_ASKYES)
{
- rfc822_free_address (&adr);
- CLEARLINE (LINES-1);
- return;
+ if (mutt_yesorno (prompt, M_YES) == M_YES)
+ goto ci_bounce_message__bounce;
+ }
+ else if (quadoption (OPT_BOUNCE) == M_ASKNO)
+ {
+ if (mutt_yesorno (prompt, M_NO) == M_YES)
+ goto ci_bounce_message__bounce;
}
+
+ rfc822_free_address (&adr);
+ mutt_message (h ? _("Message not bounced.") : _("Messages not bounced."));
+ return;
+
+ci_bounce_message__bounce:
rc = mutt_bounce_message (NULL, h, adr);
rfc822_free_address (&adr);
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.34
diff -u -r3.34 init.h
--- init.h 13 Feb 2003 09:55:02 -0000 3.34
+++ init.h 26 Feb 2003 15:11:25 -0000
@@ -491,6 +491,13 @@
** .pp
** Escape character to use for functions in the builtin editor.
*/
+ { "fast_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.
+ */
{ "fast_reply", DT_BOOL, R_NONE, OPTFASTREPLY, 0 },
/*
** .pp
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.14
diff -u -r3.14 mutt.h
--- mutt.h 30 Jan 2003 23:54:30 -0000 3.14
+++ mutt.h 26 Feb 2003 15:11:26 -0000
@@ -288,7 +288,8 @@
OPT_SUBJECT,
OPT_MIMEFWDREST,
OPT_FORWEDIT,
- OPT_MAX
+ OPT_MAX,
+ OPT_BOUNCE
};
/* flags to ci_send_message() */
Index: recvcmd.c
===================================================================
RCS file: /home/roessler/cvs/mutt/recvcmd.c,v
retrieving revision 3.3
diff -u -r3.3 recvcmd.c
--- recvcmd.c 25 Feb 2003 22:00:38 -0000 3.3
+++ recvcmd.c 26 Feb 2003 15:11:27 -0000
@@ -126,17 +126,29 @@
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);
+ /* one or more messages? */
+ p = (cur || count_tagged (idx, idxlen) == 1);
+
+ if (quadoption (OPT_BOUNCE) == M_NO)
+ {
+ if (p)
+ mutt_message _("Unable to bounce message because fast_bounce=NO.");
+ else
+ mutt_message _("Unable to bounce messages because fast_bounce=NO.");
+
+ return;
+ }
- if (cur || ntagged == 1)
+ if (p)
strfcpy (prompt, _("Bounce message to: "), sizeof (prompt));
else
strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt));
@@ -156,36 +168,54 @@
buf[0] = 0;
rfc822_write_address (buf, sizeof (buf), adr);
+ if (quadoption (OPT_BOUNCE) == M_YES)
+ goto mutt_attach_bounce__bounce;
+
#define extra_space (15+7+2)
/*
* See commands.c.
*/
snprintf (prompt, sizeof (prompt) - 4,
- cur ? _("Bounce message to %s...?") : _("Bounce messages to %s...?"), buf);
+ (p ? _("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;
+ if (quadoption (OPT_BOUNCE) == M_ASKYES)
+ {
+ if (mutt_yesorno (prompt, M_YES) == M_YES)
+ goto mutt_attach_bounce__bounce;
+ }
+ else if (quadoption (OPT_BOUNCE) == M_ASKNO)
+ {
+ if (mutt_yesorno (prompt, M_NO) == M_YES)
+ goto mutt_attach_bounce__bounce;
+ }
+
+ rfc822_free_address (&adr);
+ mutt_message (p ? _("Message not bounced.") : _("Messages not bounced."));
+ return;
+
+mutt_attach_bounce__bounce:
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!"));
}
Index: contrib/sample.muttrc
===================================================================
RCS file: /home/roessler/cvs/mutt/contrib/sample.muttrc,v
retrieving revision 3.1
diff -u -r3.1 sample.muttrc
--- contrib/sample.muttrc 22 Oct 2002 21:20:07 -0000 3.1
+++ contrib/sample.muttrc 26 Feb 2003 15:11:27 -0000
@@ -33,6 +33,7 @@
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
Index: doc/manual.sgml.head
===================================================================
RCS file: /home/roessler/cvs/mutt/doc/manual.sgml.head,v
retrieving revision 3.18
diff -u -r3.18 manual.sgml.head
--- doc/manual.sgml.head 25 Feb 2003 21:33:16 -0000 3.18
+++ doc/manual.sgml.head 26 Feb 2003 15:11:32 -0000
@@ -491,7 +491,8 @@
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="fast_bounce"
+name="$fast_bounce">, and <ref id="fast_reply"
name="$fast_reply"> for changing how Mutt asks these
questions.
)
Thomas
RSS Feed