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

New patch: index_format variable for showing attachment



I have written a small patch that enables the possibility to
show which mails is of MIME Content-type: multipart in the index.

What say you?

-- 
www.getfirefox.com
Index: globals.h
===================================================================
RCS file: /home/roessler/cvs/mutt/globals.h,v
retrieving revision 3.17
diff -u -r3.17 globals.h
--- globals.h   28 Jun 2005 19:26:54 -0000      3.17
+++ globals.h   26 Jul 2005 15:28:56 -0000
@@ -73,6 +73,7 @@
 WHERE char *MhFlagged;
 WHERE char *MhReplied;
 WHERE char *MhUnseen;
+WHERE char *MimeMultiString;
 WHERE char *MsgFmt;
 
 #ifdef USE_SOCKET
Index: hdrline.c
===================================================================
RCS file: /home/roessler/cvs/mutt/hdrline.c,v
retrieving revision 3.14
diff -u -r3.14 hdrline.c
--- hdrline.c   12 Feb 2005 19:12:40 -0000      3.14
+++ hdrline.c   26 Jul 2005 15:28:56 -0000
@@ -26,6 +26,7 @@
 #include "charset.h"
 #include "mutt_crypt.h"
 #include "mutt_idna.h"
+#include "mime.h"
 
 #include <ctype.h>
 #include <stdlib.h>
@@ -205,6 +206,7 @@
  * %E = number of messages in current thread
  * %f = entire from line
  * %F = like %n, unless from self
+ * %g = display # if message is mime multipart (has attachment)
  * %i = message-id
  * %l = number of lines in the message
  * %L = like %F, except `lists' are displayed first
@@ -442,6 +444,22 @@
         optional = 0;
       break;
 
+    case 'g':
+      if ((i = strlen (MimeMultiString)) == 0)
+      {
+        *dest = '\0';
+        break;
+      }
+
+      if (is_multipart (hdr->content))
+        snprintf (dest, destlen, MimeMultiString);
+      else
+      {
+        for (i = 0 ; i < strlen (MimeMultiString) && i < destlen ; i++)
+          strcat (dest, " ");
+      }
+      break;
+
     case 'H':
       /* (Hormel) spam score */
       if (optional)
Index: init.h
===================================================================
RCS file: /home/roessler/cvs/mutt/init.h,v
retrieving revision 3.72
diff -u -r3.72 init.h
--- init.h      28 Jun 2005 19:26:54 -0000      3.72
+++ init.h      26 Jul 2005 15:28:58 -0000
@@ -958,6 +958,8 @@
   ** .dt %E .dd number of messages in current thread
   ** .dt %f .dd entire From: line (address + real name)
   ** .dt %F .dd author name, or recipient name if the message is from you
+  ** .dt %g .dd display $$mime_multipart_string if message is of mime 
content-type
+  **            multipart (e.g. has attachment)
   ** .dt %H .dd spam attribute(s) of this message
   ** .dt %i .dd message-id of the current message
   ** .dt %l .dd number of lines in the message (does not work with maildir,
@@ -997,7 +999,7 @@
   ** .dt %|X    .dd pad to the end of the line with character "X"
   ** .de
   ** .pp
-  ** See also: ``$$to_chars''.
+  ** See also: ``$$to_chars'', ``$$mime_multipart_string''.
   */
   { "ispell",          DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
   /*
@@ -1200,6 +1202,14 @@
   ** be attached to the newly composed message if this option is set.
   */
 
+  { "mime_multipart_string", DT_STR, R_NONE, UL &MimeMultiString , UL "#" },
+  /*
+  ** .pp
+  ** Specifies what character, or string of characters, to display when
+  ** message is of MIME Content-Type multipart (e.g. got an attachment)
+  ** and %g is used in $$index_format.
+  */
+
 #ifdef MIXMASTER
   { "mix_entry_format", DT_STR,  R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s 
%a" },
   /*