always build mutt with pgp + smime support.
[apps/madmutt.git] / pattern.c
index f40ea59..335337e 100644 (file)
--- a/pattern.c
+++ b/pattern.c
 #include <lib-lib/macros.h>
 #include <lib-lib/file.h>
 #include <lib-lib/buffer.h>
+#include <lib-lib/mapping.h>
+
+#include <lib-mime/mime.h>
 
 #include "mutt.h"
 #include "handler.h"
 #include "enter.h"
 #include "mx.h"
-#include "mapping.h"
 #include "keymap.h"
 #include "copy.h"
-#include "mime.h"
 
 
 #ifdef USE_IMAP
@@ -179,8 +180,8 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno)
       if (pat->op != M_HEADER) {
         mutt_parse_mime_message (ctx, h);
 
-        if (WithCrypto && (h->security & ENCRYPT)
-            && !crypt_valid_passphrase (h->security)) {
+        if ((h->security & ENCRYPT) && !crypt_valid_passphrase (h->security))
+        {
           mx_close_message (&msg);
           if (fp) {
             fclose (fp);
@@ -815,7 +816,7 @@ pattern_t *mutt_pattern_comp ( /* const */ char *s, int flags, BUFFER * err)
         return NULL;
       }
       /* compile the sub-expression */
-      buf = str_substrdup (ps.dptr + 1, p);
+      buf = p_dupstr(ps.dptr + 1, p - ps.dptr - 1);
       if ((tmp = mutt_pattern_comp (buf, flags, err)) == NULL) {
         p_delete(&buf);
         mutt_pattern_free (&curlist);
@@ -876,11 +877,11 @@ static int match_adrlist (pattern_t* pat, int match_personal, int alladdr,
                           int n, ...)
 {
   va_list ap;
-  ADDRESS *a;
+  address_t *a;
 
   va_start (ap, n);
   for (; n; n--) {
-    for (a = va_arg (ap, ADDRESS *); a; a = a->next) {
+    for (a = va_arg (ap, address_t *); a; a = a->next) {
       if (pat->alladdr ^
           ((a->mailbox && patmatch (pat, a->mailbox) == 0) ||
            (match_personal && a->personal &&
@@ -902,7 +903,7 @@ static int match_reference (pattern_t* pat, LIST * refs)
   return 0;
 }
 
-int mutt_is_list_recipient (int alladdr, ADDRESS * a1, ADDRESS * a2)
+int mutt_is_list_recipient (int alladdr, address_t * a1, address_t * a2)
 {
   for (; a1; a1 = a1->next)
     if (alladdr ^ mutt_is_subscribed_list (a1))
@@ -913,7 +914,7 @@ int mutt_is_list_recipient (int alladdr, ADDRESS * a1, ADDRESS * a2)
   return alladdr;
 }
 
-int mutt_is_list_cc (int alladdr, ADDRESS * a1, ADDRESS * a2)
+int mutt_is_list_cc (int alladdr, address_t * a1, address_t * a2)
 {
   for (; a1; a1 = a1->next)
     if (alladdr ^ mutt_is_mail_list (a1))
@@ -924,7 +925,7 @@ int mutt_is_list_cc (int alladdr, ADDRESS * a1, ADDRESS * a2)
   return alladdr;
 }
 
-static int match_user (int alladdr, ADDRESS * a1, ADDRESS * a2)
+static int match_user (int alladdr, address_t * a1, address_t * a2)
 {
   for (; a1; a1 = a1->next)
     if (alladdr ^ mutt_addr_is_user (a1))
@@ -1068,20 +1069,12 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags,
   case M_COLLAPSED:
     return (pat->not ^ (h->collapsed && h->num_hidden > 1));
   case M_CRYPT_SIGN:
-    if (!WithCrypto)
-      break;
     return (pat->not ^ ((h->security & SIGN) ? 1 : 0));
   case M_CRYPT_VERIFIED:
-    if (!WithCrypto)
-      break;
     return (pat->not ^ ((h->security & GOODSIGN) ? 1 : 0));
   case M_CRYPT_ENCRYPT:
-    if (!WithCrypto)
-      break;
     return (pat->not ^ ((h->security & ENCRYPT) ? 1 : 0));
   case M_PGP_KEY:
-    if (!(WithCrypto & APPLICATION_PGP))
-      break;
     return (pat->not ^ ((h->security & APPLICATION_PGP)
                         && (h->security & PGPKEY)));
   case M_XLABEL: