[Commits] [SCM] claws branch, master, updated. 3.10.1-156-gb29a924

mones at claws-mail.org mones at claws-mail.org
Thu Sep 11 12:24:31 CEST 2014


The branch, master has been updated
       via  b29a924ece7da846e2871bea8bbddde98edcb5cf (commit)
      from  9d30727d92db5a901a29998b172a1c9b03138517 (commit)

Summary of changes:
 README                                         |    3 +-
 src/advsearch.c                                |    3 +-
 src/gtk/quicksearch.c                          |    3 +-
 src/imap.c                                     |    4 ++-
 src/matcher.c                                  |   43 +++++++++++++++++++-----
 src/matcher.h                                  |    3 +-
 src/matcher_parser_parse.y                     |   21 +++++++++++-
 src/plugins/perl/cm_perl.pod                   |   11 +++---
 src/plugins/perl/perl_plugin.c                 |   13 ++++++-
 src/plugins/perl/tools/matcherrc2perlfilter.pl |    3 +-
 src/prefs_matcher.c                            |   25 ++++++++++++--
 src/procheader.c                               |   30 ++++++++++++++++-
 src/procheader.h                               |    3 +-
 src/textview.c                                 |   25 ++------------
 tools/filter_conv_new.pl                       |    2 ++
 15 files changed, 143 insertions(+), 49 deletions(-)


- Log -----------------------------------------------------------------
commit b29a924ece7da846e2871bea8bbddde98edcb5cf
Author: Ricardo Mones <ricardo at mones.org>
Date:   Wed Sep 10 23:37:11 2014 +0200

    Add new quicksearch for header's content only
    
    • The new “H S” filter searches for mail that contains string S in
      the content of any non-internal header.
    
    Based on patches¹² by H.Merijn Brand <h.m.brand at xs4all.nl>, with some
    reversion, refactoring, minor improvements and fixed typos.
    
    ¹ http://lists.claws-mail.org/pipermail/devel/2014-August/001257.html
    ² http://lists.claws-mail.org/pipermail/devel/2014-August/001258.html

diff --git a/README b/README
index af49120..8d23cfe 100644
--- a/README
+++ b/README
@@ -393,7 +393,8 @@ http://www.claws-mail.org/plugins.php
     E        S          true if execute "S" succeeds
     f        S          messages originating from user S
     F                   forwarded messages
-    h        S          messages which contain header S
+    h        S          messages which contain S in any header name or value
+    H        S          messages which contain S in the value of any header
     i        S          messages which contain S in Message-Id header
     I        S          messages which contain S in inreplyto header
     k	     #		messages which are marked with color #
diff --git a/src/advsearch.c b/src/advsearch.c
index 26a4e34..7439bb5 100644
--- a/src/advsearch.c
+++ b/src/advsearch.c
@@ -1,6 +1,6 @@
 /*
  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2012 the Claws Mail team
+ * Copyright (C) 2012-2014 the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -162,6 +162,7 @@ gchar *advsearch_expand_search_string(const gchar *search_string)
 		{ "f",	"from",				1,	TRUE,	TRUE  },
 		{ "F",	"forwarded",			0,	FALSE,	FALSE },
 		{ "h",	"headers_part",			1,	TRUE,	TRUE  },
+		{ "H",	"headers_cont",			1,	TRUE,	TRUE  },
 		{ "ha",	"has_attachments",		0,	FALSE,	FALSE },
 		{ "i",	"header \"Message-ID\"",	1,	TRUE,	TRUE  },
 		{ "I",	"inreplyto",			1,	TRUE,	TRUE  },
diff --git a/src/gtk/quicksearch.c b/src/gtk/quicksearch.c
index 54b6b92..c7c705e 100644
--- a/src/gtk/quicksearch.c
+++ b/src/gtk/quicksearch.c
@@ -463,7 +463,8 @@ static gchar *search_descr_strings[] = {
 	"f S",	 N_("messages originating from user S"),
 	"F",	 N_("forwarded messages"),
 	"ha",	 N_("messages which have attachments"),
-	"h S",	 N_("messages which contain header S"),
+	"h S",	 N_("messages which contain S in any header name or value"),
+	"H S",	 N_("messages which contain S in the value of any header"),
 	"i S",	 N_("messages which contain S in Message-ID header"),
 	"I S",	 N_("messages which contain S in In-Reply-To header"),
 	"k #",	 N_("messages which are marked with color #"),
diff --git a/src/imap.c b/src/imap.c
index 5608dc8..0ec8131 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2014 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -2098,6 +2098,7 @@ static IMAPSearchKey* search_make_key(MatcherProp* match, gboolean* is_all)
 		case MATCHCRITERIA_NOT_HEADER: invert = TRUE; matchertype = MATCHCRITERIA_HEADER; break;
 		case MATCHCRITERIA_NOT_TAG: invert = TRUE; matchertype = MATCHCRITERIA_TAG; break;
 		case MATCHCRITERIA_NOT_HEADERS_PART: invert = TRUE; matchertype = MATCHCRITERIA_HEADERS_PART; break;
+		case MATCHCRITERIA_NOT_HEADERS_CONT: invert = TRUE; matchertype = MATCHCRITERIA_HEADERS_CONT; break;
 		case MATCHCRITERIA_NOT_MESSAGE: invert = TRUE; matchertype = MATCHCRITERIA_MESSAGE; break;
 		case MATCHCRITERIA_NOT_BODY_PART: invert = TRUE; matchertype = MATCHCRITERIA_BODY_PART; break;
 		case MATCHCRITERIA_NOT_TO_AND_NOT_CC: invert = TRUE; matchertype = MATCHCRITERIA_TO_OR_CC; break;
@@ -2143,6 +2144,7 @@ static IMAPSearchKey* search_make_key(MatcherProp* match, gboolean* is_all)
 			break;
 
 		case MATCHCRITERIA_HEADERS_PART:
+		case MATCHCRITERIA_HEADERS_CONT:
 			result = imap_search_and(
 					imap_search_not(imap_search_new(IMAP_SEARCH_CRITERIA_BODY, NULL, match->expr, 0)),
 					imap_search_new(IMAP_SEARCH_CRITERIA_MESSAGE, NULL, match->expr, 0)
diff --git a/src/matcher.c b/src/matcher.c
index 4382c59..1f191d9 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 by the Claws Mail Team and Hiroyuki Yamamoto
+ * Copyright (C) 2002-2014 by the Claws Mail Team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -135,6 +135,8 @@ static const MatchParser matchparser_tab[] = {
 	{MATCHCRITERIA_NOT_HEADER, "~header"},
 	{MATCHCRITERIA_HEADERS_PART, "headers_part"},
 	{MATCHCRITERIA_NOT_HEADERS_PART, "~headers_part"},
+	{MATCHCRITERIA_HEADERS_CONT, "headers_cont"},
+	{MATCHCRITERIA_NOT_HEADERS_CONT, "~headers_cont"},
 	{MATCHCRITERIA_MESSAGE, "message"},
 	{MATCHCRITERIA_NOT_MESSAGE, "~message"},
 	{MATCHCRITERIA_BODY_PART, "body_part"},
@@ -620,18 +622,32 @@ const gchar *debug_context)
 }
 
 static gboolean matcherprop_header_line_match(MatcherProp *prop, const gchar *hdr,
-					      const gchar *str, const gchar *debug_context)
+					 const gchar *str, const gboolean both,
+					 const gchar *debug_context)
 {
-	gchar *line = NULL;
 	gboolean res = FALSE;
 
 	if (hdr == NULL || str == NULL)
 		return FALSE;
 
-	line = g_strdup_printf("%s %s", hdr, str);
-	res = matcherprop_string_match(prop, line, debug_context);
-	g_free(line);
-       
+	if (both) {
+		/* Search in all header names and content.
+		 */
+		gchar *line = g_strdup_printf("%s %s", hdr, str);
+		res = matcherprop_string_match(prop, line, debug_context);
+		g_free(line);
+	} else {
+		/* Search only in content and exclude private headers.
+		 * E.g.: searching for "H foo" in folder x/foo would return
+		 * *all* mail as SCF and RMID will match.
+		 * Searching for "H sent" would return all resent messages
+		 * as "Resent-From: whatever" will match.
+		 */
+		if (procheader_header_is_internal(hdr))
+			return FALSE;
+		res = matcherprop_string_match(prop, str, debug_context);
+	}
+
 	return res;
 }
 
@@ -1305,21 +1321,27 @@ static gboolean matcherprop_match_one_header(MatcherProp *matcher,
 		}
 		break;
 	case MATCHCRITERIA_HEADERS_PART:
+	case MATCHCRITERIA_HEADERS_CONT:
 	case MATCHCRITERIA_MESSAGE:
 		header = procheader_parse_header(buf);
 		if (!header)
 			return FALSE;
 		result = matcherprop_header_line_match(matcher, 
-			       header->name, header->body, context_str[CONTEXT_HEADER_LINE]);
+			       header->name, header->body,
+			       (matcher->criteria == MATCHCRITERIA_HEADERS_PART),
+			       context_str[CONTEXT_HEADER_LINE]);
 		procheader_header_free(header);
 		return result;
+	case MATCHCRITERIA_NOT_HEADERS_CONT:
 	case MATCHCRITERIA_NOT_HEADERS_PART:
 	case MATCHCRITERIA_NOT_MESSAGE:
 		header = procheader_parse_header(buf);
 		if (!header)
 			return FALSE;
 		result = !matcherprop_header_line_match(matcher, 
-			       header->name, header->body, context_str[CONTEXT_HEADER_LINE]);
+			       header->name, header->body,
+			       (matcher->criteria == MATCHCRITERIA_NOT_HEADERS_PART),
+			       context_str[CONTEXT_HEADER_LINE]);
 		procheader_header_free(header);
 		return result;
 	case MATCHCRITERIA_FOUND_IN_ADDRESSBOOK:
@@ -1391,7 +1413,9 @@ static gboolean matcherprop_criteria_headers(const MatcherProp *matcher)
 	case MATCHCRITERIA_HEADER:
 	case MATCHCRITERIA_NOT_HEADER:
 	case MATCHCRITERIA_HEADERS_PART:
+	case MATCHCRITERIA_HEADERS_CONT:
 	case MATCHCRITERIA_NOT_HEADERS_PART:
+	case MATCHCRITERIA_NOT_HEADERS_CONT:
 	case MATCHCRITERIA_FOUND_IN_ADDRESSBOOK:
 	case MATCHCRITERIA_NOT_FOUND_IN_ADDRESSBOOK:
 		return TRUE;
@@ -1446,6 +1470,7 @@ static gboolean matcherlist_match_headers(MatcherList *matchers, FILE *fp)
 
 			/* determine the match range (all, any are our concern here) */
 			if (matcher->criteria == MATCHCRITERIA_NOT_HEADERS_PART ||
+			    matcher->criteria == MATCHCRITERIA_NOT_HEADERS_CONT ||
 			    matcher->criteria == MATCHCRITERIA_NOT_MESSAGE) {
 				match = MATCH_ALL;
 
diff --git a/src/matcher.h b/src/matcher.h
index 62d5352..b8e637d 100644
--- a/src/matcher.h
+++ b/src/matcher.h
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2002-2012 by the Claws Mail Team and Hiroyuki Yamamoto
+ * Copyright (C) 2002-2014 by the Claws Mail Team and Hiroyuki Yamamoto
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -96,6 +96,7 @@ enum {
 	MC_(SCORE_GREATER), MC_(SCORE_LOWER),
 	MC_(HEADER), MC_(NOT_HEADER),
 	MC_(HEADERS_PART), MC_(NOT_HEADERS_PART),
+	MC_(HEADERS_CONT), MC_(NOT_HEADERS_CONT),
 	MC_(MESSAGE), MC_(NOT_MESSAGE),
 	MC_(BODY_PART), MC_(NOT_BODY_PART),
 	MC_(TEST), MC_(NOT_TEST),
diff --git a/src/matcher_parser_parse.y b/src/matcher_parser_parse.y
index 2947544..906a623 100644
--- a/src/matcher_parser_parse.y
+++ b/src/matcher_parser_parse.y
@@ -1,7 +1,7 @@
 %{
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (c) 2001-2007 by Hiroyuki Yamamoto & The Claws Mail Team
+ * Copyright (c) 2001-2014 by Hiroyuki Yamamoto & The Claws Mail Team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -324,6 +324,7 @@ int matcher_parserwrap(void)
 %token MATCHER_REFERENCES  MATCHER_NOT_REFERENCES  MATCHER_SCORE_GREATER
 %token MATCHER_SCORE_LOWER  MATCHER_HEADER  MATCHER_NOT_HEADER
 %token MATCHER_HEADERS_PART  MATCHER_NOT_HEADERS_PART  MATCHER_MESSAGE
+%token MATCHER_HEADERS_CONT  MATCHER_NOT_HEADERS_CONT
 %token MATCHER_NOT_MESSAGE  MATCHER_BODY_PART  MATCHER_NOT_BODY_PART
 %token MATCHER_TEST  MATCHER_NOT_TEST  MATCHER_MATCHCASE  MATCHER_MATCH
 %token MATCHER_REGEXPCASE  MATCHER_REGEXP  MATCHER_SCORE  MATCHER_MOVE
@@ -1121,6 +1122,24 @@ MATCHER_ALL
 	expr = $3;
 	prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
 }
+| MATCHER_HEADERS_CONT match_type MATCHER_STRING
+{
+	gint criteria = 0;
+	gchar *expr = NULL;
+	matcher_is_fast = FALSE;
+	criteria = MATCHCRITERIA_HEADERS_CONT;
+	expr = $3;
+	prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+}
+| MATCHER_NOT_HEADERS_CONT match_type MATCHER_STRING
+{
+	gint criteria = 0;
+	gchar *expr = NULL;
+	matcher_is_fast = FALSE;
+	criteria = MATCHCRITERIA_NOT_HEADERS_CONT;
+	expr = $3;
+	prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+}
 | MATCHER_FOUND_IN_ADDRESSBOOK MATCHER_STRING
 {
 	header = g_strdup($2);
diff --git a/src/plugins/perl/cm_perl.pod b/src/plugins/perl/cm_perl.pod
index 7515fe3..bb190a3 100644
--- a/src/plugins/perl/cm_perl.pod
+++ b/src/plugins/perl/cm_perl.pod
@@ -244,11 +244,12 @@ Filename -- should not be modified
 =item regexpcase WHERE WHAT
 
 The matching functions have a special syntax. The first argument
-is either any of to_or_cc, body_part, headers_part, message, to,
-from, subject, cc, newsgroups, inreplyto, references, or tag (those
-strings may or may not be quoted), the patter matching works on
-that area. If it is any other string (which must then be quoted),
-this string is taken to be the name of a header field.
+is either any of to_or_cc, body_part, headers_part, headers_cont,
+message, to, from, subject, cc, newsgroups, inreplyto,
+references, or tag (those strings may or may not be quoted), the
+pattern matching works on that area. If it is any other string
+(which must then be quoted), this string is taken to be the name
+of a header field.
 
 The second argument is the string to look for. For match,
 matchcase, regexp and regexpcase we have case sensitive normal
diff --git a/src/plugins/perl/perl_plugin.c b/src/plugins/perl/perl_plugin.c
index fd69a32..767e848 100644
--- a/src/plugins/perl/perl_plugin.c
+++ b/src/plugins/perl/perl_plugin.c
@@ -1708,7 +1708,7 @@ static int perl_init(void)
 "     qw(forwarded locked colorlabel match matchcase),\n"
 "     qw(regexp regexpcase test),\n"
 "     qw(to cc subject from to_or_cc newsgroups inreplyto),\n"
-"     qw(references body_part headers_part message),\n"
+"     qw(references body_part headers_part headers_cont message),\n"
 "     qw(size_greater size_smaller size_equal),\n"
 "     qw(score_greater score_lower score_equal),\n"
 "     qw(age_greater age_lower partial tagged $permanent));\n"
@@ -1737,6 +1737,7 @@ static int perl_init(void)
 "sub references   { return \"references\";    }\n"
 "sub body_part    { return \"body_part\";     }\n"
 "sub headers_part { return \"headers_part\";  }\n"
+"sub headers_cont { return \"headers_cont\";  }\n"
 "sub message      { return \"message\";       }\n"
 "# access the mail directly\n"
 "sub header {\n"
@@ -1994,6 +1995,16 @@ static int perl_init(void)
 "      return ($myheader =~ m/$what/) unless $nocase;\n"
 "      return ($myheader =~ m/$what/i);\n"
 "    }\n"
+"  } elsif($where eq \"headers_cont\") {\n"
+"    (my $myheader = header_as_string_()) =~ s{^\\S+:\\s*}{};\n"
+"    if(not $regexp) {\n"
+"      $myheader =~ s/\\s+/ /g;\n"
+"      return (index($myheader,$what) != -1) unless $nocase;\n"
+"      return (index(lc2_($myheader),lc2_($what)) != -1);\n"
+"    } else {\n"
+"      return ($myheader =~ m/$what/) unless $nocase;\n"
+"      return ($myheader =~ m/$what/i);\n"
+"    }\n"
 "  } elsif($where eq \"message\") {\n"
 "    my $message = header_as_string_();\n"
 "    $message .= \"\\n\".body();\n"
diff --git a/src/plugins/perl/tools/matcherrc2perlfilter.pl b/src/plugins/perl/tools/matcherrc2perlfilter.pl
index 5372372..8b0dad9 100755
--- a/src/plugins/perl/tools/matcherrc2perlfilter.pl
+++ b/src/plugins/perl/tools/matcherrc2perlfilter.pl
@@ -7,7 +7,7 @@
 # intended to get you started. If you choose to use the Perl plugin,
 # consider rewriting your rules.
 #
-# Copyright (C) 2004 Holger Berndt
+# Copyright (C) 2004-2014 Holger Berndt
 #
 #
 # This file is free software; you can redistribute it and/or modify it
@@ -128,6 +128,7 @@ sub convert {
 	      $token eq "inreplyto"     or
 	      $token eq "references"    or
 	      $token eq "headers_part"  or
+	      $token eq "headers_cont"  or
 	      $token eq "body_part"     or
 	      $token eq "message") {
 	    my $match = shift;
diff --git a/src/prefs_matcher.c b/src/prefs_matcher.c
index 1f2d30f..bb9c723 100644
--- a/src/prefs_matcher.c
+++ b/src/prefs_matcher.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2014 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -186,7 +186,9 @@ enum {
 	CRITERIA_SIGNED = 38,
 
 	CRITERIA_AGE_GREATER_HOURS = 39,
-	CRITERIA_AGE_LOWER_HOURS = 40
+	CRITERIA_AGE_LOWER_HOURS = 40,
+
+	CRITERIA_HEADERS_CONT = 41
 };
 
 enum {
@@ -379,6 +381,7 @@ static void prefs_matcher_models_create(void)
 	
 	store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
 	COMBOBOX_ADD(store, _("headers part"), CRITERIA_HEADERS_PART);
+	COMBOBOX_ADD(store, _("headers values"), CRITERIA_HEADERS_CONT);
 	COMBOBOX_ADD(store, _("body part"), CRITERIA_BODY_PART);
 	COMBOBOX_ADD(store, _("whole message"), CRITERIA_MESSAGE);
 	matcher.model_phrase = GTK_TREE_MODEL(store);
@@ -1148,6 +1151,9 @@ static gint prefs_matcher_get_criteria_from_matching(gint matching_id)
 	case MATCHCRITERIA_NOT_HEADERS_PART:
 	case MATCHCRITERIA_HEADERS_PART:
 		return CRITERIA_HEADERS_PART;
+	case MATCHCRITERIA_NOT_HEADERS_CONT:
+	case MATCHCRITERIA_HEADERS_CONT:
+		return CRITERIA_HEADERS_CONT;
 	case MATCHCRITERIA_NOT_HEADER:
 	case MATCHCRITERIA_HEADER:
 		return CRITERIA_HEADER;
@@ -1263,6 +1269,8 @@ static gint prefs_matcher_get_matching_from_criteria(gint criteria_id)
 		return MATCHCRITERIA_HEADER;
 	case CRITERIA_HEADERS_PART:
 		return MATCHCRITERIA_HEADERS_PART;
+	case CRITERIA_HEADERS_CONT:
+		return MATCHCRITERIA_HEADERS_CONT;
 	case CRITERIA_BODY_PART:
 		return MATCHCRITERIA_BODY_PART;
 	case CRITERIA_MESSAGE:
@@ -1347,6 +1355,8 @@ static gint prefs_matcher_not_criteria(gint matcher_criteria)
 		return MATCHCRITERIA_NOT_HEADER;
 	case MATCHCRITERIA_HEADERS_PART:
 		return MATCHCRITERIA_NOT_HEADERS_PART;
+	case MATCHCRITERIA_HEADERS_CONT:
+		return MATCHCRITERIA_NOT_HEADERS_CONT;
 	case MATCHCRITERIA_MESSAGE:
 		return MATCHCRITERIA_NOT_MESSAGE;
 	case MATCHCRITERIA_TEST:
@@ -1411,6 +1421,7 @@ static gint prefs_matcher_get_pred(const gint criteria)
 	case CRITERIA_REFERENCES:
 	case CRITERIA_HEADER:
 	case CRITERIA_HEADERS_PART:
+	case CRITERIA_HEADERS_CONT:
 	case CRITERIA_BODY_PART:
 	case CRITERIA_MESSAGE:
 	case CRITERIA_TAG:
@@ -1514,6 +1525,7 @@ static MatcherProp *prefs_matcher_dialog_to_matcher(void)
 	case CRITERIA_INREPLYTO:
 	case CRITERIA_REFERENCES:
 	case CRITERIA_HEADERS_PART:
+	case CRITERIA_HEADERS_CONT:
 	case CRITERIA_BODY_PART:
 	case CRITERIA_MESSAGE:
 		expr = gtk_entry_get_text(GTK_ENTRY(matcher.string_entry));
@@ -1829,6 +1841,10 @@ static void prefs_matcher_second_criteria_sel(GtkWidget *widget,
 			gtk_label_set_text(GTK_LABEL(matcher.match_label),
 					_("Headers part"));
 			break;
+		case CRITERIA_HEADERS_CONT:
+			gtk_label_set_text(GTK_LABEL(matcher.match_label),
+					_("Headers values"));
+			break;
 		case CRITERIA_BODY_PART:
 			gtk_label_set_text(GTK_LABEL(matcher.match_label),
 					_("Body part"));
@@ -2317,6 +2333,7 @@ static void prefs_matcher_set_criteria(const gint criteria)
 		match_criteria = MATCH_HEADER;
 		break;
 	case CRITERIA_HEADERS_PART:
+	case CRITERIA_HEADERS_CONT:
 	case CRITERIA_BODY_PART:
 	case CRITERIA_MESSAGE:
 		match_criteria = MATCH_PHRASE;
@@ -2448,6 +2465,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 	case MATCHCRITERIA_NOT_REFERENCES:
 	case MATCHCRITERIA_NOT_HEADER:
 	case MATCHCRITERIA_NOT_HEADERS_PART:
+	case MATCHCRITERIA_NOT_HEADERS_CONT:
 	case MATCHCRITERIA_NOT_MESSAGE:
 	case MATCHCRITERIA_NOT_BODY_PART:
 	case MATCHCRITERIA_NOT_TEST:
@@ -2470,6 +2488,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 	case MATCHCRITERIA_NOT_INREPLYTO:
 	case MATCHCRITERIA_NOT_REFERENCES:
 	case MATCHCRITERIA_NOT_HEADERS_PART:
+	case MATCHCRITERIA_NOT_HEADERS_CONT:
 	case MATCHCRITERIA_NOT_BODY_PART:
 	case MATCHCRITERIA_NOT_MESSAGE:
 	case MATCHCRITERIA_NOT_TEST:
@@ -2483,6 +2502,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 	case MATCHCRITERIA_INREPLYTO:
 	case MATCHCRITERIA_REFERENCES:
 	case MATCHCRITERIA_HEADERS_PART:
+	case MATCHCRITERIA_HEADERS_CONT:
 	case MATCHCRITERIA_BODY_PART:
 	case MATCHCRITERIA_MESSAGE:
 	case MATCHCRITERIA_TEST:
@@ -2593,6 +2613,7 @@ static gboolean prefs_matcher_selected(GtkTreeSelection *selector,
 	case CRITERIA_REFERENCES:
 	case CRITERIA_HEADER:
 	case CRITERIA_HEADERS_PART:
+	case CRITERIA_HEADERS_CONT:
 	case CRITERIA_BODY_PART:
 	case CRITERIA_MESSAGE:
 	case CRITERIA_TAG:
diff --git a/src/procheader.c b/src/procheader.c
index 330a310..bfa31f1 100644
--- a/src/procheader.c
+++ b/src/procheader.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2014 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1091,3 +1091,31 @@ void procheader_entries_free (HeaderEntry *entries)
 	}
 }
 
+gboolean procheader_header_is_internal(const gchar *hdr_name)
+{
+	const gchar *internal_hdrs[] = {
+		"AF:", "NF:", "PS:", "SRH:", "SFN:", "DSR:", "MID:", "CFG:",
+		"PT:", "S:", "RQ:", "SSV:", "NSV:", "SSH:", "R:", "MAID:",
+		"SCF:", "RMID:", "FMID:", "NAID:",
+		"X-Claws-Account-Id:",
+		"X-Claws-Sign:",
+		"X-Claws-Encrypt:",
+		"X-Claws-Privacy-System:",
+		"X-Claws-Auto-Wrapping:",
+		"X-Claws-Auto-Indent:",
+		"X-Claws-End-Special-Headers:",
+		"X-Sylpheed-Account-Id:",
+		"X-Sylpheed-Sign:",
+		"X-Sylpheed-Encrypt:",
+		"X-Sylpheed-Privacy-System:",
+		"X-Sylpheed-End-Special-Headers:",
+	         NULL
+	};
+	int i;
+
+	for (i = 0; internal_hdrs[i]; i++) {
+	        if (!strcmp(hdr_name, internal_hdrs[i]))
+	                return TRUE;
+	}
+	return FALSE;
+}
diff --git a/src/procheader.h b/src/procheader.h
index b8e48fc..e4cb92d 100644
--- a/src/procheader.h
+++ b/src/procheader.h
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Copyright (C) 1999-2014 Hiroyuki Yamamoto and the Claws Mail team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -95,4 +95,5 @@ gint procheader_get_header_from_msginfo	(MsgInfo	*msginfo,
 
 HeaderEntry *procheader_entries_from_str(const gchar	*str);
 void procheader_entries_free		(HeaderEntry	*entries);
+gboolean procheader_header_is_internal	(const gchar	*hdr_name);
 #endif /* __PROCHEADER_H__ */
diff --git a/src/textview.c b/src/textview.c
index ae6de82..b2a0985 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1874,27 +1874,6 @@ void textview_set_position(TextView *textview, gint pos)
 	gtkut_text_view_set_position(text, pos);
 }
 
-static gboolean header_is_internal(Header *header)
-{
-	const gchar *internal_hdrs[] = 
-		{"AF:", "NF:", "PS:", "SRH:", "SFN:", "DSR:", "MID:", 
-		 "CFG:", "PT:", "S:", "RQ:", "SSV:", "NSV:", "SSH:", 
-		 "R:", "MAID:", "SCF:", "RMID:", "FMID:", "NAID:", 
-		 "X-Claws-Account-Id:", "X-Claws-Sign:", "X-Claws-Encrypt:", 
-		 "X-Claws-Privacy-System:", "X-Claws-End-Special-Headers:",
-		 "X-Sylpheed-Account-Id:", "X-Sylpheed-Sign:", "X-Sylpheed-Encrypt:", 
-		 "X-Claws-Auto-Wrapping:", "X-Claws-Auto-Indent:",
-		 "X-Sylpheed-Privacy-System:", "X-Sylpheed-End-Special-Headers:",
-		 NULL};
-	int i;
-	
-	for (i = 0; internal_hdrs[i]; i++) {
-		if (!strcmp(header->name, internal_hdrs[i]))
-			return TRUE;
-	}
-	return FALSE;
-}
-
 static GPtrArray *textview_scan_header(TextView *textview, FILE *fp)
 {
 	gchar buf[BUFFSIZE];
@@ -1910,7 +1889,7 @@ static GPtrArray *textview_scan_header(TextView *textview, FILE *fp)
 		sorted_headers = g_ptr_array_new();
 		for (i = 0; i < headers->len; i++) {
 			header = g_ptr_array_index(headers, i);
-			if (!header_is_internal(header))
+			if (!procheader_header_is_internal(header->name))
 				g_ptr_array_add(sorted_headers, header);
 			else
 				procheader_header_free(header);
@@ -1953,7 +1932,7 @@ static GPtrArray *textview_scan_header(TextView *textview, FILE *fp)
 	if (prefs_common.show_other_header) {
 		for (i = 0; i < headers->len; i++) {
 			header = g_ptr_array_index(headers, i);
-			if (!header_is_internal(header)) {
+			if (!procheader_header_is_internal(header->name)) {
 				g_ptr_array_add(sorted_headers, header);
 			} else {
 				procheader_header_free(header);
diff --git a/tools/filter_conv_new.pl b/tools/filter_conv_new.pl
index adc6278..4bae1bc 100755
--- a/tools/filter_conv_new.pl
+++ b/tools/filter_conv_new.pl
@@ -179,6 +179,8 @@ foreach my $element ($xmlobj->child("filter")->children("rule")) {
 					}
 					if ($condition eq "match-any-header") {
 						$new_filter .= "headers_part ";
+					} elsif ($condition eq "match-header-content") {
+						$new_filter .= "headers_cont ";
 					} elsif ($condition eq "match-to-or-cc") {
 						$new_filter .= "to_or_cc ";
 					} elsif ($condition eq "match-body-text") {

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list