<<< Date Index >>>     <<< Thread Index >>>

Fwd: mutt-1.5.6i: [PATCH] option to not include attachments in replies



Hi,

(Mutt bug tracking system keeps rejecting my report.)

Here is my patch to implement $include_onlyfirst.

This is what you have wanted, according to the TODO file.
I don't think this patch can cause overflows,
because this handles only flags. No pointers nor arrays.
So you have no reason to reject this (if this patch has no bugs).

If $include_onlyfirst is set,

1. Reply for a message with text/plain + text/plain
  -> includes only the first text part.

2. Reply for a message with text/html + text/plain
  -> includes only the text/html part if you auto_view text/html.
  -> includes only the text/plain part if your auto_view does not like 
text/html.

3. Reply for a message with application/octet-stream + text/plain
  -> includes only the second part (if auto_view does not like app/oct).

4. Reply for tagged messages
  -> includes a text part per message (as above rules).

Note that Mutt includes all tagged attachments
after you tag attachments and press ";r" in recvattach menu.

-- 
tamo
--- Begin Message ---
Package: mutt
Version: 1.5.6i
Severity: wishlist

-- Please type your report below this line
I read TODO file distributed with mutt source code and
found an entry; "option to not include attachments in replies."
So I wrote a patch to implement $include_onlyfirst variable.
If you really want to finish TODO things, try this patch.

Index: copy.c
===================================================================
RCS file: /home/roessler/cvs/mutt/copy.c,v
retrieving revision 3.13
diff -u -r3.13 copy.c
--- copy.c      12 Apr 2004 20:37:19 -0000      3.13
+++ copy.c      10 Jul 2004 09:52:55 -0000
@@ -586,6 +586,8 @@
       s.flags |= M_WEED;
     if (flags & M_CM_CHARCONV)
       s.flags |= M_CHARCONV;
+    if (flags & M_CM_REPLYING)
+      s.flags |= M_REPLYING;
     
     if (WithCrypto && flags & M_CM_VERIFY)
       s.flags |= M_VERIFY;
Index: copy.h
===================================================================
RCS file: /home/roessler/cvs/mutt/copy.h,v
retrieving revision 3.3
diff -u -r3.3 copy.h
--- copy.h      21 Jan 2003 12:33:41 -0000      3.3
+++ copy.h      10 Jul 2004 09:52:55 -0000
@@ -25,6 +25,7 @@
 #define M_CM_WEED      (1<<5)  /* weed message/rfc822 attachment headers */
 #define M_CM_CHARCONV  (1<<6)  /* perform character set conversions */
 #define M_CM_PRINTING  (1<<7)  /* printing the message - display light */
+#define M_CM_REPLYING  (1<<8)  /* replying the message */
 
 
 #define M_CM_DECODE_PGP          (1<<8) /* used for decoding PGP messages */
Index: handler.c
===================================================================
RCS file: /home/roessler/cvs/mutt/handler.c,v
retrieving revision 3.15
diff -u -r3.15 handler.c
--- handler.c   19 Sep 2003 13:03:25 -0000      3.15
+++ handler.c   10 Jul 2004 09:53:05 -0000
@@ -1485,6 +1485,9 @@
     }
     mutt_body_handler (p, s);
     state_putc ('\n', s);
+    if ((s->flags & M_REPLYING)
+       && (option (OPTINCLUDEONLYFIRST)) && (s->flags & M_FIRSTDONE))
+      break;
   }
 
   if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE ||
@@ -1918,6 +1921,7 @@
        s->fpin = fp;
       }
     }
+    s->flags |= M_FIRSTDONE;
   }
   else if (s->flags & M_DISPLAY)
   {
@@ -1935,5 +1939,5 @@
   }
   
   bail:
-  s->flags = oflags;
+  s->flags = oflags | (s->flags & M_FIRSTDONE);
 }
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.48
diff -u -r3.48 init.h
--- init.h      17 Jun 2004 20:36:13 -0000      3.48
+++ init.h      10 Jul 2004 09:53:08 -0000
@@ -884,6 +884,12 @@
   ** Controls whether or not a copy of the message(s) you are replying to
   ** is included in your reply.
   */
+  { "include_onlyfirst",       DT_BOOL, R_NONE, OPTINCLUDEONLYFIRST, 0},
+  /*
+  ** .pp
+  ** Controls whether or not Mutt includes only the first attachment
+  ** of the message you are replying.
+  */
   { "indent_string",   DT_STR,  R_NONE, UL &Prefix, UL "> " },
   /*
   ** .pp
Index: mutt.h
===================================================================
RCS file: /home/roessler/cvs/mutt/mutt.h,v
retrieving revision 3.28
diff -u -r3.28 mutt.h
--- mutt.h      17 Jun 2004 20:36:13 -0000      3.28
+++ mutt.h      10 Jul 2004 09:53:11 -0000
@@ -373,6 +373,7 @@
   OPTSSLSYSTEMCERTS,
 #endif
   OPTIMPLICITAUTOVIEW,
+  OPTINCLUDEONLYFIRST,
   OPTKEEPFLAGGED,
   OPTMAILCAPSANITIZE,
   OPTMAILDIRTRASH,
@@ -845,6 +846,8 @@
 #define M_WEED          (1<<3) /* weed headers even when not in display mode */
 #define M_CHARCONV     (1<<4) /* Do character set conversions */
 #define M_PRINTING     (1<<5) /* are we printing? - M_DISPLAY "light" */
+#define M_REPLYING     (1<<6) /* are we replying? */
+#define M_FIRSTDONE    (1<<7) /* the first attachment has been done */
 
 #define state_set_prefix(s) ((s)->flags |= M_PENDINGPREFIX)
 #define state_reset_prefix(s) ((s)->flags &= ~M_PENDINGPREFIX)
Index: send.c
===================================================================
RCS file: /home/roessler/cvs/mutt/send.c,v
retrieving revision 3.30
diff -u -r3.30 send.c
--- send.c      12 Apr 2004 21:19:27 -0000      3.30
+++ send.c      10 Jul 2004 09:53:20 -0000
@@ -403,7 +403,7 @@
 
 static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out)
 {
-  int cmflags = M_CM_PREFIX | M_CM_DECODE | M_CM_CHARCONV;
+  int cmflags = M_CM_PREFIX | M_CM_DECODE | M_CM_CHARCONV | M_CM_REPLYING;
   int chflags = CH_DECODE;
 
   if (WithCrypto && (cur->security & ENCRYPT))



-- System Information
System Version: FreeBSD or Linux

-- Build environment information

-- Mutt Version Information

--- End Message ---