add some lua in the mime module as well.
authorPierre Habouzit <madcoder@debian.org>
Thu, 29 Mar 2007 22:56:52 +0000 (00:56 +0200)
committerPierre Habouzit <madcoder@debian.org>
Thu, 29 Mar 2007 22:56:52 +0000 (00:56 +0200)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
globals.h
init.h
lib-lua/lua-token.sh
lib-lua/runtime.c
lib-mime/Makefile.am
lib-mime/mime.cpkg [moved from lib-mime/mime.c with 92% similarity]
lib-mime/mime.h
lib-mime/rfc822parse.c
tools/Makefile

index ef9b7b9..5ab1bb2 100644 (file)
--- a/globals.h
+++ b/globals.h
@@ -123,7 +123,6 @@ WHERE unsigned short SmtpPort;
 WHERE char *SmtpUseTLS;
 #endif
 WHERE char *Spoolfile;
-WHERE char *SpamSep;
 
 #if defined(USE_SSL) || defined(USE_GNUTLS)
 WHERE char *SslCertFile INITVAL (NULL);
diff --git a/init.h b/init.h
index f083620..8be3a84 100644 (file)
--- a/init.h
+++ b/init.h
@@ -2970,15 +2970,6 @@ struct option_t MuttVars[] = {
    ** Madmutt will attach the message whether or not this is the case,
    ** as long as the non-``$$reply_regexp'' parts of both messages are identical.
    */
-  {"spam_separator", DT_STR, R_NONE, UL &SpamSep, ","},
-  /*
-   ** .pp
-   ** ``$spam_separator'' controls what happens when multiple spam headers
-   ** are matched: if \fIunset\fP, each successive header will overwrite any
-   ** previous matches value for the spam label. If \fIset\fP, each successive
-   ** match will append to the previous, using ``$spam_separator'' as a
-   ** separator.
-   */
   {"spoolfile", DT_PATH, R_NONE, UL &Spoolfile, "" },
   /*
    ** .pp
index 7fd5e55..9ca1422 100644 (file)
@@ -137,6 +137,7 @@ exit 0
 ## sendmail_wait
 ## shell
 ## shorthost
+## spam_separator
 ## sysconfdir
 ## tmpdir
 ## use_8bitmime
index 1b976c9..1e806c4 100644 (file)
@@ -41,6 +41,7 @@ void luaM_initialize(void)
         {"MTransport",    luaopen_MTransport},
         {"MAlias",        luaopen_MAlias},
         {"MCharset",      luaopen_MCharset},
+        {"Mime",          luaopen_Mime},
     };
 
     int i;
index 24c8e0f..b47ba4c 100644 (file)
@@ -15,4 +15,5 @@ noinst_HEADERS    = mime.h mime-types.h
 mime-token.c mime-token.h: mime-token.def mime-token.sh
        sh mime-token.sh $@ < $<
 
+include $(top_builddir)/tools/cpkg2c.mk
 -include $(top_builddir)/tools/cflags.mk
similarity index 92%
rename from lib-mime/mime.c
rename to lib-mime/mime.cpkg
index 8f10d56..e953211 100644 (file)
  */
 
 #include <lib-lib/lib-lib.h>
-
+#include <lib-lua/lib-lua.h>
 #include "mime.h"
+@import "../lib-lua/base.cpkg"
 
 #define BOUNDARYLEN 16
-
 const char MimeSpecials[] = "@.,;:<>[]\\\"()?/= \t";
 
 const char *BodyTypes[] = {
@@ -52,6 +52,18 @@ const char *BodyEncodings[] = {
     "x-uuencoded",
 };
 
+@package Mime {
+    /*
+     ** .pp
+     ** ``$spam_separator'' controls what happens when multiple spam headers
+     ** are matched: if \fIunset\fP, each successive header will overwrite any
+     ** previous matches value for the spam label. If \fIset\fP, each successive
+     ** match will append to the previous, using ``$spam_separator'' as a
+     ** separator.
+     */
+    string_t spam_separator = m_strdup(",");
+};
+
 /****************************************************************************/
 /* rfc822 header parameters                                                 */
 /****************************************************************************/
@@ -243,3 +255,4 @@ int mutt_is_text_part(BODY * b)
     }
 }
 
+/* vim:set ft=c: */
index 0ff5bce..8feddfe 100644 (file)
@@ -32,6 +32,9 @@
 #include "mime-types.h"
 #include "mime-token.h"
 
+#include <lib-lua/lib-lua.h>
+#include "mime.li"
+
 extern const char MimeSpecials[];
 extern const char *BodyTypes[];
 extern const char *BodyEncodings[];
index 3e77c57..fa0beaa 100644 (file)
@@ -1034,15 +1034,12 @@ mutt_read_rfc822_header(FILE *f, HEADER *hdr, short user_hdrs, short weed)
         {
             /* if spam tag already exists, figure out how to amend it */
             if (e->spam && *buf) {
-                if (SpamSep) {
-                    /* If SpamSep defined, append with separator */
-                    mutt_buffer_addstr(e->spam, SpamSep);
-                    mutt_buffer_addstr(e->spam, buf);
+                if (Mime.spam_separator) {
+                    mutt_buffer_addstr(e->spam, Mime.spam_separator);
                 } else {
-                    /* else overwrite */
                     mutt_buffer_reset(e->spam);
-                    mutt_buffer_addstr(e->spam, buf);
                 }
+                mutt_buffer_addstr(e->spam, buf);
             }
 
             if (!e->spam) {
index 39394f5..1ae72cc 100644 (file)
@@ -1,8 +1,9 @@
 # automake sucks, badly
 all: ../lib-mime/mime-token.h \
-    ../lib-lua/lua-token.h    \
-    ../lib-lua/madmutt.li     \
-    ../charset.li
+     ../lib-mime/mime.li      \
+     ../lib-lua/lua-token.h   \
+     ../lib-lua/madmutt.li    \
+     ../charset.li
 
 ../%: ; $(MAKE) -C $(@D) $(@F)