partial download search speedup
authorColin Leroy <colin@colino.net>
Wed, 8 Dec 2004 11:29:25 +0000 (11:29 +0000)
committerColin Leroy <colin@colino.net>
Wed, 8 Dec 2004 11:29:25 +0000 (11:29 +0000)
ChangeLog.claws
PATCHSETS
configure.ac
src/common/defs.h
src/matcher.c
src/matcher_parser_parse.y
src/msgcache.c
src/prefs_matcher.c
src/procheader.c

index 2957d3d..8eee7ad 100644 (file)
@@ -1,3 +1,16 @@
+2004-12-08 [colin]     0.9.13cvs7
+
+       * src/matcher_parser_parse.y
+       * src/msgcache.c
+       * src/prefs_matcher.c
+       * src/procheader.c
+       * src/matcher.c
+       * src/common/defs.h
+               Cache total_size and use that to speed up
+               'partial' match.
+               Add 'partial' to the list of useable stuff
+               in filtering
+
 2004-12-08 [paul]
 
        * po/sr.po
index 0657523..b16c790 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.99 -r 1.100 src/procmime.c; ) > 0.9.13cvs4.patchset
 ( cvs diff -u -r 1.25 -r 1.26 src/quote_fmt_parse.y ) > 0.9.13cvs5.patchset
 ( cvs diff -u -r 1.129 -r 1.130 src/textview.c; ) > 0.9.13cvs6.patchset
+( cvs diff -u -r 1.36 -r 1.37 src/matcher_parser_parse.y; cvs diff -u -r 1.28 -r 1.29 src/msgcache.c; cvs diff -u -r 1.48 -r 1.49 src/prefs_matcher.c; cvs diff -u -r 1.60 -r 1.61 src/procheader.c; cvs diff -u -r 1.88 -r 1.89 src/matcher.c; cvs diff -u -r 1.17 -r 1.18 src/common/defs.h; ) > 0.9.13cvs7.patchset
index 0f733e1..212109a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=13
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=6
+EXTRA_VERSION=7
 EXTRA_RELEASE=
 
 if test \( $EXTRA_VERSION -eq 0 \) -o \( "x$EXTRA_RELEASE" != "x" \); then
index e0cb0d5..dc1cca1 100644 (file)
@@ -77,7 +77,7 @@
 #define FOLDER_LIST            "folderlist.xml"
 #define CACHE_FILE             ".sylpheed_cache"
 #define MARK_FILE              ".sylpheed_mark"
-#define CACHE_VERSION          22
+#define CACHE_VERSION          23
 #define MARK_VERSION           2
 
 #define DEFAULT_SIGNATURE      ".signature"
index 3bbbc13..59515f9 100644 (file)
@@ -492,6 +492,12 @@ gboolean matcherprop_match(MatcherProp *prop,
        case MATCHCRITERIA_SIZE_SMALLER:
                /* FIXME: info->size is an off_t */
                return info->size <  (off_t) prop->value;
+       case MATCHCRITERIA_PARTIAL:
+               /* FIXME: info->size is an off_t */
+               return (info->total_size != 0 && info->size != (off_t)info->total_size);
+       case MATCHCRITERIA_NOT_PARTIAL:
+               /* FIXME: info->size is an off_t */
+               return (info->total_size == 0 || info->size == (off_t)info->total_size);
        case MATCHCRITERIA_NEWSGROUPS:
                return matcherprop_string_match(prop, info->newsgroups);
        case MATCHCRITERIA_NOT_NEWSGROUPS:
@@ -603,10 +609,6 @@ static gboolean matcherprop_match_one_header(MatcherProp *matcher,
        case MATCHCRITERIA_NOT_MESSAGE:
        case MATCHCRITERIA_NOT_HEADERS_PART:
                return !matcherprop_string_match(matcher, buf);
-       case MATCHCRITERIA_PARTIAL:
-               return matcherprop_string_match(matcher, buf);
-       case MATCHCRITERIA_NOT_PARTIAL:
-               return !matcherprop_string_match(matcher, buf);
        }
        return FALSE;
 }
@@ -627,8 +629,6 @@ static gboolean matcherprop_criteria_headers(const MatcherProp *matcher)
        case MATCHCRITERIA_NOT_HEADER:
        case MATCHCRITERIA_HEADERS_PART:
        case MATCHCRITERIA_NOT_HEADERS_PART:
-       case MATCHCRITERIA_PARTIAL:
-       case MATCHCRITERIA_NOT_PARTIAL:
                return TRUE;
        default:
                return FALSE;
@@ -963,6 +963,8 @@ gboolean matcherlist_match(MatcherList *matchers, MsgInfo *info)
                case MATCHCRITERIA_SIZE_EQUAL:
                case MATCHCRITERIA_TEST:
                case MATCHCRITERIA_NOT_TEST:
+               case MATCHCRITERIA_PARTIAL:
+               case MATCHCRITERIA_NOT_PARTIAL:
                        if (matcherprop_match(matcher, info)) {
                                if (!matchers->bool_and) {
                                        return TRUE;
@@ -1102,6 +1104,8 @@ gchar *matcherprop_to_string(MatcherProp *matcher)
        case MATCHCRITERIA_NOT_FORWARDED:
        case MATCHCRITERIA_LOCKED:
        case MATCHCRITERIA_NOT_LOCKED:
+       case MATCHCRITERIA_PARTIAL:
+       case MATCHCRITERIA_NOT_PARTIAL:
        case MATCHCRITERIA_IGNORE_THREAD:
        case MATCHCRITERIA_NOT_IGNORE_THREAD:
                return g_strdup(criteria_str);
index 47394fb..66b55c3 100644 (file)
@@ -548,14 +548,14 @@ MATCHER_ALL
        gint criteria = 0;
 
        criteria = MATCHCRITERIA_PARTIAL;
-       prop = matcherprop_new(criteria, NULL, MATCHTYPE_MATCH, "SC-Partially-Retrieved", 0);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
 }
 | MATCHER_NOT_PARTIAL
 {
        gint criteria = 0;
 
        criteria = MATCHCRITERIA_NOT_PARTIAL;
-       prop = matcherprop_new(criteria, NULL, MATCHTYPE_MATCH, "SC-Partially-Retrieved", 0);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
 }
 | MATCHER_COLORLABEL MATCHER_INTEGER
 {
index d3bd162..07893a5 100644 (file)
@@ -475,6 +475,7 @@ MsgCache *msgcache_read_cache(FolderItem *item, const gchar *cache_file)
                READ_CACHE_DATA(msginfo->references, fp);
                READ_CACHE_DATA(msginfo->xref, fp);
                READ_CACHE_DATA_INT(msginfo->planned_download, fp);
+               READ_CACHE_DATA_INT(msginfo->total_size, fp);
 
                msginfo->folder = item;
                msginfo->flags.tmp_flags |= tmp_flags;
@@ -552,6 +553,7 @@ void msgcache_write_cache(MsgInfo *msginfo, FILE *fp)
        WRITE_CACHE_DATA(msginfo->references, fp);
        WRITE_CACHE_DATA(msginfo->xref, fp);
        WRITE_CACHE_DATA_INT(msginfo->planned_download, fp);
+       WRITE_CACHE_DATA_INT(msginfo->total_size, fp);
 }
 
 static void msgcache_write_flags(MsgInfo *msginfo, FILE *fp)
index 5f6fb9f..c6c9dba 100644 (file)
@@ -158,7 +158,8 @@ static const gchar *criteria_text [] = {
        N_("Test"),
        N_("Size greater than"), 
        N_("Size smaller than"),
-       N_("Size exactly")
+       N_("Size exactly"),
+       N_("Partially downloaded")
 };
 
 /*!
index 0cbf557..b98e45d 100644 (file)
@@ -516,13 +516,13 @@ enum
        H_X_STATUS      = 12,
        H_FROM_SPACE    = 13,
        H_SC_PLANNED_DOWNLOAD = 14,
-       H_X_FACE        = 15,
-       H_DISPOSITION_NOTIFICATION_TO = 16,
-       H_RETURN_RECEIPT_TO = 17,
-       H_SC_PARTIALLY_RETRIEVED = 18,
-       H_SC_ACCOUNT_SERVER = 19,
-       H_SC_ACCOUNT_LOGIN = 20,
-       H_SC_MESSAGE_SIZE = 21
+       H_SC_MESSAGE_SIZE = 15,
+       H_X_FACE        = 16,
+       H_DISPOSITION_NOTIFICATION_TO = 17,
+       H_RETURN_RECEIPT_TO = 18,
+       H_SC_PARTIALLY_RETRIEVED = 19,
+       H_SC_ACCOUNT_SERVER = 20,
+       H_SC_ACCOUNT_LOGIN = 21,
 };
 
 static HeaderEntry hentry_full[] = {{"Date:",          NULL, FALSE},
@@ -540,13 +540,13 @@ static HeaderEntry hentry_full[] = {{"Date:",             NULL, FALSE},
                                   {"X-Status:",        NULL, FALSE},
                                   {"From ",            NULL, FALSE},
                                   {"SC-Marked-For-Download:", NULL, FALSE},
+                                  {"SC-Message-Size:", NULL, FALSE},
                                   {"X-Face:",          NULL, FALSE},
                                   {"Disposition-Notification-To:", NULL, FALSE},
                                   {"Return-Receipt-To:", NULL, FALSE},
                                   {"SC-Partially-Retrieved:", NULL, FALSE},
                                   {"SC-Account-Server:", NULL, FALSE},
                                   {"SC-Account-Login:",NULL, FALSE},
-                                  {"SC-Message-Size:", NULL, FALSE},
                                   {NULL,               NULL, FALSE}};
 
 static HeaderEntry hentry_short[] = {{"Date:",         NULL, FALSE},
@@ -564,6 +564,7 @@ static HeaderEntry hentry_short[] = {{"Date:",              NULL, FALSE},
                                    {"X-Status:",       NULL, FALSE},
                                    {"From ",           NULL, FALSE},
                                    {"SC-Marked-For-Download:", NULL, FALSE},
+                                   {"SC-Message-Size:",NULL, FALSE},
                                    {NULL,              NULL, FALSE}};
 
 HeaderEntry* procheader_get_headernames(gboolean full)