Your message dated Sat, 31 Jan 2009 22:54:32 +0000
with message-id <[email protected]>
and subject line mutt: patch for idiot-proofing with attachments
has caused the Debian Bug report #182069,
regarding mutt-patched: Please include the attachment warn patch
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
182069: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=182069
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: mutt
Version: 1.5.17-2
Severity: wishlist
Tags: patch
Hi,
a patch which is maintained in the mutt-ng svn repository at [1]
includes a very nice little feature which warns someone if he wants to
send an attachment but does not attach it. It is better as the config
hack described in the mutt wiki because it does not depend
on a sendmail-using mutt, so it can be used with the integrated smtp
engine.
It would be cool if this could be integrated into mutt-patched.
I used the attached file to patch latest mutt 1.5.17-2 deb sources with
this patch for personal use (it needed some changes to apply in line
with the debian patches).
Best Regards,
Patrick
[1] http://bereshit.synflood.at/svn/mutt-patches/trunk
Index: mutt-1.5.17/mutt.h
===================================================================
--- mutt-1.5.17.orig/mutt.h 2008-01-07 13:25:09.345374710 +0100
+++ mutt-1.5.17/mutt.h 2008-01-07 13:25:14.681386246 +0100
@@ -281,6 +281,7 @@
enum
{
OPT_ABORT,
+ OPT_ATTACH,
OPT_BOUNCE,
OPT_COPY,
OPT_DELETE,
Index: mutt-1.5.17/attach.h
===================================================================
--- mutt-1.5.17.orig/attach.h 2008-01-07 13:24:48.057328733 +0100
+++ mutt-1.5.17/attach.h 2008-01-07 13:25:14.681386246 +0100
@@ -53,4 +53,8 @@
void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
+/* this checks whether at least one text line matches
+ * AttachRemindRegexp and returns 1 if so and 0 otherwise */
+int mutt_attach_check (HEADER* hdr);
+
#endif /* _ATTACH_H_ */
Index: mutt-1.5.17/mutt_regex.h
===================================================================
--- mutt-1.5.17.orig/mutt_regex.h 2008-01-07 13:24:47.885328362 +0100
+++ mutt-1.5.17/mutt_regex.h 2008-01-07 13:25:56.981477835 +0100
@@ -51,5 +51,6 @@
WHERE REGEXP ReplyRegexp;
WHERE REGEXP Smileys;
WHERE REGEXP GecosMask;
+WHERE REGEXP AttachRemindRegexp;
#endif /* MUTT_REGEX_H */
Index: mutt-1.5.17/init.h
===================================================================
--- mutt-1.5.17.orig/init.h 2008-01-07 13:25:09.341374701 +0100
+++ mutt-1.5.17/init.h 2008-01-07 13:25:14.689386263 +0100
@@ -83,6 +83,24 @@
struct option_t MuttVars[] = {
/*++*/
+ {"abort_noattach", DT_QUAD, R_NONE, OPT_ATTACH, "no" },
+ /*
+ ** .pp
+ ** This variable specifies whether to abort sending if no attachment
+ ** was made but the content references them, i.e. the content
+ ** matches the regular expression given in
+ ** $$attach_remind_regexp. If a match was found and this
+ ** variable is set to \fIyes\fP, message sending will be aborted
+ ** but the mail will be send nevertheless if set to \fIno\fP.
+ **
+ ** .pp
+ ** This variable and $$attach_remind_regexp are intended to
+ ** remind the user to attach files if the message's text
+ ** references them.
+ **
+ ** .pp
+ ** See also the $$attach_remind_regexp variable.
+ */
{ "abort_nosubject", DT_QUAD, R_NONE, OPT_SUBJECT, M_ASKYES },
/*
** .pp
@@ -230,6 +248,16 @@
** .pp
** For an explanation of `soft-fill', see the ``$$index_format'' documentation.
*/
+ {"attach_remind_regexp", DT_RX, R_NONE, UL &AttachRemindRegexp, "attach"},
+ /*
+ ** .pp
+ ** If this variable is non-empty, muttng will scan a message's contents
+ ** before sending for this regular expression. If it is found, it will
+ ** ask for what to do depending on the setting of $$abort_noattach.
+ ** .pp
+ ** This variable and $$abort_noattach are intended to remind the user
+ ** to attach files if the message's text references them.
+ */
{ "attach_sep", DT_STR, R_NONE, UL &AttachSep, UL "\n" },
/*
** .pp
Index: mutt-1.5.17/send.c
===================================================================
--- mutt-1.5.17.orig/send.c 2008-01-07 13:24:47.985328578 +0100
+++ mutt-1.5.17/send.c 2008-01-07 13:25:14.689386263 +0100
@@ -1578,6 +1578,21 @@
if (msg->content->next)
msg->content = mutt_make_multipart (msg->content);
+ if (mutt_attach_check (msg) &&
+ !msg->content->next &&
+ query_quadoption (OPT_ATTACH,
+ _("No attachments made but indicator found in text. "
+ "Cancel sending?")) == M_YES) {
+ if (quadoption (OPT_ATTACH) == M_YES) {
+ mutt_message _("No attachments made but indicator found in text. "
+ "Abort sending.");
+ sleep (2);
+ }
+ mutt_message (_("Mail not sent."));
+ goto main_loop;
+ }
+
+
/*
* Ok, we need to do it this way instead of handling all fcc stuff in
* one place in order to avoid going to main_loop with encoded "env"
Index: mutt-1.5.17/attach.c
===================================================================
--- mutt-1.5.17.orig/attach.c 2008-01-07 13:24:48.049328719 +0100
+++ mutt-1.5.17/attach.c 2008-01-07 13:25:14.689386263 +0100
@@ -1083,3 +1083,30 @@
return 0;
}
}
+
+int mutt_attach_check (HEADER* hdr) {
+ int found = 0;
+ char buf[LONG_STRING];
+ char *p = NULL;
+ FILE* fp = NULL;
+ regmatch_t pmatch[1];
+
+ if (!hdr || !hdr->content || !((regex_t*) AttachRemindRegexp.rx) ||
+ (fp = safe_fopen (hdr->content->filename, "r")) == NULL)
+ return (0);
+
+ while (!found && fgets (buf, sizeof (buf), fp)) {
+ p = buf;
+ while (p && *p) {
+ if (regexec ((regex_t*) AttachRemindRegexp.rx, p, 1,
+ pmatch, 0) == 0) {
+ found = 1;
+ break;
+ }
+ p++;
+ }
+ }
+ fclose (fp);
+
+ return (found);
+}
--- End Message ---
--- Begin Message ---
The bug is tagged as wontfix and the upstream suggested a wiki link
as a workaround, we can resolve this on this side
Cheers
Antonio
--- End Message ---