[pan2: 21/68] Allow scoring article on all headers.
- From: Petr Kovář <pmkovar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2: 21/68] Allow scoring article on all headers.
- Date: Tue, 8 Feb 2011 22:59:47 +0000 (UTC)
commit 7fa5bdc4c926252df22c0a5c3d851ea1adc1f136
Author: K. Haley <haleykd users sf net>
Date: Tue Mar 23 15:16:27 2010 -0600
Allow scoring article on all headers.
If test needs the article body & it's cached then retreive the body for
scoring.
pan/data-impl/article-filter.cc | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/pan/data-impl/article-filter.cc b/pan/data-impl/article-filter.cc
index 3d0b827..c8678f1 100644
--- a/pan/data-impl/article-filter.cc
+++ b/pan/data-impl/article-filter.cc
@@ -22,6 +22,7 @@
#include <pan/general/debug.h>
#include <pan/general/macros.h>
#include <pan/data/data.h>
+#include <gmime/gmime.h>
#include <glib/gprintf.h>
#include "article-filter.h"
@@ -182,7 +183,19 @@ ArticleFilter :: test_article (const Data & data,
pass = criteria._text.test (s);
}
else
- pass = criteria._text.test (get_header(article, criteria._header));
+ if (!criteria._needs_body)
+ pass = criteria._text.test (get_header(article, criteria._header));
+ else
+ {
+ if (cache.contains(article.message_id)) {
+ ArticleCache::mid_sequence_t mid(1, article.message_id);
+ GMimeMessage *msg = cache.get_message(mid);
+ const char *hdr = g_mime_object_get_header(GMIME_OBJECT(msg), criteria._header);
+ pass = criteria._text.test (hdr);
+ g_object_unref(msg);
+ }
+ else pass = false;
+ }
break;
case FilterInfo::SCORE_GE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]