summaryrefslogtreecommitdiffstats
path: root/maildrop/search.C
diff options
context:
space:
mode:
authorSam Varshavchik2018-02-16 20:54:41 -0500
committerSam Varshavchik2018-02-16 21:19:05 -0500
commitc6c18e6142360a30cc11bfe29ac8b762e99a2104 (patch)
treeee18c5fcb707c5d230950dd57e4ae619e3bd38b0 /maildrop/search.C
parent8b4fcc3895ca8243e200c15cd089323a482cad13 (diff)
downloadcourier-libs-c6c18e6142360a30cc11bfe29ac8b762e99a2104.tar.bz2
maildrop: Add :H pattern modifier to maildrop.
rfc2045: RFC2045_DECODEMSG_NOATTACHHEADERS flag, do not decode attachment headers. maildrop: The ":H" pattern modifier searches main headers only, does not search attachments' headers.
Diffstat (limited to 'maildrop/search.C')
-rw-r--r--maildrop/search.C16
1 files changed, 11 insertions, 5 deletions
diff --git a/maildrop/search.C b/maildrop/search.C
index c7fa007..9add6ee 100644
--- a/maildrop/search.C
+++ b/maildrop/search.C
@@ -32,18 +32,22 @@ void Search::cleanup()
int Search::init(const char *expr, const char *opts)
{
- match_header=0;
+ match_top_header=0;
+ match_other_headers=0;
match_body=0;
weight1=1;
weight2=1;
scoring_match=0;
score=0;
- if (strchr(opts, 'h')) match_header=1;
+ if (strchr(opts, 'h')) match_top_header=match_other_headers=1;
+ if (strchr(opts, 'H')) match_top_header=1;
+
if (strchr(opts, 'b')) match_body=1;
- if (!match_header && !match_body)
+ if (!match_top_header && !match_other_headers && !match_body)
{
- match_header=1;
+ match_top_header=1;
+ match_other_headers=1;
if (strchr(opts, 'w')) match_body=1;
}
@@ -203,8 +207,10 @@ int Search::findinline(Message &msg, const char *expr, Buffer *foreachp)
memset(&decode_cb, 0, sizeof(decode_cb));
- if (!match_header)
+ if (!match_top_header && !match_other_headers)
decode_cb.flags |= RFC2045_DECODEMSG_NOHEADERS;
+ else if (match_top_header && !match_other_headers)
+ decode_cb.flags |= RFC2045_DECODEMSG_NOATTACHHEADERS;
if (!match_body)
decode_cb.flags |= RFC2045_DECODEMSG_NOBODY;