small reorg.
authorPierre Habouzit <madcoder@debian.org>
Sun, 3 Dec 2006 14:52:26 +0000 (15:52 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 3 Dec 2006 14:52:26 +0000 (15:52 +0100)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
copy.c
lib-lib/list.c
lib-lib/list.h
lib-mime/rfc822parse.c
mutt.h
muttlib.c

diff --git a/copy.c b/copy.c
index 55a3f4f..bf080fd 100644 (file)
--- a/copy.c
+++ b/copy.c
@@ -163,8 +163,8 @@ mutt_copy_hdr (FILE* in, FILE* out, off_t off_start, off_t off_end,
       /* note: CH_FROM takes precedence over header weeding. */
       if (!((flags & CH_FROM) && (flags & CH_FORCE_FROM) && this_is_from) &&
           (flags & CH_WEED) &&
       /* note: CH_FROM takes precedence over header weeding. */
       if (!((flags & CH_FROM) && (flags & CH_FORCE_FROM) && this_is_from) &&
           (flags & CH_WEED) &&
-          mutt_matches_ignore (buf, Ignore) &&
-          !mutt_matches_ignore (buf, UnIgnore))
+          string_list_contains(Ignore, buf, "*") &&
+          !string_list_contains(UnIgnore, buf, "*"))
         continue;
       if ((flags & CH_WEED_DELIVERED) &&
           ascii_strncasecmp ("Delivered-To:", buf, 13) == 0)
         continue;
       if ((flags & CH_WEED_DELIVERED) &&
           ascii_strncasecmp ("Delivered-To:", buf, 13) == 0)
index c2c4f77..25a6125 100644 (file)
@@ -37,6 +37,18 @@ string_list_t *string_list_dup(const string_list_t *p) {
     return res;
 }
 
     return res;
 }
 
+int string_list_contains(const string_list_t *t, const char *s, const char *any)
+{
+    while (t) {
+        if (!ascii_strncasecmp(s, t->data, m_strlen(t->data))
+        || (any && !ascii_strcasecmp(t->data, any)))
+            return 1;
+        t = t->next;
+    }
+    return 0;
+}
+
+
 /* FIXME: b0rken API's, replace that at any cost */
 string_list_t *mutt_add_list_n(string_list_t *head, const void *data, size_t len) {
     string_list_t *tmp;
 /* FIXME: b0rken API's, replace that at any cost */
 string_list_t *mutt_add_list_n(string_list_t *head, const void *data, size_t len) {
     string_list_t *tmp;
index b1b612e..bba82b1 100644 (file)
@@ -79,6 +79,7 @@ DO_DELETE(string_list_t, string_item);
 DO_SLIST(string_list_t, string, string_item_delete);
 
 string_list_t *string_list_dup(const string_list_t *);
 DO_SLIST(string_list_t, string, string_item_delete);
 
 string_list_t *string_list_dup(const string_list_t *);
+int string_list_contains(const string_list_t *, const char *, const char *);
 
 /* FIXME: b0rken API's, replace that at any cost */
 /* add an element to a list */
 
 /* FIXME: b0rken API's, replace that at any cost */
 /* add an element to a list */
index 6aaae2f..0b67479 100644 (file)
@@ -957,8 +957,8 @@ string_list_t **mutt_parse_rfc822_line(ENVELOPE *e, HEADER *hdr, char *line, cha
         /* restore the original line */
         line[m_strlen(line)] = ':';
 
         /* restore the original line */
         line[m_strlen(line)] = ':';
 
-        if (weed && mutt_matches_ignore(line, Ignore)
-        && !mutt_matches_ignore(line, UnIgnore)) {
+        if (weed && string_list_contains(Ignore, line, "*")
+        && !string_list_contains(UnIgnore, line, "*")) {
             break;
         }
 
             break;
         }
 
diff --git a/mutt.h b/mutt.h
index 520c4c9..34dff23 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -447,8 +447,6 @@ enum {
 #define toggle_option(x) mutt_bit_toggle(Options,x)
 #define option(x) mutt_bit_isset(Options,x)
 
 #define toggle_option(x) mutt_bit_toggle(Options,x)
 #define option(x) mutt_bit_isset(Options,x)
 
-int mutt_matches_ignore (const char *, string_list_t *);
-
 void mutt_init (int, string_list_t *);
 
 typedef struct thread {
 void mutt_init (int, string_list_t *);
 
 typedef struct thread {
index 5608e34..57fabf3 100644 (file)
--- a/muttlib.c
+++ b/muttlib.c
 #include <grp.h>
 #include <pwd.h>
 
 #include <grp.h>
 #include <pwd.h>
 
-#include <lib-mime/mime.h>
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
 #include <lib-sys/unix.h>
 #include <lib-ui/curses.h>
 #include <lib-ui/enter.h>
 #include <lib-sys/unix.h>
-#include <lib-mx/mx.h>
+#include <imap/imap.h>
 
 #include "alias.h"
 #include "mutt.h"
 #include "attach.h"
 
 #include "alias.h"
 #include "mutt.h"
 #include "attach.h"
-
 #include "version.h"
 
 #include "version.h"
 
-#include <imap/imap.h>
-
-#include <lib-crypt/crypt.h>
-
 /* Modified by blong to accept a "suggestion" for file name.  If
  * that file exists, then construct one with unique name but 
  * keep any extension.  This might fail, I guess.
 /* Modified by blong to accept a "suggestion" for file name.  If
  * that file exists, then construct one with unique name but 
  * keep any extension.  This might fail, I guess.
@@ -48,15 +42,15 @@ void mutt_adv_mktemp (const char* dir, char *s, ssize_t l)
     }
 }
 
     }
 }
 
-/* returns true if the header contained in "s" is in list "t" */
-int mutt_matches_ignore (const char *s, string_list_t * t)
+void mutt_mktemp(char *s)
 {
 {
-  for (; t; t = t->next) {
-    if (!ascii_strncasecmp (s, t->data, m_strlen(t->data))
-        || *t->data == '*')
-      return 1;
-  }
-  return 0;
+    int fd = m_tempfd(s, _POSIX_PATH_MAX, NONULL(Tempdir), NULL);
+    if (fd < 0) {
+        *s = '\0';
+    } else {
+        close(fd);
+        unlink(s);
+    }
 }
 
 ssize_t _mutt_expand_path(char *s, ssize_t slen, int rx)
 }
 
 ssize_t _mutt_expand_path(char *s, ssize_t slen, int rx)
@@ -168,17 +162,6 @@ ssize_t _mutt_expand_path(char *s, ssize_t slen, int rx)
     return m_strcpy(s, slen, tmp);
 }
 
     return m_strcpy(s, slen, tmp);
 }
 
-void mutt_mktemp(char *s)
-{
-    int fd = m_tempfd(s, _POSIX_PATH_MAX, NONULL(Tempdir), NULL);
-    if (fd < 0) {
-        *s = '\0';
-    } else {
-        close(fd);
-        unlink(s);
-    }
-}
-
 /* collapse the pathname using ~ or = when possible */
 void mutt_pretty_mailbox (char *s)
 {
 /* collapse the pathname using ~ or = when possible */
 void mutt_pretty_mailbox (char *s)
 {