Add S_SEARCH_EXTENDED to the quick search, which
authorColin Leroy <colin@colino.net>
Mon, 25 Nov 2002 15:04:52 +0000 (15:04 +0000)
committerColin Leroy <colin@colino.net>
Mon, 25 Nov 2002 15:04:52 +0000 (15:04 +0000)
allows to search using filtering syntax.

ChangeLog.claws
configure.in
src/summaryview.c
src/summaryview.h

index a2f7cc72c4085217d9b6a86a2e31712c6efa1b12..6af1a0780554692d7c2df131e67d323eef37b071 100644 (file)
@@ -1,3 +1,9 @@
+2002-11-25 [colin]     0.8.6claws2
+
+       * src/summaryview.[ch]
+               Add S_SEARCH_EXTENDED to the quick search, which 
+               allows to search using filtering syntax.
+
 2002-11-25 [colin]     0.8.6claws1
 
        * src/summaryview.c
index 614abec31a4f15020e41b3625a58177f750e35b7..9ddfba7a4482bb029f010ec0304308c4a30b2da4 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws1
+EXTRA_VERSION=claws2
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 8a2b54612b29a8a0bac51f137cedfe6452cf6c85..af792a9e8bf8e5d2ff2fcc9724891cb38a128e77 100644 (file)
@@ -83,6 +83,8 @@
 #include "string_match.h"
 #include "toolbar.h"
 #include "news.h"
+#include "matcher.h"
+#include "matcher_parser.h"
 
 #define SUMMARY_COL_MARK_WIDTH         10
 #define SUMMARY_COL_UNREAD_WIDTH       13
@@ -559,6 +561,10 @@ SummaryView *summary_create(void)
                           GTK_SIGNAL_FUNC(summary_searchtype_changed),
                           summaryview);
        MENUITEM_ADD (search_type, menuitem, _("To"), S_SEARCH_TO);
+       gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
+                          GTK_SIGNAL_FUNC(summary_searchtype_changed),
+                          summaryview);
+       MENUITEM_ADD (search_type, menuitem, _("Extended"), S_SEARCH_EXTENDED);
        gtk_signal_connect(GTK_OBJECT(menuitem), "activate",
                           GTK_SIGNAL_FUNC(summary_searchtype_changed),
                           summaryview);
@@ -913,7 +919,11 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                                   GTK_MENU(summaryview->search_type))))));
                gchar *search_string = gtk_entry_get_text(GTK_ENTRY(summaryview->search_string));
                gchar *searched_header = NULL;
+               MatcherList * tmp_list = NULL;
                
+               if (search_type == S_SEARCH_EXTENDED)
+                       tmp_list = matcher_parser_get_cond(search_string);
+
                not_killed = NULL;
                for (cur = mlist ; cur != NULL ; cur = g_slist_next(cur)) {
                        MsgInfo * msginfo = (MsgInfo *) cur->data;
@@ -928,15 +938,30 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                        case S_SEARCH_TO:
                                searched_header = msginfo->to;
                                break;
+                       case S_SEARCH_EXTENDED:
+                               break;
                        default:
                                debug_print("unknown search type (%d)\n", search_type);
                                break;
                        }
-                       if (searched_header && strcasestr(searched_header, search_string) != NULL)
-                               not_killed = g_slist_append(not_killed, msginfo);
-                       else
-                               procmsg_msginfo_free(msginfo);
+                       if (search_type != S_SEARCH_EXTENDED) {
+                               if (searched_header && strcasestr(searched_header, search_string) != NULL)
+                                       not_killed = g_slist_append(not_killed, msginfo);
+                               else
+                                       procmsg_msginfo_free(msginfo);
+                       } else {
+                               if (tmp_list != NULL && matcherlist_match(tmp_list, msginfo))
+                                       not_killed = g_slist_append(not_killed, msginfo);
+                               else
+                                       procmsg_msginfo_free(msginfo);
+                       }
                }
+
+               if (search_type == S_SEARCH_EXTENDED && tmp_list != NULL) {
+                       matcherlist_free(tmp_list);
+                       tmp_list = NULL;
+               }
+
                g_slist_free(mlist);
                mlist = not_killed;
        }
index 8d67c631a6ed902160ed777a654c8210410519e2..5bcaad5cae372e9118adb91672a0ab3f1d2783ff 100644 (file)
@@ -75,7 +75,8 @@ typedef enum
 {
        S_SEARCH_SUBJECT,
        S_SEARCH_FROM,
-       S_SEARCH_TO
+       S_SEARCH_TO,
+       S_SEARCH_EXTENDED
 } SummarySearchType;
 
 extern GtkTargetEntry summary_drag_types[1];