[Commits] advsearch.c 1.1.2.9 1.1.2.10 matcher.c 1.75.2.78 1.75.2.79 matcher.h 1.39.2.23 1.39.2.24 matcher_parser_parse.y 1.25.2.36 1.25.2.37 prefs_matcher.c 1.43.2.99 1.43.2.100
colin at claws-mail.org
colin at claws-mail.org
Sun Nov 18 20:50:38 CET 2012
Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv16801/src
Modified Files:
Tag: gtk2
advsearch.c matcher.c matcher.h matcher_parser_parse.y
prefs_matcher.c
Log Message:
2012-11-18 [colin] 3.9.0cvs14
* AUTHORS
* src/advsearch.c
* src/matcher.c
* src/matcher.h
* src/matcher_parser_parse.y
* src/prefs_matcher.c
* src/gtk/authors.h
* src/gtk/quicksearch.c
Add age_{greater,lower}_hours matcher criteria
Initial patch by Abhay S. Kushwaha.
Index: advsearch.c
===================================================================
RCS file: /home/claws-mail/claws/src/Attic/advsearch.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -d -r1.1.2.9 -r1.1.2.10
--- advsearch.c 16 Nov 2012 13:11:55 -0000 1.1.2.9
+++ advsearch.c 18 Nov 2012 19:50:36 -0000 1.1.2.10
@@ -150,6 +150,8 @@
{ "a", "all", 0, FALSE, FALSE },
{ "ag", "age_greater", 1, FALSE, FALSE },
{ "al", "age_lower", 1, FALSE, FALSE },
+ { "agh","age_greater_hours", 1, FALSE, FALSE },
+ { "alh","age_lower_hours", 1, FALSE, FALSE },
{ "b", "body_part", 1, TRUE, TRUE },
{ "B", "message", 1, TRUE, TRUE },
{ "c", "cc", 1, TRUE, TRUE },
Index: matcher_parser_parse.y
===================================================================
RCS file: /home/claws-mail/claws/src/matcher_parser_parse.y,v
retrieving revision 1.25.2.36
retrieving revision 1.25.2.37
diff -u -d -r1.25.2.36 -r1.25.2.37
--- matcher_parser_parse.y 8 Sep 2012 20:23:10 -0000 1.25.2.36
+++ matcher_parser_parse.y 18 Nov 2012 19:50:36 -0000 1.25.2.37
@@ -319,6 +319,7 @@
%token MATCHER_FROM MATCHER_NOT_FROM MATCHER_TO MATCHER_NOT_TO
%token MATCHER_CC MATCHER_NOT_CC MATCHER_TO_OR_CC MATCHER_NOT_TO_AND_NOT_CC
%token MATCHER_AGE_GREATER MATCHER_AGE_LOWER MATCHER_NEWSGROUPS
+%token MATCHER_AGE_GREATER_HOURS MATCHER_AGE_LOWER_HOURS
%token MATCHER_NOT_NEWSGROUPS MATCHER_INREPLYTO MATCHER_NOT_INREPLYTO
%token MATCHER_REFERENCES MATCHER_NOT_REFERENCES MATCHER_SCORE_GREATER
%token MATCHER_SCORE_LOWER MATCHER_HEADER MATCHER_NOT_HEADER
@@ -953,6 +954,24 @@
value = strtol($2, NULL, 0);
prop = matcherprop_new(criteria, NULL, 0, NULL, value);
}
+| MATCHER_AGE_GREATER_HOURS MATCHER_INTEGER
+{
+ gint criteria = 0;
+ gint value = 0;
+
+ criteria = MATCHCRITERIA_AGE_GREATER_HOURS;
+ value = strtol($2, NULL, 0);
+ prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+}
+| MATCHER_AGE_LOWER_HOURS MATCHER_INTEGER
+{
+ gint criteria = 0;
+ gint value = 0;
+
+ criteria = MATCHCRITERIA_AGE_LOWER_HOURS;
+ value = strtol($2, NULL, 0);
+ prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+}
| MATCHER_NEWSGROUPS match_type MATCHER_STRING
{
gint criteria = 0;
Index: matcher.h
===================================================================
RCS file: /home/claws-mail/claws/src/matcher.h,v
retrieving revision 1.39.2.23
retrieving revision 1.39.2.24
diff -u -d -r1.39.2.23 -r1.39.2.24
--- matcher.h 26 Sep 2012 13:15:47 -0000 1.39.2.23
+++ matcher.h 18 Nov 2012 19:50:36 -0000 1.39.2.24
@@ -87,6 +87,7 @@
MC_(CC), MC_(NOT_CC),
MC_(TO_OR_CC), MC_(NOT_TO_AND_NOT_CC),
MC_(AGE_GREATER), MC_(AGE_LOWER),
+ MC_(AGE_GREATER_HOURS), MC_(AGE_LOWER_HOURS),
MC_(NEWSGROUPS), MC_(NOT_NEWSGROUPS),
MC_(INREPLYTO), MC_(NOT_INREPLYTO),
MC_(REFERENCES), MC_(NOT_REFERENCES),
Index: matcher.c
===================================================================
RCS file: /home/claws-mail/claws/src/matcher.c,v
retrieving revision 1.75.2.78
retrieving revision 1.75.2.79
diff -u -d -r1.75.2.78 -r1.75.2.79
--- matcher.c 26 Sep 2012 13:15:47 -0000 1.75.2.78
+++ matcher.c 18 Nov 2012 19:50:36 -0000 1.75.2.79
@@ -110,6 +110,8 @@
{MATCHCRITERIA_NOT_TAGGED, "~tagged"},
{MATCHCRITERIA_AGE_GREATER, "age_greater"},
{MATCHCRITERIA_AGE_LOWER, "age_lower"},
+ {MATCHCRITERIA_AGE_GREATER_HOURS, "age_greater_hours"},
+ {MATCHCRITERIA_AGE_LOWER_HOURS, "age_lower_hours"},
{MATCHCRITERIA_NEWSGROUPS, "newsgroups"},
{MATCHCRITERIA_NOT_NEWSGROUPS, "~newsgroups"},
{MATCHCRITERIA_INREPLYTO, "inreplyto"},
@@ -757,6 +759,7 @@
MsgInfo *info)
{
time_t t;
+ gint age_mult_hours = 1;
switch(prop->criteria) {
case MATCHCRITERIA_ALL:
@@ -880,12 +883,15 @@
case MATCHCRITERIA_NOT_TAGGED:
return info->tags == NULL;
case MATCHCRITERIA_AGE_GREATER:
+ age_mult_hours = 24;
+ /* Fallthrough intended */
+ case MATCHCRITERIA_AGE_GREATER_HOURS:
{
gboolean ret;
gint age;
t = time(NULL);
- age = ((t - info->date_t) / (60 * 60 * 24));
+ age = ((t - info->date_t) / (60 * 60 * age_mult_hours));
ret = (age >= prop->value);
/* debug output */
@@ -904,12 +910,15 @@
return ret;
}
case MATCHCRITERIA_AGE_LOWER:
+ age_mult_hours = 24;
+ /* Fallthrough intended */
+ case MATCHCRITERIA_AGE_LOWER_HOURS:
{
gboolean ret;
gint age;
t = time(NULL);
- age = ((t - info->date_t) / (60 * 60 * 24));
+ age = ((t - info->date_t) / (60 * 60 * age_mult_hours));
ret = (age < prop->value);
/* debug output */
@@ -1748,6 +1757,8 @@
case MATCHCRITERIA_NOT_TAGGED:
case MATCHCRITERIA_AGE_GREATER:
case MATCHCRITERIA_AGE_LOWER:
+ case MATCHCRITERIA_AGE_GREATER_HOURS:
+ case MATCHCRITERIA_AGE_LOWER_HOURS:
case MATCHCRITERIA_NEWSGROUPS:
case MATCHCRITERIA_NOT_NEWSGROUPS:
case MATCHCRITERIA_INREPLYTO:
@@ -1895,6 +1906,8 @@
switch (matcher->criteria) {
case MATCHCRITERIA_AGE_GREATER:
case MATCHCRITERIA_AGE_LOWER:
+ case MATCHCRITERIA_AGE_GREATER_HOURS:
+ case MATCHCRITERIA_AGE_LOWER_HOURS:
case MATCHCRITERIA_SCORE_GREATER:
case MATCHCRITERIA_SCORE_LOWER:
case MATCHCRITERIA_SCORE_EQUAL:
Index: prefs_matcher.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_matcher.c,v
retrieving revision 1.43.2.99
retrieving revision 1.43.2.100
diff -u -d -r1.43.2.99 -r1.43.2.100
--- prefs_matcher.c 16 Nov 2012 23:42:14 -0000 1.43.2.99
+++ prefs_matcher.c 18 Nov 2012 19:50:36 -0000 1.43.2.100
@@ -183,7 +183,10 @@
CRITERIA_TAGGED = 36,
CRITERIA_HAS_ATTACHMENT = 37,
- CRITERIA_SIGNED = 38
+ CRITERIA_SIGNED = 38,
+
+ CRITERIA_AGE_GREATER_HOURS = 39,
+ CRITERIA_AGE_LOWER_HOURS = 40
};
enum {
@@ -203,8 +206,9 @@
};
enum {
- AGE_DAYS = 0,
- AGE_WEEKS = 1
+ AGE_HOURS = 0,
+ AGE_DAYS = 1,
+ AGE_WEEKS = 2
};
enum {
@@ -326,6 +330,7 @@
matcher.model_age = GTK_TREE_MODEL(store);
store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_INT, G_TYPE_BOOLEAN);
+ COMBOBOX_ADD(store, _("hours"), AGE_HOURS);
COMBOBOX_ADD(store, _("days"), AGE_DAYS);
COMBOBOX_ADD(store, _("weeks"), AGE_WEEKS);
matcher.model_age_units = GTK_TREE_MODEL(store);
@@ -1136,6 +1141,10 @@
case MATCHCRITERIA_NOT_HEADER:
case MATCHCRITERIA_HEADER:
return CRITERIA_HEADER;
+ case MATCHCRITERIA_AGE_GREATER_HOURS:
+ return CRITERIA_AGE_GREATER_HOURS;
+ case MATCHCRITERIA_AGE_LOWER_HOURS:
+ return CRITERIA_AGE_LOWER_HOURS;
case MATCHCRITERIA_AGE_GREATER:
return CRITERIA_AGE_GREATER;
case MATCHCRITERIA_AGE_LOWER:
@@ -1230,6 +1239,10 @@
return MATCHCRITERIA_AGE_GREATER;
case CRITERIA_AGE_LOWER:
return MATCHCRITERIA_AGE_LOWER;
+ case CRITERIA_AGE_GREATER_HOURS:
+ return MATCHCRITERIA_AGE_GREATER_HOURS;
+ case CRITERIA_AGE_LOWER_HOURS:
+ return MATCHCRITERIA_AGE_LOWER_HOURS;
case CRITERIA_SCORE_GREATER:
return MATCHCRITERIA_SCORE_GREATER;
case CRITERIA_SCORE_LOWER:
@@ -1439,12 +1452,6 @@
if (value_criteria == -1)
return NULL;
- criteria = prefs_matcher_get_matching_from_criteria(value_criteria);
-
- value_pred = prefs_matcher_get_pred(value_criteria);
- if(value_pred)
- criteria = prefs_matcher_not_criteria(criteria);
-
#ifndef G_OS_WIN32
use_regexp = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(matcher.regexp_checkbtn));
#else
@@ -1523,6 +1530,12 @@
sel = gtk_combo_box_get_active(GTK_COMBO_BOX(matcher.match_combo2));
if(sel == AGE_WEEKS)
value *= 7;
+ else if (sel == AGE_HOURS) {
+ if (value_criteria == CRITERIA_AGE_GREATER)
+ value_criteria = CRITERIA_AGE_GREATER_HOURS;
+ else
+ value_criteria = CRITERIA_AGE_LOWER_HOURS;
+ }
break;
case CRITERIA_SCORE_GREATER:
@@ -1603,6 +1616,12 @@
break;
}
+ criteria = prefs_matcher_get_matching_from_criteria(value_criteria);
+
+ value_pred = prefs_matcher_get_pred(value_criteria);
+ if(value_pred)
+ criteria = prefs_matcher_not_criteria(criteria);
+
matcherprop = matcherprop_new(criteria, header, matchtype,
expr, value);
@@ -1935,6 +1954,7 @@
gtk_spin_button_set_range(GTK_SPIN_BUTTON(
matcher.numeric_entry), 0, 1000);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(matcher.numeric_entry), 0);
+ gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.match_combo2), AGE_DAYS);
gtk_label_set_text(GTK_LABEL(matcher.match_label), _("Age is"));
break;
case MATCH_FLAG:
@@ -2261,6 +2281,8 @@
break;
case CRITERIA_AGE_GREATER:
case CRITERIA_AGE_LOWER:
+ case CRITERIA_AGE_GREATER_HOURS:
+ case CRITERIA_AGE_LOWER_HOURS:
match_criteria = MATCH_AGE;
break;
case CRITERIA_SCORE_GREATER:
@@ -2497,6 +2519,14 @@
}
break;
+ case MATCHCRITERIA_AGE_GREATER_HOURS:
+ case MATCHCRITERIA_AGE_LOWER_HOURS:
+ gtk_combo_box_set_active(GTK_COMBO_BOX(matcher.match_combo2),
+ AGE_HOURS);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(
+ matcher.numeric_entry), prop->value);
+ break;
+
case MATCHCRITERIA_SCORE_GREATER:
case MATCHCRITERIA_SCORE_LOWER:
case MATCHCRITERIA_SCORE_EQUAL:
More information about the Commits
mailing list