add 'Selective download'
authorPaul Mangan <paul@claws-mail.org>
Fri, 22 Feb 2002 09:35:36 +0000 (09:35 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 22 Feb 2002 09:35:36 +0000 (09:35 +0000)
25 files changed:
AUTHORS
ChangeLog.claws
configure.in
po/POTFILES.in
src/Makefile.am
src/defs.h
src/filtering.c
src/inc.c
src/inc.h
src/mainwindow.c
src/matcher.c
src/matcher.h
src/matcher_parser_lex.c [new file with mode: 0644]
src/matcher_parser_lex.l
src/matcher_parser_parse.c [new file with mode: 0644]
src/matcher_parser_parse.h [new file with mode: 0644]
src/matcher_parser_parse.y
src/pop.c
src/pop.h
src/prefs_account.h
src/prefs_filtering.c
src/selective_download.c [new file with mode: 0644]
src/selective_download.h [new file with mode: 0644]
src/utils.c
src/utils.h

diff --git a/AUTHORS b/AUTHORS
index 3b919e8488e3272e396c4c410922f51c01e4ff34..eb35a3e009593f59aa9afa5ec751e4540c192577 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -116,3 +116,4 @@ contributors (beside the above; based on Changelog)
        Shawn Houston
        Alessandro Maestri
        Neill Miller
        Shawn Houston
        Alessandro Maestri
        Neill Miller
+       Oliver Haertel
index a6219d2dc1c254e5ff2550802f4322235961df67..89ed583a64fbf89829d1553f64a7991bc35e1547 100644 (file)
@@ -1,3 +1,30 @@
+2002-02-22 [paul]      0.7.2claws6
+
+       * src/Makefile.am
+         src/defs.h
+         src/filtering.c
+         src/inc.[ch]
+         src/mainwindow.c
+         src/matcher.[ch]
+         src/matcher_parser_lex.c      *** NEW FILE ***
+         src/matcher_parser_lex.l
+         src/matcher_parser_parse.[ch] *** NEW FILES ***
+         src/matcher_parser_parse.y
+         src/pop.[ch]
+         src/prefs_account.h
+         src/prefs_filtering.c
+         src/selective_download.[ch]   *** NEW FILES ***
+         src/utils.[ch]
+         po/POTFILES.in
+               Selective Download added to 'Tool' menu. 
+               Retrieves email headers of the currently selected pop3 
+               account and allows the user to mark emails for deletion 
+               right on the pop3 server. Patch submitted by Oliver Haertel 
+               <oha@users.sourceforge.net>.
+       
+       * po/POTFILES.in
+               add 'src/quote_fmt.c'           
+
 2002-02-22 [christoph] 0.7.2claws5
 
        * src/Makefile.am
 2002-02-22 [christoph] 0.7.2claws5
 
        * src/Makefile.am
index 0ec6f0b4e2d540f559b7655a691744421ce33d6b..c867a53d5f5a937746a58d1c51b63524a3011dbc 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws5
+EXTRA_VERSION=claws6
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 70ccd589990b3fc914c192f89957db5b59ac4bee..cea5a072e249d9a4bfba69827fd63714d34c7e08 100644 (file)
@@ -75,11 +75,13 @@ src/procheader.c
 src/procmime.c
 src/procmsg.c
 src/progressdialog.c
 src/procmime.c
 src/procmsg.c
 src/progressdialog.c
+src/quote_fmt.c
 src/recv.c
 src/rfc822.c
 src/rfc2015.c
 src/scoring.c
 src/select-keys.c
 src/recv.c
 src/rfc822.c
 src/rfc2015.c
 src/scoring.c
 src/select-keys.c
+src/selective_download.c
 src/send.c
 src/session.c
 src/setup.c
 src/send.c
 src/session.c
 src/setup.c
index 9a6c669a9310bda0f158f73f0827b21c156ea866..25eee6b530f52083f24250cb7afba6460a0258f6 100644 (file)
@@ -128,7 +128,8 @@ sylpheed_SOURCES = \
        gtkspell.c gtkspell.h gtkxtext.h \
        matcher_parser_lex.l matcher_parser_lex.h \
        matcher_parser_parse.y matcher_parser.h \
        gtkspell.c gtkspell.h gtkxtext.h \
        matcher_parser_lex.l matcher_parser_lex.h \
        matcher_parser_parse.y matcher_parser.h \
-       string_match.h string_match.c
+       string_match.h string_match.c \
+       selective_download.c selective_download.h
 
 BUILT_SOURCES = \
        quote_fmt_lex.c \
 
 BUILT_SOURCES = \
        quote_fmt_lex.c \
index d658a13211635a09aaec0c79fb82eae793def856..177f1e0cf2796400cd5bbde27615daaf4c2756db 100644 (file)
@@ -41,6 +41,7 @@
 #define NEWS_CACHE_DIR         "newscache"
 #define IMAP_CACHE_DIR         "imapcache"
 #define MBOX_CACHE_DIR         "mboxcache"
 #define NEWS_CACHE_DIR         "newscache"
 #define IMAP_CACHE_DIR         "imapcache"
 #define MBOX_CACHE_DIR         "mboxcache"
+#define HEADER_CACHE_DIR        "headercache" 
 #define MIME_TMP_DIR           "mimetmp"
 #define COMMON_RC              "sylpheedrc"
 #define ACCOUNT_RC             "accountrc"
 #define MIME_TMP_DIR           "mimetmp"
 #define COMMON_RC              "sylpheedrc"
 #define ACCOUNT_RC             "accountrc"
index 0c9dfb9ce14ba3140665c48cdf84070151fe47d5..5491c4ce927eb0671af247d710901146400f0a80 100644 (file)
@@ -437,7 +437,9 @@ gchar *filteringaction_to_string(gchar *dest, gint destlen, FilteringAction *act
        case MATCHACTION_COLOR:
                g_snprintf(dest, destlen, "%s %d", command_str, action->labelcolor);
                return dest;  
        case MATCHACTION_COLOR:
                g_snprintf(dest, destlen, "%s %d", command_str, action->labelcolor);
                return dest;  
-
+       case MATCHACTION_DELETE_ON_SERVER:
+               g_snprintf(dest, destlen, "%s", command_str);
+               return dest;
        default:
                return NULL;
        }
        default:
                return NULL;
        }
index 2cdec3040ae24a09255a75d849299152ea65d56b..d79f2f53b6710e95690638622264208538d8c04e 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -64,6 +64,7 @@
 #include "automaton.h"
 #include "folder.h"
 #include "filtering.h"
 #include "automaton.h"
 #include "folder.h"
 #include "filtering.h"
+#include "selective_download.h"
 
 static guint inc_lock_count = 0;
 
 
 static guint inc_lock_count = 0;
 
@@ -185,6 +186,18 @@ void inc_mail(MainWindow *mainwin)
        inc_autocheck_timer_set();
 }
 
        inc_autocheck_timer_set();
 }
 
+gint inc_selective_download(MainWindow *mainwin, gint session_type)
+{
+       PrefsAccount *account = cur_account;
+       gint new_msgs = 0;      
+
+       account->session_type = session_type;
+       new_msgs = inc_account_mail(account, mainwin);
+       account->session_type = RETR_NORMAL;
+       
+       return new_msgs;
+}
+
 static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
 {
        IncProgressDialog *inc_dialog;
 static gint inc_account_mail(PrefsAccount *account, MainWindow *mainwin)
 {
        IncProgressDialog *inc_dialog;
@@ -247,7 +260,7 @@ void inc_all_account_mail(MainWindow *mainwin)
        for (list = account_get_list(); list != NULL; list = list->next) {
                IncSession *session;
                PrefsAccount *account = list->data;
        for (list = account_get_list(); list != NULL; list = list->next) {
                IncSession *session;
                PrefsAccount *account = list->data;
-
+               account->session_type = RETR_NORMAL;
                if (account->recv_at_getall) {
                        session = inc_session_new(account);
                        if (session)
                if (account->recv_at_getall) {
                        session = inc_session_new(account);
                        if (session)
@@ -563,6 +576,7 @@ static IncState inc_pop3_session_do(IncSession *session)
                pop3_getrange_last_send , pop3_getrange_last_recv,
                pop3_getrange_uidl_send , pop3_getrange_uidl_recv,
                pop3_getsize_list_send  , pop3_getsize_list_recv,
                pop3_getrange_last_send , pop3_getrange_last_recv,
                pop3_getrange_uidl_send , pop3_getrange_uidl_recv,
                pop3_getsize_list_send  , pop3_getsize_list_recv,
+               pop3_top_send           , pop3_top_recv,
                pop3_retr_send          , pop3_retr_recv,
                pop3_delete_send        , pop3_delete_recv,
                pop3_logout_send        , pop3_logout_recv
                pop3_retr_send          , pop3_retr_recv,
                pop3_delete_send        , pop3_delete_recv,
                pop3_logout_send        , pop3_logout_recv
@@ -807,6 +821,21 @@ void inc_progress_update(Pop3State *state, Pop3Phase phase)
                progress_dialog_set_label
                        (dialog, _("Getting the size of messages (LIST)..."));
                break;
                progress_dialog_set_label
                        (dialog, _("Getting the size of messages (LIST)..."));
                break;
+       case POP3_TOP_SEND:
+       case POP3_TOP_RECV:
+               g_snprintf(buf, sizeof(buf),
+                          _("Retrieving header (%d / %d)"),
+                          state->cur_msg, state->count);
+               progress_dialog_set_label (dialog, buf);
+               progress_dialog_set_percentage
+                       (dialog,
+                        (gfloat)(state->cur_msg) /
+                        (gfloat)(state->count));
+               gtk_progress_bar_update 
+                       (GTK_PROGRESS_BAR(inc_dialog->mainwin->progressbar),
+                        (gfloat)(state->cur_msg) /
+                        (gfloat)(state->count));
+               break;
        case POP3_RETR_SEND:
        case POP3_RETR_RECV:
                Xstrdup_a(total_size, to_human_readable(state->total_bytes), return);
        case POP3_RETR_SEND:
        case POP3_RETR_RECV:
                Xstrdup_a(total_size, to_human_readable(state->total_bytes), return);
index 7c7210a401584182a7a05ea063904af165cac05e..1460fde97c36b2047a6b14f8a24c7b1c40a404f7 100644 (file)
--- a/src/inc.h
+++ b/src/inc.h
@@ -102,6 +102,8 @@ struct _Pop3State
 
 void inc_mail                  (MainWindow     *mainwin);
 void inc_all_account_mail      (MainWindow     *mainwin);
 
 void inc_mail                  (MainWindow     *mainwin);
 void inc_all_account_mail      (MainWindow     *mainwin);
+gint inc_selective_download     (MainWindow    *mainwin, 
+                                gint           session_type);
 void inc_progress_update       (Pop3State      *state,
                                 Pop3Phase       phase);
 gint inc_drop_message          (const gchar    *file,
 void inc_progress_update       (Pop3State      *state,
                                 Pop3Phase       phase);
 gint inc_drop_message          (const gchar    *file,
index 954707353a1592000abf2ae461b587470555697f..716fcc1706138b3b54b75547275fbbfcf7918e72 100644 (file)
@@ -81,6 +81,7 @@
 #include "about.h"
 #include "manual.h"
 #include "version.h"
 #include "about.h"
 #include "manual.h"
 #include "version.h"
+#include "selective_download.h"
 
 #define AC_LABEL_WIDTH 240
 
 
 #define AC_LABEL_WIDTH 240
 
@@ -251,6 +252,9 @@ static void addressbook_open_cb     (MainWindow     *mainwin,
 static void log_window_show_cb (MainWindow     *mainwin,
                                 guint           action,
                                 GtkWidget      *widget);
 static void log_window_show_cb (MainWindow     *mainwin,
                                 guint           action,
                                 GtkWidget      *widget);
+static void sel_download_cb     (MainWindow *mainwin, 
+                                guint action,
+                                GtkWidget *widget);
 
 static void inc_mail_cb                        (MainWindow     *mainwin,
                                         guint           action,
 
 static void inc_mail_cb                        (MainWindow     *mainwin,
                                         guint           action,
@@ -669,6 +673,7 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Tool/E_xecute"),                 "X", execute_summary_cb, 0, NULL},
        {N_("/_Tool/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Tool/_Log window"),              "<control>L", log_window_show_cb, 0, NULL},
        {N_("/_Tool/E_xecute"),                 "X", execute_summary_cb, 0, NULL},
        {N_("/_Tool/---"),                      NULL, NULL, 0, "<Separator>"},
        {N_("/_Tool/_Log window"),              "<control>L", log_window_show_cb, 0, NULL},
+       {N_("/_Tool/_Selective Download"),      "<alt>S", sel_download_cb, 0, NULL},
 
        {N_("/_Configuration"),                 NULL, NULL, 0, "<Branch>"},
        {N_("/_Configuration/_Common preferences..."),
 
        {N_("/_Configuration"),                 NULL, NULL, 0, "<Branch>"},
        {N_("/_Configuration/_Common preferences..."),
@@ -2515,6 +2520,12 @@ static void log_window_show_cb(MainWindow *mainwin, guint action,
        log_window_show(mainwin->logwin);
 }
 
        log_window_show(mainwin->logwin);
 }
 
+static void sel_download_cb(MainWindow *mainwin, guint action,
+                              GtkWidget *widget)
+{
+       selective_download(mainwin);
+}
+
 static void inc_mail_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        inc_mail(mainwin);
 static void inc_mail_cb(MainWindow *mainwin, guint action, GtkWidget *widget)
 {
        inc_mail(mainwin);
index 1e2c89fb8e3d20df0328abc2de0bd099fc3ee0f0..8ec4e4ce7d27616eff398f0df96a8b9ef0ac3ffc 100644 (file)
@@ -87,7 +87,8 @@ static MatchParser matchparser_tab[] = {
        {MATCHACTION_FORWARD_AS_ATTACHMENT, "forward_as_attachment"},
        {MATCHACTION_EXECUTE, "execute"},
        {MATCHACTION_COLOR, "color"},
        {MATCHACTION_FORWARD_AS_ATTACHMENT, "forward_as_attachment"},
        {MATCHACTION_EXECUTE, "execute"},
        {MATCHACTION_COLOR, "color"},
-       {MATCHACTION_BOUNCE, "bounce"}
+       {MATCHACTION_BOUNCE, "bounce"},
+       {MATCHACTION_DELETE_ON_SERVER, "delete_on_server"}
 };
 
 /* get_matchparser_tab_str() - used by filtering.c to translate 
 };
 
 /* get_matchparser_tab_str() - used by filtering.c to translate 
index 4727e3f7fbb9c7463e19a41007dc7780404c6443..3bedb92e151c407443d9d1d94adc6aa3e28bde9f 100644 (file)
@@ -74,6 +74,7 @@ enum {
        MATCHACTION_FORWARD_AS_ATTACHMENT,
        MATCHACTION_COLOR,
        MATCHACTION_BOUNCE,
        MATCHACTION_FORWARD_AS_ATTACHMENT,
        MATCHACTION_COLOR,
        MATCHACTION_BOUNCE,
+       MATCHACTION_DELETE_ON_SERVER,
        /* boolean operations */
        MATCHERBOOL_OR,
        MATCHERBOOL_AND,
        /* boolean operations */
        MATCHERBOOL_OR,
        MATCHERBOOL_AND,
diff --git a/src/matcher_parser_lex.c b/src/matcher_parser_lex.c
new file mode 100644 (file)
index 0000000..b64c863
--- /dev/null
@@ -0,0 +1,2153 @@
+#define yy_create_buffer matcher_parser_create_buffer
+#define yy_delete_buffer matcher_parser_delete_buffer
+#define yy_scan_buffer matcher_parser_scan_buffer
+#define yy_scan_string matcher_parser_scan_string
+#define yy_scan_bytes matcher_parser_scan_bytes
+#define yy_flex_debug matcher_parser_flex_debug
+#define yy_init_buffer matcher_parser_init_buffer
+#define yy_flush_buffer matcher_parser_flush_buffer
+#define yy_load_buffer_state matcher_parser_load_buffer_state
+#define yy_switch_to_buffer matcher_parser_switch_to_buffer
+#define yyin matcher_parserin
+#define yyleng matcher_parserleng
+#define yylex matcher_parserlex
+#define yyout matcher_parserout
+#define yyrestart matcher_parserrestart
+#define yytext matcher_parsertext
+#define yylineno matcher_parserlineno
+#define yywrap matcher_parserwrap
+
+#line 21 "lex.yy.c"
+/* A lexical scanner generated by flex */
+
+/* Scanner skeleton version:
+ * $Header$
+ */
+
+#define FLEX_SCANNER
+#define YY_FLEX_MAJOR_VERSION 2
+#define YY_FLEX_MINOR_VERSION 5
+
+#include <stdio.h>
+#include <unistd.h>
+
+
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
+#endif
+#endif
+
+
+#ifdef __cplusplus
+
+#include <stdlib.h>
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
+/* The "const" storage-class-modifier is valid. */
+#define YY_USE_CONST
+
+#else  /* ! __cplusplus */
+
+#if __STDC__
+
+#define YY_USE_PROTOS
+#define YY_USE_CONST
+
+#endif /* __STDC__ */
+#endif /* ! __cplusplus */
+
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
+#ifdef YY_USE_CONST
+#define yyconst const
+#else
+#define yyconst
+#endif
+
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
+/* Returned upon end-of-file. */
+#define YY_NULL 0
+
+/* Promotes a possibly negative, possibly signed char to an unsigned
+ * integer for use as an array index.  If the signed char is negative,
+ * we want to instead treat it as an 8-bit unsigned char, hence the
+ * double cast.
+ */
+#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+
+/* Enter a start condition.  This macro really ought to take a parameter,
+ * but we do it the disgusting crufty way forced on us by the ()-less
+ * definition of BEGIN.
+ */
+#define BEGIN yy_start = 1 + 2 *
+
+/* Translate the current start state into a value that can be later handed
+ * to BEGIN to return to the state.  The YYSTATE alias is for lex
+ * compatibility.
+ */
+#define YY_START ((yy_start - 1) / 2)
+#define YYSTATE YY_START
+
+/* Action number for EOF rule of a given start state. */
+#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
+
+/* Special action meaning "start processing a new file". */
+#define YY_NEW_FILE yyrestart( yyin )
+
+#define YY_END_OF_BUFFER_CHAR 0
+
+/* Size of default input buffer. */
+#define YY_BUF_SIZE 16384
+
+typedef struct yy_buffer_state *YY_BUFFER_STATE;
+
+extern int yyleng;
+extern FILE *yyin, *yyout;
+
+#define EOB_ACT_CONTINUE_SCAN 0
+#define EOB_ACT_END_OF_FILE 1
+#define EOB_ACT_LAST_MATCH 2
+
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator).  This
+ * avoids problems with code like:
+ *
+ *     if ( condition_holds )
+ *             yyless( 5 );
+ *     else
+ *             do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+               *yy_cp = yy_hold_char; \
+               YY_RESTORE_YY_MORE_OFFSET \
+               yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+               YY_DO_BEFORE_ACTION; /* set up yytext again */ \
+               } \
+       while ( 0 )
+
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
+
+struct yy_buffer_state
+       {
+       FILE *yy_input_file;
+
+       char *yy_ch_buf;                /* input buffer */
+       char *yy_buf_pos;               /* current position in input buffer */
+
+       /* Size of input buffer in bytes, not including room for EOB
+        * characters.
+        */
+       yy_size_t yy_buf_size;
+
+       /* Number of characters read into yy_ch_buf, not including EOB
+        * characters.
+        */
+       int yy_n_chars;
+
+       /* Whether we "own" the buffer - i.e., we know we created it,
+        * and can realloc() it to grow it, and should free() it to
+        * delete it.
+        */
+       int yy_is_our_buffer;
+
+       /* Whether this is an "interactive" input source; if so, and
+        * if we're using stdio for input, then we want to use getc()
+        * instead of fread(), to make sure we stop fetching input after
+        * each newline.
+        */
+       int yy_is_interactive;
+
+       /* Whether we're considered to be at the beginning of a line.
+        * If so, '^' rules will be active on the next match, otherwise
+        * not.
+        */
+       int yy_at_bol;
+
+       /* Whether to try to fill the input buffer when we reach the
+        * end of it.
+        */
+       int yy_fill_buffer;
+
+       int yy_buffer_status;
+#define YY_BUFFER_NEW 0
+#define YY_BUFFER_NORMAL 1
+       /* When an EOF's been seen but there's still some text to process
+        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
+        * shouldn't try reading from the input source any more.  We might
+        * still have a bunch of tokens to match, though, because of
+        * possible backing-up.
+        *
+        * When we actually see the EOF, we change the status to "new"
+        * (via yyrestart()), so that the user can continue scanning by
+        * just pointing yyin at a new input file.
+        */
+#define YY_BUFFER_EOF_PENDING 2
+       };
+
+static YY_BUFFER_STATE yy_current_buffer = 0;
+
+/* We provide macros for accessing buffer states in case in the
+ * future we want to put the buffer states in a more general
+ * "scanner state".
+ */
+#define YY_CURRENT_BUFFER yy_current_buffer
+
+
+/* yy_hold_char holds the character lost when yytext is formed. */
+static char yy_hold_char;
+
+static int yy_n_chars;         /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
+
+/* Points to current character in buffer. */
+static char *yy_c_buf_p = (char *) 0;
+static int yy_init = 1;                /* whether we need to initialize */
+static int yy_start = 0;       /* start state number */
+
+/* Flag which is used to allow yywrap()'s to do buffer switches
+ * instead of setting up a fresh yyin.  A bit of a hack ...
+ */
+static int yy_did_buffer_switch_on_eof;
+
+void yyrestart YY_PROTO(( FILE *input_file ));
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
+
+#define yy_new_buffer yy_create_buffer
+
+#define yy_set_interactive(is_interactive) \
+       { \
+       if ( ! yy_current_buffer ) \
+               yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       yy_current_buffer->yy_is_interactive = is_interactive; \
+       }
+
+#define yy_set_bol(at_bol) \
+       { \
+       if ( ! yy_current_buffer ) \
+               yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+       yy_current_buffer->yy_at_bol = at_bol; \
+       }
+
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+
+
+#define YY_USES_REJECT
+typedef unsigned char YY_CHAR;
+FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+typedef int yy_state_type;
+extern int yylineno;
+int yylineno = 1;
+extern char *yytext;
+#define yytext_ptr yytext
+
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+
+/* Done after the current pattern has been matched and before the
+ * corresponding action - sets up yytext.
+ */
+#define YY_DO_BEFORE_ACTION \
+       yytext_ptr = yy_bp; \
+       yyleng = (int) (yy_cp - yy_bp); \
+       yy_hold_char = *yy_cp; \
+       *yy_cp = '\0'; \
+       yy_c_buf_p = yy_cp;
+
+#define YY_NUM_RULES 72
+#define YY_END_OF_BUFFER 73
+static yyconst short int yy_acclist[104] =
+    {   0,
+       73,   72,   62,   72,   63,   72,   66,   72,   64,   72,
+       72,   71,   72,   72,   72,   72,   72,   72,   72,   72,
+       72,   72,   72,   72,   72,   72,   72,   72,   65,   72,
+       72,   69,   72,   68,   69,   72,   69,   72,   62,   71,
+       70,   20,   18,   67,    1,    4,   21,   19,   51,   16,
+       53,   50,    5,   59,   46,   49,   17,   60,   52,   35,
+        6,   48,   54,    2,    8,   43,   57,   39,   10,   14,
+       36,    7,    3,   22,    9,   44,   40,   11,   15,   25,
+       41,   12,   28,   45,   23,   26,   30,   47,   42,   13,
+       29,   24,   34,   33,   27,   31,   37,   55,   32,   38,
+
+       56,   61,   58
+    } ;
+
+static yyconst short int yy_accept[370] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    2,    3,    5,
+        7,    9,   11,   12,   14,   15,   16,   17,   18,   19,
+       20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
+       31,   32,   34,   37,   39,   40,   41,   41,   42,   42,
+       42,   42,   43,   43,   43,   43,   43,   43,   43,   43,
+       43,   43,   43,   43,   43,   43,   43,   44,   44,   44,
+       44,   44,   44,   44,   44,   44,   44,   44,   44,   44,
+       44,   44,   45,   45,   46,   46,   46,   46,   46,   46,
+       46,   46,   46,   46,   46,   46,   46,   46,   46,   47,
+       47,   47,   47,   47,   47,   47,   47,   47,   47,   48,
+
+       48,   48,   48,   48,   48,   48,   48,   48,   48,   48,
+       48,   49,   49,   49,   49,   49,   49,   50,   50,   50,
+       50,   51,   51,   51,   52,   52,   52,   53,   53,   53,
+       53,   53,   53,   53,   53,   53,   53,   53,   53,   53,
+       53,   53,   53,   53,   53,   53,   54,   54,   54,   54,
+       54,   54,   54,   54,   54,   54,   55,   55,   55,   55,
+       55,   55,   55,   55,   56,   56,   56,   56,   56,   56,
+       57,   57,   57,   57,   57,   57,   57,   57,   57,   58,
+       58,   58,   58,   58,   58,   58,   58,   58,   58,   58,
+       58,   58,   58,   59,   60,   60,   60,   61,   61,   61,
+
+       62,   62,   62,   62,   62,   63,   63,   63,   63,   63,
+       64,   65,   65,   65,   65,   65,   65,   65,   65,   65,
+       65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
+       66,   67,   68,   68,   68,   68,   68,   69,   69,   69,
+       69,   70,   70,   70,   70,   71,   71,   71,   71,   71,
+       71,   72,   72,   73,   73,   73,   73,   73,   73,   73,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   75,   75,   76,
+       77,   77,   77,   77,   78,   78,   78,   79,   80,   80,
+       80,   81,   82,   82,   82,   83,   83,   84,   84,   84,
+
+       85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
+       85,   85,   85,   86,   86,   86,   86,   86,   86,   86,
+       87,   88,   89,   89,   89,   89,   90,   91,   91,   92,
+       92,   92,   93,   93,   93,   93,   93,   93,   94,   94,
+       95,   95,   96,   97,   97,   97,   98,   99,   99,   99,
+       99,   99,   99,   99,  100,  101,  101,  101,  102,  102,
+      102,  103,  103,  103,  103,  103,  103,  104,  104
+    } ;
+
+static yyconst int yy_ec[256] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    2,    1,    4,    1,    1,    1,    5,    1,    1,
+        1,    1,    6,    1,    6,    1,    1,    7,    7,    7,
+        7,    7,    7,    7,    7,    7,    7,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        8,    9,   10,    1,   11,    1,   12,   13,   14,   15,
+
+       16,   17,   18,   19,   20,   21,   22,   23,   24,   25,
+       26,   27,   28,   29,   30,   31,   32,   33,   34,   35,
+       36,    1,    1,   37,    1,   38,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1
+    } ;
+
+static yyconst int yy_meta[39] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    2,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1
+    } ;
+
+static yyconst short int yy_base[372] =
+    {   0,
+        0,    0,   36,   38,    0,    0,  386,  387,  383,  387,
+      387,  387,  377,  376,  372,   25,  355,   30,  364,  344,
+       20,  362,  352,   38,  360,  359,   37,  348,  348,  387,
+       57,  387,  387,  368,  369,  363,  359,  387,  352,  344,
+       43,  387,   30,  343,  349,  335,  337,  350,  332,   30,
+      330,  326,  324,   66,  331,  343,  344,   31,  328,  339,
+      336,  316,   36,  334,  324,   51,  332,  331,  314,  319,
+      319,  387,  332,  387,  306,  316,  314,  303,  322,  323,
+      302,  311,  319,  317,  310,  317,  300,  313,  298,  311,
+      310,  302,  295,  302,  296,  309,  304,  304,  387,  295,
+
+      301,  287,  289,  302,  284,  283,  281,  276,   51,  296,
+      297,  278,   62,  295,  291,  275,  387,  272,  270,  289,
+      387,  284,  272,   79,  279,  285,  387,  278,  266,  259,
+      273,  276,  275,  261,  260,  276,  251,  270,  271,  250,
+      259,  267,  265,  258,  249,  248,  261,  253,  254,  248,
+      257,  243,  245,  243,  253,  387,  252,  236,  237,  236,
+      241,  251,  247,  247,  242,  230,  242,  230,  240,  244,
+      240,  242,  230,  236,  239,  218,  216,  235,  387,  230,
+      218,  228,  231,  224,  212,  220,  223,  209,  225,  220,
+      201,  222,  387,   81,  217,  217,  201,  194,  199,  387,
+
+      216,  211,  200,  200,  210,  208,   81,  191,  207,  387,
+      387,  193,  203,  187,  188,  187,  192,  199,  195,  183,
+      195,  194,  195,  197,  192,  194,  189,  175,  177,  387,
+      387,   87,  191,  170,  189,  169,  387,  166,  183,  184,
+      387,  167,  165,  167,  387,  178,  179,  175,  173,  173,
+      157,  150,  387,  169,  158,  158,  167,  150,  166,  387,
+      148,  149,  146,  151,  163,  159,  146,  146,   62,  155,
+      143,  153,  138,  135,  150,  131,  387,  135,  387,  387,
+      147,  151,  130,  387,  128,  145,  387,  387,  144,  141,
+      387,  387,  145,  125,  387,  142,  387,  137,  127,  387,
+
+      121,  120,  133,  136,  135,  130,  114,  129,  116,  116,
+      114,  124,  387,  110,  108,  126,  107,  123,  105,  387,
+      387,  387,  110,  101,  102,  387,  387,  118,  387,   99,
+       98,  387,  111,  114,   94,  109,  107,  387,  106,  387,
+       92,  387,  387,   91,   88,  387,  387,  106,   88,   85,
+       82,   83,   98,  387,  387,   96,   99,  387,   81,   95,
+      387,   83,   77,   84,   54,   35,  387,  387,  104,  106,
+       51
+    } ;
+
+static yyconst short int yy_def[372] =
+    {   0,
+      368,    1,  369,  369,  370,  370,  368,  368,  368,  368,
+      368,  368,  368,  368,  371,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  371,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,    0,  368,  368,
+      368
+    } ;
+
+static yyconst short int yy_nxt[426] =
+    {   0,
+        8,    9,   10,   11,   12,   13,   14,   15,    8,    8,
+        8,   16,   17,   18,   19,   20,   21,    8,   22,   23,
+        8,    8,    8,   24,   25,    8,    8,    8,   26,   27,
+       28,   29,    8,    8,    8,    8,   30,   31,    8,   33,
+        8,   33,   39,   42,   34,   46,   34,   40,   47,   50,
+       55,   37,   77,   51,   96,   43,   78,   75,   85,   97,
+       86,  102,  106,   52,  103,  367,  107,  147,   56,   59,
+       60,   61,   62,   63,   76,   64,   65,  148,  366,  152,
+       66,   67,   90,   91,  153,   68,   69,   70,   71,  162,
+      298,  229,   92,  299,  163,  230,  242,  265,  243,  365,
+
+      364,  363,  266,  244,   32,   32,    8,    8,  362,  361,
+      360,  359,  358,  357,  356,  355,  354,  353,  352,  351,
+      350,  349,  348,  347,  346,  345,  344,  343,  342,  341,
+      340,  339,  338,  337,  336,  335,  334,  333,  332,  331,
+      330,  329,  328,  327,  326,  325,  324,  323,  322,  321,
+      320,  319,  318,  317,  316,  315,  314,  313,  312,  311,
+      310,  309,  308,  307,  306,  305,  304,  303,  302,  301,
+      300,  297,  296,  295,  294,  293,  292,  291,  290,  289,
+      288,  287,  286,  285,  284,  283,  282,  281,  280,  279,
+      278,  277,  276,  275,  274,  273,  272,  271,  270,  269,
+
+      268,  267,  264,  263,  262,  261,  260,  259,  258,  257,
+      256,  255,  254,  253,  252,  251,  250,  249,  248,  247,
+      246,  245,  241,  240,  239,  238,  237,  236,  235,  234,
+      233,  232,  231,  228,  227,  226,  225,  224,  223,  222,
+      221,  220,  219,  218,  217,  216,  215,  214,  213,  212,
+      211,  210,  209,  208,  207,  206,  205,  204,  203,  202,
+      201,  200,  199,  198,  197,  196,  195,  194,  193,  192,
+      191,  190,  189,  188,  187,  186,  185,  184,  183,  182,
+      181,  180,  179,  178,  177,  176,  175,  174,  173,  172,
+      171,  170,  169,  168,  167,  166,  165,  164,  161,  160,
+
+      159,  158,  157,  156,  155,  154,  151,  150,  149,  146,
+      145,  144,  143,  142,  141,  140,  139,  138,  137,  136,
+      135,  134,  133,  132,  131,  130,  129,  128,  127,  126,
+      125,  124,  123,  122,  121,  120,  119,  118,  117,  116,
+      115,  114,  113,  112,  111,  110,  109,  108,  105,  104,
+      101,  100,   99,   98,   95,   94,   93,   89,   88,   87,
+       84,   83,   82,   81,   80,   79,   74,   73,   38,   36,
+       35,   72,   58,   57,   54,   53,   49,   48,   45,   44,
+       41,   38,   36,   36,   35,  368,    7,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368
+    } ;
+
+static yyconst short int yy_chk[426] =
+    {   0,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+        1,    1,    1,    1,    1,    1,    1,    1,    3,    3,
+        4,    4,   16,   18,    3,   21,    4,   16,   21,   24,
+       27,  371,   43,   24,   58,   18,   43,   41,   50,   58,
+       50,   63,   66,   24,   63,  366,   66,  109,   27,   31,
+       31,   31,   31,   31,   41,   31,   31,  109,  365,  113,
+       31,   31,   54,   54,  113,   31,   31,   31,   31,  124,
+      269,  194,   54,  269,  124,  194,  207,  232,  207,  364,
+
+      363,  362,  232,  207,  369,  369,  370,  370,  360,  359,
+      357,  356,  353,  352,  351,  350,  349,  348,  345,  344,
+      341,  339,  337,  336,  335,  334,  333,  331,  330,  328,
+      325,  324,  323,  319,  318,  317,  316,  315,  314,  312,
+      311,  310,  309,  308,  307,  306,  305,  304,  303,  302,
+      301,  299,  298,  296,  294,  293,  290,  289,  286,  285,
+      283,  282,  281,  278,  276,  275,  274,  273,  272,  271,
+      270,  268,  267,  266,  265,  264,  263,  262,  261,  259,
+      258,  257,  256,  255,  254,  252,  251,  250,  249,  248,
+      247,  246,  244,  243,  242,  240,  239,  238,  236,  235,
+
+      234,  233,  229,  228,  227,  226,  225,  224,  223,  222,
+      221,  220,  219,  218,  217,  216,  215,  214,  213,  212,
+      209,  208,  206,  205,  204,  203,  202,  201,  199,  198,
+      197,  196,  195,  192,  191,  190,  189,  188,  187,  186,
+      185,  184,  183,  182,  181,  180,  178,  177,  176,  175,
+      174,  173,  172,  171,  170,  169,  168,  167,  166,  165,
+      164,  163,  162,  161,  160,  159,  158,  157,  155,  154,
+      153,  152,  151,  150,  149,  148,  147,  146,  145,  144,
+      143,  142,  141,  140,  139,  138,  137,  136,  135,  134,
+      133,  132,  131,  130,  129,  128,  126,  125,  123,  122,
+
+      120,  119,  118,  116,  115,  114,  112,  111,  110,  108,
+      107,  106,  105,  104,  103,  102,  101,  100,   98,   97,
+       96,   95,   94,   93,   92,   91,   90,   89,   88,   87,
+       86,   85,   84,   83,   82,   81,   80,   79,   78,   77,
+       76,   75,   73,   71,   70,   69,   68,   67,   65,   64,
+       62,   61,   60,   59,   57,   56,   55,   53,   52,   51,
+       49,   48,   47,   46,   45,   44,   40,   39,   37,   36,
+       35,   34,   29,   28,   26,   25,   23,   22,   20,   19,
+       17,   15,   14,   13,    9,    7,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368,  368,  368,  368,  368,  368,
+      368,  368,  368,  368,  368
+    } ;
+
+static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
+static char *yy_full_match;
+static int yy_lp;
+#define REJECT \
+{ \
+*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
+yy_cp = yy_full_match; /* restore poss. backed-over text */ \
+++yy_lp; \
+goto find_rule; \
+}
+#define yymore() yymore_used_but_not_detected
+#define YY_MORE_ADJ 0
+#define YY_RESTORE_YY_MORE_OFFSET
+char *yytext;
+#line 1 "matcher_parser_lex.l"
+#define INITIAL 0
+#line 2 "matcher_parser_lex.l"
+#include "matcher_parser_lex.h"
+#include "matcher_parser_parse.h"
+#include <glib.h>
+
+#define MAX_STR_CONST 512
+
+char string_buf[MAX_STR_CONST];
+char * string_buf_ptr;
+
+static void add_char(char ch)
+{
+       if (string_buf_ptr - string_buf < sizeof(string_buf))
+               *string_buf_ptr++ = ch;
+}
+#define string 1
+
+#define section 2
+
+#line 639 "lex.yy.c"
+
+/* Macros after this point can all be overridden by user definitions in
+ * section 1.
+ */
+
+#ifndef YY_SKIP_YYWRAP
+#ifdef __cplusplus
+extern "C" int yywrap YY_PROTO(( void ));
+#else
+extern int yywrap YY_PROTO(( void ));
+#endif
+#endif
+
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
+#ifndef yytext_ptr
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+#endif
+
+#ifdef YY_NEED_STRLEN
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+#endif
+
+#ifndef YY_NO_INPUT
+#ifdef __cplusplus
+static int yyinput YY_PROTO(( void ));
+#else
+static int input YY_PROTO(( void ));
+#endif
+#endif
+
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines.  This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
+#endif
+
+/* Amount of stuff to slurp up with each read. */
+#ifndef YY_READ_BUF_SIZE
+#define YY_READ_BUF_SIZE 8192
+#endif
+
+/* Copy whatever the last rule matched to the standard output. */
+
+#ifndef ECHO
+/* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+#endif
+
+/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
+ * is returned in "result".
+ */
+#ifndef YY_INPUT
+#define YY_INPUT(buf,result,max_size) \
+       if ( yy_current_buffer->yy_is_interactive ) \
+               { \
+               int c = '*', n; \
+               for ( n = 0; n < max_size && \
+                            (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+                       buf[n] = (char) c; \
+               if ( c == '\n' ) \
+                       buf[n++] = (char) c; \
+               if ( c == EOF && ferror( yyin ) ) \
+                       YY_FATAL_ERROR( "input in flex scanner failed" ); \
+               result = n; \
+               } \
+       else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
+                 && ferror( yyin ) ) \
+               YY_FATAL_ERROR( "input in flex scanner failed" );
+#endif
+
+/* No semi-colon after return; correct usage is to write "yyterminate();" -
+ * we don't want an extra ';' after the "return" because that will cause
+ * some compilers to complain about unreachable statements.
+ */
+#ifndef yyterminate
+#define yyterminate() return YY_NULL
+#endif
+
+/* Number of entries by which start-condition stack grows. */
+#ifndef YY_START_STACK_INCR
+#define YY_START_STACK_INCR 25
+#endif
+
+/* Report a fatal error. */
+#ifndef YY_FATAL_ERROR
+#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+#endif
+
+/* Default declaration of generated scanner - a define so the user can
+ * easily add parameters.
+ */
+#ifndef YY_DECL
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
+
+/* Code executed at the beginning of each rule, after yytext and yyleng
+ * have been set up.
+ */
+#ifndef YY_USER_ACTION
+#define YY_USER_ACTION
+#endif
+
+/* Code executed at the end of each rule. */
+#ifndef YY_BREAK
+#define YY_BREAK break;
+#endif
+
+#define YY_RULE_SETUP \
+       YY_USER_ACTION
+
+YY_DECL
+       {
+       register yy_state_type yy_current_state;
+       register char *yy_cp = NULL, *yy_bp = NULL;
+       register int yy_act;
+
+#line 25 "matcher_parser_lex.l"
+
+
+#line 793 "lex.yy.c"
+
+       if ( yy_init )
+               {
+               yy_init = 0;
+
+#ifdef YY_USER_INIT
+               YY_USER_INIT;
+#endif
+
+               if ( ! yy_start )
+                       yy_start = 1;   /* first start state */
+
+               if ( ! yyin )
+                       yyin = stdin;
+
+               if ( ! yyout )
+                       yyout = stdout;
+
+               if ( ! yy_current_buffer )
+                       yy_current_buffer =
+                               yy_create_buffer( yyin, YY_BUF_SIZE );
+
+               yy_load_buffer_state();
+               }
+
+       while ( 1 )             /* loops until end-of-file is reached */
+               {
+               yy_cp = yy_c_buf_p;
+
+               /* Support of yytext. */
+               *yy_cp = yy_hold_char;
+
+               /* yy_bp points to the position in yy_ch_buf of the start of
+                * the current run.
+                */
+               yy_bp = yy_cp;
+
+               yy_current_state = yy_start;
+               yy_state_ptr = yy_state_buf;
+               *yy_state_ptr++ = yy_current_state;
+yy_match:
+               do
+                       {
+                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                               {
+                               yy_current_state = (int) yy_def[yy_current_state];
+                               if ( yy_current_state >= 369 )
+                                       yy_c = yy_meta[(unsigned int) yy_c];
+                               }
+                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+                       *yy_state_ptr++ = yy_current_state;
+                       ++yy_cp;
+                       }
+               while ( yy_base[yy_current_state] != 387 );
+
+yy_find_action:
+               yy_current_state = *--yy_state_ptr;
+               yy_lp = yy_accept[yy_current_state];
+find_rule: /* we branch to this label when backing up */
+               for ( ; ; ) /* until we find what rule we matched */
+                       {
+                       if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
+                               {
+                               yy_act = yy_acclist[yy_lp];
+                                       {
+                                       yy_full_match = yy_cp;
+                                       break;
+                                       }
+                               }
+                       --yy_cp;
+                       yy_current_state = *--yy_state_ptr;
+                       yy_lp = yy_accept[yy_current_state];
+                       }
+
+               YY_DO_BEFORE_ACTION;
+
+               if ( yy_act != YY_END_OF_BUFFER )
+                       {
+                       int yyl;
+                       for ( yyl = 0; yyl < yyleng; ++yyl )
+                               if ( yytext[yyl] == '\n' )
+                                       ++yylineno;
+                       }
+
+do_action:     /* This label is used only to access EOF actions. */
+
+
+               switch ( yy_act )
+       { /* beginning of action switch */
+case 1:
+YY_RULE_SETUP
+#line 27 "matcher_parser_lex.l"
+return MATCHER_ALL;
+       YY_BREAK
+case 2:
+YY_RULE_SETUP
+#line 28 "matcher_parser_lex.l"
+return MATCHER_UNREAD;
+       YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 29 "matcher_parser_lex.l"
+return MATCHER_NOT_UNREAD;
+       YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 30 "matcher_parser_lex.l"
+return MATCHER_NEW;
+       YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 31 "matcher_parser_lex.l"
+return MATCHER_NOT_NEW;
+       YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 32 "matcher_parser_lex.l"
+return MATCHER_MARKED;
+       YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 33 "matcher_parser_lex.l"
+return MATCHER_NOT_MARKED;
+       YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 34 "matcher_parser_lex.l"
+return MATCHER_DELETED;
+       YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 35 "matcher_parser_lex.l"
+return MATCHER_NOT_DELETED;
+       YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 36 "matcher_parser_lex.l"
+return MATCHER_REPLIED;
+       YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 37 "matcher_parser_lex.l"
+return MATCHER_NOT_REPLIED;
+       YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 38 "matcher_parser_lex.l"
+return MATCHER_FORWARDED;
+       YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 39 "matcher_parser_lex.l"
+return MATCHER_NOT_FORWARDED;
+       YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 40 "matcher_parser_lex.l"
+return MATCHER_SUBJECT;
+       YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 41 "matcher_parser_lex.l"
+return MATCHER_NOT_SUBJECT;
+       YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 42 "matcher_parser_lex.l"
+return MATCHER_FROM;
+       YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 43 "matcher_parser_lex.l"
+return MATCHER_NOT_FROM;
+       YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 44 "matcher_parser_lex.l"
+return MATCHER_TO;
+       YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 45 "matcher_parser_lex.l"
+return MATCHER_NOT_TO;
+       YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 46 "matcher_parser_lex.l"
+return MATCHER_CC;
+       YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 47 "matcher_parser_lex.l"
+return MATCHER_NOT_CC;
+       YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 48 "matcher_parser_lex.l"
+return MATCHER_TO_OR_CC;
+       YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 49 "matcher_parser_lex.l"
+return MATCHER_NOT_TO_AND_NOT_CC;
+       YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 50 "matcher_parser_lex.l"
+return MATCHER_AGE_GREATER;
+       YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 51 "matcher_parser_lex.l"
+return MATCHER_AGE_LOWER;
+       YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 52 "matcher_parser_lex.l"
+return MATCHER_NEWSGROUPS;
+       YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 53 "matcher_parser_lex.l"
+return MATCHER_NOT_NEWSGROUPS;
+       YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 54 "matcher_parser_lex.l"
+return MATCHER_INREPLYTO;
+       YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 55 "matcher_parser_lex.l"
+return MATCHER_NOT_INREPLYTO;
+       YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 56 "matcher_parser_lex.l"
+return MATCHER_REFERENCES;
+       YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 57 "matcher_parser_lex.l"
+return MATCHER_NOT_REFERENCES;
+       YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 58 "matcher_parser_lex.l"
+return MATCHER_SCORE_GREATER;
+       YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 59 "matcher_parser_lex.l"
+return MATCHER_SCORE_LOWER;
+       YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 60 "matcher_parser_lex.l"
+return MATCHER_SCORE_EQUAL;
+       YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 61 "matcher_parser_lex.l"
+return MATCHER_HEADER;
+       YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 62 "matcher_parser_lex.l"
+return MATCHER_NOT_HEADER;
+       YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 63 "matcher_parser_lex.l"
+return MATCHER_HEADERS_PART;
+       YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 64 "matcher_parser_lex.l"
+return MATCHER_NOT_HEADERS_PART;
+       YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 65 "matcher_parser_lex.l"
+return MATCHER_MESSAGE;
+       YY_BREAK
+case 40:
+YY_RULE_SETUP
+#line 66 "matcher_parser_lex.l"
+return MATCHER_NOT_MESSAGE;
+       YY_BREAK
+case 41:
+YY_RULE_SETUP
+#line 67 "matcher_parser_lex.l"
+return MATCHER_BODY_PART;
+       YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 68 "matcher_parser_lex.l"
+return MATCHER_NOT_BODY_PART;
+       YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 69 "matcher_parser_lex.l"
+return MATCHER_EXECUTE;
+       YY_BREAK
+case 44:
+YY_RULE_SETUP
+#line 70 "matcher_parser_lex.l"
+return MATCHER_NOT_EXECUTE;
+       YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 71 "matcher_parser_lex.l"
+return MATCHER_MATCHCASE;
+       YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 72 "matcher_parser_lex.l"
+return MATCHER_MATCH;
+       YY_BREAK
+case 47:
+YY_RULE_SETUP
+#line 73 "matcher_parser_lex.l"
+return MATCHER_REGEXPCASE;
+       YY_BREAK
+case 48:
+YY_RULE_SETUP
+#line 74 "matcher_parser_lex.l"
+return MATCHER_REGEXP;
+       YY_BREAK
+case 49:
+YY_RULE_SETUP
+#line 75 "matcher_parser_lex.l"
+return MATCHER_SCORE;
+       YY_BREAK
+case 50:
+YY_RULE_SETUP
+#line 76 "matcher_parser_lex.l"
+return MATCHER_MOVE;
+       YY_BREAK
+case 51:
+YY_RULE_SETUP
+#line 77 "matcher_parser_lex.l"
+return MATCHER_COPY;
+       YY_BREAK
+case 52:
+YY_RULE_SETUP
+#line 78 "matcher_parser_lex.l"
+return MATCHER_DELETE;
+       YY_BREAK
+case 53:
+YY_RULE_SETUP
+#line 79 "matcher_parser_lex.l"
+return MATCHER_MARK;
+       YY_BREAK
+case 54:
+YY_RULE_SETUP
+#line 80 "matcher_parser_lex.l"
+return MATCHER_UNMARK;
+       YY_BREAK
+case 55:
+YY_RULE_SETUP
+#line 81 "matcher_parser_lex.l"
+return MATCHER_MARK_AS_READ;
+       YY_BREAK
+case 56:
+YY_RULE_SETUP
+#line 82 "matcher_parser_lex.l"
+return MATCHER_MARK_AS_UNREAD;
+       YY_BREAK
+case 57:
+YY_RULE_SETUP
+#line 83 "matcher_parser_lex.l"
+return MATCHER_FORWARD;
+       YY_BREAK
+case 58:
+YY_RULE_SETUP
+#line 84 "matcher_parser_lex.l"
+return MATCHER_FORWARD_AS_ATTACHMENT;
+       YY_BREAK
+case 59:
+YY_RULE_SETUP
+#line 85 "matcher_parser_lex.l"
+return MATCHER_COLOR;
+       YY_BREAK
+case 60:
+YY_RULE_SETUP
+#line 86 "matcher_parser_lex.l"
+return MATCHER_BOUNCE;
+       YY_BREAK
+case 61:
+YY_RULE_SETUP
+#line 87 "matcher_parser_lex.l"
+return MATCHER_DELETE_ON_SERVER;
+       YY_BREAK
+case 62:
+YY_RULE_SETUP
+#line 88 "matcher_parser_lex.l"
+
+       YY_BREAK
+case 63:
+YY_RULE_SETUP
+#line 89 "matcher_parser_lex.l"
+return MATCHER_EOL;
+       YY_BREAK
+case 64:
+YY_RULE_SETUP
+#line 90 "matcher_parser_lex.l"
+return MATCHER_AND;
+       YY_BREAK
+case 65:
+YY_RULE_SETUP
+#line 91 "matcher_parser_lex.l"
+return MATCHER_OR;
+       YY_BREAK
+case 66:
+YY_RULE_SETUP
+#line 92 "matcher_parser_lex.l"
+{
+               BEGIN(string);
+               string_buf_ptr = string_buf;
+               }
+       YY_BREAK
+/* alfons - OK, the new attempt is to just swallow 
+                * *EVERYTHING* and make sure everything is escaped
+                * when actually performing things. */
+case 67:
+YY_RULE_SETUP
+#line 99 "matcher_parser_lex.l"
+{
+               /* take care of escaped \" because this means the
+                * quote char should be skipped */
+               add_char('\\');
+               add_char('\"');
+               }
+       YY_BREAK
+case 68:
+YY_RULE_SETUP
+#line 105 "matcher_parser_lex.l"
+{
+               /* get out of the state: string ends. */
+               BEGIN(0);
+               *string_buf_ptr = '\0';
+               yylval.str = string_buf;
+               return MATCHER_STRING;
+               }
+       YY_BREAK
+/* put everything else in the output. */
+case 69:
+YY_RULE_SETUP
+#line 113 "matcher_parser_lex.l"
+{
+               add_char(yytext[0]);
+               }
+       YY_BREAK
+case 70:
+YY_RULE_SETUP
+#line 116 "matcher_parser_lex.l"
+{
+               BEGIN(0);
+               yylval.str = yytext + 1;
+               yytext[strlen(yytext) - 1] = '\0';
+               return MATCHER_SECTION;
+               }
+       YY_BREAK
+case 71:
+YY_RULE_SETUP
+#line 122 "matcher_parser_lex.l"
+{
+               yylval.str = yytext;
+               return MATCHER_INTEGER;
+               }
+       YY_BREAK
+case 72:
+YY_RULE_SETUP
+#line 127 "matcher_parser_lex.l"
+ECHO;
+       YY_BREAK
+#line 1272 "lex.yy.c"
+                       case YY_STATE_EOF(INITIAL):
+                       case YY_STATE_EOF(string):
+                       case YY_STATE_EOF(section):
+                               yyterminate();
+
+       case YY_END_OF_BUFFER:
+               {
+               /* Amount of text matched not including the EOB char. */
+               int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+
+               /* Undo the effects of YY_DO_BEFORE_ACTION. */
+               *yy_cp = yy_hold_char;
+               YY_RESTORE_YY_MORE_OFFSET
+
+               if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+                       {
+                       /* We're scanning a new file or input source.  It's
+                        * possible that this happened because the user
+                        * just pointed yyin at a new source and called
+                        * yylex().  If so, then we have to assure
+                        * consistency between yy_current_buffer and our
+                        * globals.  Here is the right place to do so, because
+                        * this is the first action (other than possibly a
+                        * back-up) that will match for the new input source.
+                        */
+                       yy_n_chars = yy_current_buffer->yy_n_chars;
+                       yy_current_buffer->yy_input_file = yyin;
+                       yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+                       }
+
+               /* Note that here we test for yy_c_buf_p "<=" to the position
+                * of the first EOB in the buffer, since yy_c_buf_p will
+                * already have been incremented past the NUL character
+                * (since all states make transitions on EOB to the
+                * end-of-buffer state).  Contrast this with the test
+                * in input().
+                */
+               if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+                       { /* This was really a NUL. */
+                       yy_state_type yy_next_state;
+
+                       yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+
+                       yy_current_state = yy_get_previous_state();
+
+                       /* Okay, we're now positioned to make the NUL
+                        * transition.  We couldn't have
+                        * yy_get_previous_state() go ahead and do it
+                        * for us because it doesn't know how to deal
+                        * with the possibility of jamming (and we don't
+                        * want to build jamming into it because then it
+                        * will run more slowly).
+                        */
+
+                       yy_next_state = yy_try_NUL_trans( yy_current_state );
+
+                       yy_bp = yytext_ptr + YY_MORE_ADJ;
+
+                       if ( yy_next_state )
+                               {
+                               /* Consume the NUL. */
+                               yy_cp = ++yy_c_buf_p;
+                               yy_current_state = yy_next_state;
+                               goto yy_match;
+                               }
+
+                       else
+                               {
+                               yy_cp = yy_c_buf_p;
+                               goto yy_find_action;
+                               }
+                       }
+
+               else switch ( yy_get_next_buffer() )
+                       {
+                       case EOB_ACT_END_OF_FILE:
+                               {
+                               yy_did_buffer_switch_on_eof = 0;
+
+                               if ( yywrap() )
+                                       {
+                                       /* Note: because we've taken care in
+                                        * yy_get_next_buffer() to have set up
+                                        * yytext, we can now set up
+                                        * yy_c_buf_p so that if some total
+                                        * hoser (like flex itself) wants to
+                                        * call the scanner after we return the
+                                        * YY_NULL, it'll still work - another
+                                        * YY_NULL will get returned.
+                                        */
+                                       yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+
+                                       yy_act = YY_STATE_EOF(YY_START);
+                                       goto do_action;
+                                       }
+
+                               else
+                                       {
+                                       if ( ! yy_did_buffer_switch_on_eof )
+                                               YY_NEW_FILE;
+                                       }
+                               break;
+                               }
+
+                       case EOB_ACT_CONTINUE_SCAN:
+                               yy_c_buf_p =
+                                       yytext_ptr + yy_amount_of_matched_text;
+
+                               yy_current_state = yy_get_previous_state();
+
+                               yy_cp = yy_c_buf_p;
+                               yy_bp = yytext_ptr + YY_MORE_ADJ;
+                               goto yy_match;
+
+                       case EOB_ACT_LAST_MATCH:
+                               yy_c_buf_p =
+                               &yy_current_buffer->yy_ch_buf[yy_n_chars];
+
+                               yy_current_state = yy_get_previous_state();
+
+                               yy_cp = yy_c_buf_p;
+                               yy_bp = yytext_ptr + YY_MORE_ADJ;
+                               goto yy_find_action;
+                       }
+               break;
+               }
+
+       default:
+               YY_FATAL_ERROR(
+                       "fatal flex scanner internal error--no action found" );
+       } /* end of action switch */
+               } /* end of scanning one token */
+       } /* end of yylex */
+
+
+/* yy_get_next_buffer - try to read in a new buffer
+ *
+ * Returns a code representing an action:
+ *     EOB_ACT_LAST_MATCH -
+ *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
+ *     EOB_ACT_END_OF_FILE - end of file
+ */
+
+static int yy_get_next_buffer()
+       {
+       register char *dest = yy_current_buffer->yy_ch_buf;
+       register char *source = yytext_ptr;
+       register int number_to_move, i;
+       int ret_val;
+
+       if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+               YY_FATAL_ERROR(
+               "fatal flex scanner internal error--end of buffer missed" );
+
+       if ( yy_current_buffer->yy_fill_buffer == 0 )
+               { /* Don't try to fill the buffer, so this is an EOF. */
+               if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+                       {
+                       /* We matched a single character, the EOB, so
+                        * treat this as a final EOF.
+                        */
+                       return EOB_ACT_END_OF_FILE;
+                       }
+
+               else
+                       {
+                       /* We matched some text prior to the EOB, first
+                        * process it.
+                        */
+                       return EOB_ACT_LAST_MATCH;
+                       }
+               }
+
+       /* Try to read more data. */
+
+       /* First move last chars to start of buffer. */
+       number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+
+       for ( i = 0; i < number_to_move; ++i )
+               *(dest++) = *(source++);
+
+       if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+               /* don't do the read, it's not guaranteed to return an EOF,
+                * just force an EOF
+                */
+               yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+
+       else
+               {
+               int num_to_read =
+                       yy_current_buffer->yy_buf_size - number_to_move - 1;
+
+               while ( num_to_read <= 0 )
+                       { /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+                       YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
+
+                       /* just a shorter name for the current buffer */
+                       YY_BUFFER_STATE b = yy_current_buffer;
+
+                       int yy_c_buf_p_offset =
+                               (int) (yy_c_buf_p - b->yy_ch_buf);
+
+                       if ( b->yy_is_our_buffer )
+                               {
+                               int new_size = b->yy_buf_size * 2;
+
+                               if ( new_size <= 0 )
+                                       b->yy_buf_size += b->yy_buf_size / 8;
+                               else
+                                       b->yy_buf_size *= 2;
+
+                               b->yy_ch_buf = (char *)
+                                       /* Include room in for 2 EOB chars. */
+                                       yy_flex_realloc( (void *) b->yy_ch_buf,
+                                                        b->yy_buf_size + 2 );
+                               }
+                       else
+                               /* Can't grow it, we don't own it. */
+                               b->yy_ch_buf = 0;
+
+                       if ( ! b->yy_ch_buf )
+                               YY_FATAL_ERROR(
+                               "fatal error - scanner input buffer overflow" );
+
+                       yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+
+                       num_to_read = yy_current_buffer->yy_buf_size -
+                                               number_to_move - 1;
+#endif
+                       }
+
+               if ( num_to_read > YY_READ_BUF_SIZE )
+                       num_to_read = YY_READ_BUF_SIZE;
+
+               /* Read in more data. */
+               YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+                       yy_n_chars, num_to_read );
+
+               yy_current_buffer->yy_n_chars = yy_n_chars;
+               }
+
+       if ( yy_n_chars == 0 )
+               {
+               if ( number_to_move == YY_MORE_ADJ )
+                       {
+                       ret_val = EOB_ACT_END_OF_FILE;
+                       yyrestart( yyin );
+                       }
+
+               else
+                       {
+                       ret_val = EOB_ACT_LAST_MATCH;
+                       yy_current_buffer->yy_buffer_status =
+                               YY_BUFFER_EOF_PENDING;
+                       }
+               }
+
+       else
+               ret_val = EOB_ACT_CONTINUE_SCAN;
+
+       yy_n_chars += number_to_move;
+       yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+       yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+
+       yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+
+       return ret_val;
+       }
+
+
+/* yy_get_previous_state - get the state just before the EOB char was reached */
+
+static yy_state_type yy_get_previous_state()
+       {
+       register yy_state_type yy_current_state;
+       register char *yy_cp;
+
+       yy_current_state = yy_start;
+       yy_state_ptr = yy_state_buf;
+       *yy_state_ptr++ = yy_current_state;
+
+       for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+               {
+               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+                       {
+                       yy_current_state = (int) yy_def[yy_current_state];
+                       if ( yy_current_state >= 369 )
+                               yy_c = yy_meta[(unsigned int) yy_c];
+                       }
+               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+               *yy_state_ptr++ = yy_current_state;
+               }
+
+       return yy_current_state;
+       }
+
+
+/* yy_try_NUL_trans - try to make a transition on the NUL character
+ *
+ * synopsis
+ *     next_state = yy_try_NUL_trans( current_state );
+ */
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+       {
+       register int yy_is_jam;
+
+       register YY_CHAR yy_c = 1;
+       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+               {
+               yy_current_state = (int) yy_def[yy_current_state];
+               if ( yy_current_state >= 369 )
+                       yy_c = yy_meta[(unsigned int) yy_c];
+               }
+       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+       yy_is_jam = (yy_current_state == 368);
+       if ( ! yy_is_jam )
+               *yy_state_ptr++ = yy_current_state;
+
+       return yy_is_jam ? 0 : yy_current_state;
+       }
+
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+       {
+       register char *yy_cp = yy_c_buf_p;
+
+       /* undo effects of setting up yytext */
+       *yy_cp = yy_hold_char;
+
+       if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+               { /* need to shift things up to make room */
+               /* +2 for EOB chars. */
+               register int number_to_move = yy_n_chars + 2;
+               register char *dest = &yy_current_buffer->yy_ch_buf[
+                                       yy_current_buffer->yy_buf_size + 2];
+               register char *source =
+                               &yy_current_buffer->yy_ch_buf[number_to_move];
+
+               while ( source > yy_current_buffer->yy_ch_buf )
+                       *--dest = *--source;
+
+               yy_cp += (int) (dest - source);
+               yy_bp += (int) (dest - source);
+               yy_current_buffer->yy_n_chars =
+                       yy_n_chars = yy_current_buffer->yy_buf_size;
+
+               if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
+               }
+
+       *--yy_cp = (char) c;
+
+       if ( c == '\n' )
+               --yylineno;
+
+       yytext_ptr = yy_bp;
+       yy_hold_char = *yy_cp;
+       yy_c_buf_p = yy_cp;
+       }
+#endif /* ifndef YY_NO_UNPUT */
+
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
+       {
+       int c;
+
+       *yy_c_buf_p = yy_hold_char;
+
+       if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+               {
+               /* yy_c_buf_p now points to the character we want to return.
+                * If this occurs *before* the EOB characters, then it's a
+                * valid NUL; if not, then we've hit the end of the buffer.
+                */
+               if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+                       /* This was really a NUL. */
+                       *yy_c_buf_p = '\0';
+
+               else
+                       { /* need more input */
+                       int offset = yy_c_buf_p - yytext_ptr;
+                       ++yy_c_buf_p;
+
+                       switch ( yy_get_next_buffer() )
+                               {
+                               case EOB_ACT_LAST_MATCH:
+                                       /* This happens because yy_g_n_b()
+                                        * sees that we've accumulated a
+                                        * token and flags that we need to
+                                        * try matching the token before
+                                        * proceeding.  But for input(),
+                                        * there's no matching to consider.
+                                        * So convert the EOB_ACT_LAST_MATCH
+                                        * to EOB_ACT_END_OF_FILE.
+                                        */
+
+                                       /* Reset buffer status. */
+                                       yyrestart( yyin );
+
+                                       /* fall through */
+
+                               case EOB_ACT_END_OF_FILE:
+                                       {
+                                       if ( yywrap() )
+                                               return EOF;
+
+                                       if ( ! yy_did_buffer_switch_on_eof )
+                                               YY_NEW_FILE;
+#ifdef __cplusplus
+                                       return yyinput();
+#else
+                                       return input();
+#endif
+                                       }
+
+                               case EOB_ACT_CONTINUE_SCAN:
+                                       yy_c_buf_p = yytext_ptr + offset;
+                                       break;
+                               }
+                       }
+               }
+
+       c = *(unsigned char *) yy_c_buf_p;      /* cast for 8-bit char's */
+       *yy_c_buf_p = '\0';     /* preserve yytext */
+       yy_hold_char = *++yy_c_buf_p;
+
+       if ( c == '\n' )
+               ++yylineno;
+
+       return c;
+       }
+
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+       {
+       if ( ! yy_current_buffer )
+               yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+       yy_init_buffer( yy_current_buffer, input_file );
+       yy_load_buffer_state();
+       }
+
+
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+       {
+       if ( yy_current_buffer == new_buffer )
+               return;
+
+       if ( yy_current_buffer )
+               {
+               /* Flush out information for old buffer. */
+               *yy_c_buf_p = yy_hold_char;
+               yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+               yy_current_buffer->yy_n_chars = yy_n_chars;
+               }
+
+       yy_current_buffer = new_buffer;
+       yy_load_buffer_state();
+
+       /* We don't actually know whether we did this switch during
+        * EOF (yywrap()) processing, but the only time this flag
+        * is looked at is after yywrap() is called, so it's safe
+        * to go ahead and always set it.
+        */
+       yy_did_buffer_switch_on_eof = 1;
+       }
+
+
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+       {
+       yy_n_chars = yy_current_buffer->yy_n_chars;
+       yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+       yyin = yy_current_buffer->yy_input_file;
+       yy_hold_char = *yy_c_buf_p;
+       }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+       {
+       YY_BUFFER_STATE b;
+
+       b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+       if ( ! b )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_buf_size = size;
+
+       /* yy_ch_buf has to be 2 characters longer than the size given because
+        * we need to put in 2 end-of-buffer characters.
+        */
+       b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+       if ( ! b->yy_ch_buf )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
+
+       b->yy_is_our_buffer = 1;
+
+       yy_init_buffer( b, file );
+
+       return b;
+       }
+
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+       {
+       if ( ! b )
+               return;
+
+       if ( b == yy_current_buffer )
+               yy_current_buffer = (YY_BUFFER_STATE) 0;
+
+       if ( b->yy_is_our_buffer )
+               yy_flex_free( (void *) b->yy_ch_buf );
+
+       yy_flex_free( (void *) b );
+       }
+
+
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+       {
+       yy_flush_buffer( b );
+
+       b->yy_input_file = file;
+       b->yy_fill_buffer = 1;
+
+#if YY_ALWAYS_INTERACTIVE
+       b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+       b->yy_is_interactive = 0;
+#else
+       b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+       }
+
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+       {
+       if ( ! b )
+               return;
+
+       b->yy_n_chars = 0;
+
+       /* We always need two end-of-buffer characters.  The first causes
+        * a transition to the end-of-buffer state.  The second causes
+        * a jam in that state.
+        */
+       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
+       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
+
+       b->yy_buf_pos = &b->yy_ch_buf[0];
+
+       b->yy_at_bol = 1;
+       b->yy_buffer_status = YY_BUFFER_NEW;
+
+       if ( b == yy_current_buffer )
+               yy_load_buffer_state();
+       }
+
+
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+       {
+       YY_BUFFER_STATE b;
+
+       if ( size < 2 ||
+            base[size-2] != YY_END_OF_BUFFER_CHAR ||
+            base[size-1] != YY_END_OF_BUFFER_CHAR )
+               /* They forgot to leave room for the EOB's. */
+               return 0;
+
+       b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+       if ( ! b )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
+
+       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
+       b->yy_buf_pos = b->yy_ch_buf = base;
+       b->yy_is_our_buffer = 0;
+       b->yy_input_file = 0;
+       b->yy_n_chars = b->yy_buf_size;
+       b->yy_is_interactive = 0;
+       b->yy_at_bol = 1;
+       b->yy_fill_buffer = 0;
+       b->yy_buffer_status = YY_BUFFER_NEW;
+
+       yy_switch_to_buffer( b );
+
+       return b;
+       }
+#endif
+
+
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+       {
+       int len;
+       for ( len = 0; yy_str[len]; ++len )
+               ;
+
+       return yy_scan_bytes( yy_str, len );
+       }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+       {
+       YY_BUFFER_STATE b;
+       char *buf;
+       yy_size_t n;
+       int i;
+
+       /* Get memory for full buffer, including space for trailing EOB's. */
+       n = len + 2;
+       buf = (char *) yy_flex_alloc( n );
+       if ( ! buf )
+               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
+
+       for ( i = 0; i < len; ++i )
+               buf[i] = bytes[i];
+
+       buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
+
+       b = yy_scan_buffer( buf, n );
+       if ( ! b )
+               YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
+
+       /* It's okay to grow etc. this buffer, and we should throw it
+        * away when we're done.
+        */
+       b->yy_is_our_buffer = 1;
+
+       return b;
+       }
+#endif
+
+
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+       {
+       if ( yy_start_stack_ptr >= yy_start_stack_depth )
+               {
+               yy_size_t new_size;
+
+               yy_start_stack_depth += YY_START_STACK_INCR;
+               new_size = yy_start_stack_depth * sizeof( int );
+
+               if ( ! yy_start_stack )
+                       yy_start_stack = (int *) yy_flex_alloc( new_size );
+
+               else
+                       yy_start_stack = (int *) yy_flex_realloc(
+                                       (void *) yy_start_stack, new_size );
+
+               if ( ! yy_start_stack )
+                       YY_FATAL_ERROR(
+                       "out of memory expanding start-condition stack" );
+               }
+
+       yy_start_stack[yy_start_stack_ptr++] = YY_START;
+
+       BEGIN(new_state);
+       }
+#endif
+
+
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+       {
+       if ( --yy_start_stack_ptr < 0 )
+               YY_FATAL_ERROR( "start-condition stack underflow" );
+
+       BEGIN(yy_start_stack[yy_start_stack_ptr]);
+       }
+#endif
+
+
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+       {
+       return yy_start_stack[yy_start_stack_ptr - 1];
+       }
+#endif
+
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
+
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
+#else
+static void yy_fatal_error( msg )
+char msg[];
+#endif
+       {
+       (void) fprintf( stderr, "%s\n", msg );
+       exit( YY_EXIT_FAILURE );
+       }
+
+
+
+/* Redefine yyless() so it works in section 3 code. */
+
+#undef yyless
+#define yyless(n) \
+       do \
+               { \
+               /* Undo effects of setting up yytext. */ \
+               yytext[yyleng] = yy_hold_char; \
+               yy_c_buf_p = yytext + n; \
+               yy_hold_char = *yy_c_buf_p; \
+               *yy_c_buf_p = '\0'; \
+               yyleng = n; \
+               } \
+       while ( 0 )
+
+
+/* Internal utility routines. */
+
+#ifndef yytext_ptr
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+       {
+       register int i;
+       for ( i = 0; i < n; ++i )
+               s1[i] = s2[i];
+       }
+#endif
+
+#ifdef YY_NEED_STRLEN
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+       {
+       register int n;
+       for ( n = 0; s[n]; ++n )
+               ;
+
+       return n;
+       }
+#endif
+
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+       {
+       return (void *) malloc( size );
+       }
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+       {
+       /* The cast to (char *) in the following accommodates both
+        * implementations that use char* generic pointers, and those
+        * that use void* generic pointers.  It works with the latter
+        * because both ANSI C and C++ allow castless assignment from
+        * any pointer type to void*, and deal with argument conversions
+        * as though doing an assignment.
+        */
+       return (void *) realloc( (char *) ptr, size );
+       }
+
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+       {
+       free( ptr );
+       }
+
+#if YY_MAIN
+int main()
+       {
+       yylex();
+       return 0;
+       }
+#endif
+#line 127 "matcher_parser_lex.l"
+
index 58c00f84c4653518300647b0fa64422a860f36c7..3571326df573456e497c83032f3fa04703092432 100644 (file)
@@ -84,6 +84,7 @@ static void add_char(char ch)
 "forward_as_attachment"              return MATCHER_FORWARD_AS_ATTACHMENT;
 "color"         return MATCHER_COLOR;
 "bounce"       return MATCHER_BOUNCE;
 "forward_as_attachment"              return MATCHER_FORWARD_AS_ATTACHMENT;
 "color"         return MATCHER_COLOR;
 "bounce"       return MATCHER_BOUNCE;
+"delete_on_server"     return MATCHER_DELETE_ON_SERVER;
 [ \t]+
 "\n"           return MATCHER_EOL;
 "&"            return MATCHER_AND;
 [ \t]+
 "\n"           return MATCHER_EOL;
 "&"            return MATCHER_AND;
diff --git a/src/matcher_parser_parse.c b/src/matcher_parser_parse.c
new file mode 100644 (file)
index 0000000..3211857
--- /dev/null
@@ -0,0 +1,1999 @@
+
+/*  A Bison parser, made from matcher_parser_parse.y
+    by GNU Bison version 1.28  */
+
+#define YYBISON 1  /* Identify Bison output.  */
+
+#define        MATCHER_ALL     257
+#define        MATCHER_UNREAD  258
+#define        MATCHER_NOT_UNREAD      259
+#define        MATCHER_NEW     260
+#define        MATCHER_NOT_NEW 261
+#define        MATCHER_MARKED  262
+#define        MATCHER_NOT_MARKED      263
+#define        MATCHER_DELETED 264
+#define        MATCHER_NOT_DELETED     265
+#define        MATCHER_REPLIED 266
+#define        MATCHER_NOT_REPLIED     267
+#define        MATCHER_FORWARDED       268
+#define        MATCHER_NOT_FORWARDED   269
+#define        MATCHER_SUBJECT 270
+#define        MATCHER_NOT_SUBJECT     271
+#define        MATCHER_FROM    272
+#define        MATCHER_NOT_FROM        273
+#define        MATCHER_TO      274
+#define        MATCHER_NOT_TO  275
+#define        MATCHER_CC      276
+#define        MATCHER_NOT_CC  277
+#define        MATCHER_TO_OR_CC        278
+#define        MATCHER_NOT_TO_AND_NOT_CC       279
+#define        MATCHER_AGE_GREATER     280
+#define        MATCHER_AGE_LOWER       281
+#define        MATCHER_NEWSGROUPS      282
+#define        MATCHER_NOT_NEWSGROUPS  283
+#define        MATCHER_INREPLYTO       284
+#define        MATCHER_NOT_INREPLYTO   285
+#define        MATCHER_REFERENCES      286
+#define        MATCHER_NOT_REFERENCES  287
+#define        MATCHER_SCORE_GREATER   288
+#define        MATCHER_SCORE_LOWER     289
+#define        MATCHER_HEADER  290
+#define        MATCHER_NOT_HEADER      291
+#define        MATCHER_HEADERS_PART    292
+#define        MATCHER_NOT_HEADERS_PART        293
+#define        MATCHER_MESSAGE 294
+#define        MATCHER_NOT_MESSAGE     295
+#define        MATCHER_BODY_PART       296
+#define        MATCHER_NOT_BODY_PART   297
+#define        MATCHER_EXECUTE 298
+#define        MATCHER_NOT_EXECUTE     299
+#define        MATCHER_MATCHCASE       300
+#define        MATCHER_MATCH   301
+#define        MATCHER_REGEXPCASE      302
+#define        MATCHER_REGEXP  303
+#define        MATCHER_SCORE   304
+#define        MATCHER_MOVE    305
+#define        MATCHER_COPY    306
+#define        MATCHER_DELETE  307
+#define        MATCHER_MARK    308
+#define        MATCHER_UNMARK  309
+#define        MATCHER_MARK_AS_READ    310
+#define        MATCHER_MARK_AS_UNREAD  311
+#define        MATCHER_FORWARD 312
+#define        MATCHER_FORWARD_AS_ATTACHMENT   313
+#define        MATCHER_EOL     314
+#define        MATCHER_STRING  315
+#define        MATCHER_OR      316
+#define        MATCHER_AND     317
+#define        MATCHER_COLOR   318
+#define        MATCHER_SCORE_EQUAL     319
+#define        MATCHER_BOUNCE  320
+#define        MATCHER_DELETE_ON_SERVER        321
+#define        MATCHER_SECTION 322
+#define        MATCHER_INTEGER 323
+
+#line 1 "matcher_parser_parse.y"
+
+#include "filtering.h"
+#include "scoring.h"
+#include "matcher.h"
+#include "matcher_parser.h"
+#include "matcher_parser_lex.h"
+#include "intl.h"
+#include <glib.h>
+#include "defs.h"
+#include "utils.h"
+
+static gint error = 0;
+static gint bool_op = 0;
+static gint match_type = 0;
+static gchar * header = NULL;
+
+static MatcherProp * prop;
+
+static GSList * matchers_list = NULL;
+
+static MatcherList * cond;
+static gint score = 0;
+static FilteringAction * action = NULL;
+
+static FilteringProp *  filtering;
+static ScoringProp * scoring = NULL;
+
+static GSList ** prefs_scoring = NULL;
+static GSList ** prefs_filtering = NULL;
+
+static int matcher_parser_dialog = 0;
+
+
+/* ******************************************************************** */
+
+
+
+void matcher_parser_start_parsing(FILE * f)
+{
+       matcher_parserrestart(f);
+       matcher_parserparse();
+}
+FilteringProp * matcher_parser_get_filtering(gchar * str)
+{
+       void * bufstate;
+
+       /* bad coding to enable the sub-grammar matching
+          in yacc */
+       matcher_parserlineno = 1;
+       matcher_parser_dialog = 1;
+       bufstate = matcher_parser_scan_string(str);
+       if (matcher_parserparse() != 0)
+               filtering = NULL;
+       matcher_parser_dialog = 0;
+       matcher_parser_delete_buffer(bufstate);
+       return filtering;
+}
+
+ScoringProp * matcher_parser_get_scoring(gchar * str)
+{
+       void * bufstate;
+
+       /* bad coding to enable the sub-grammar matching
+          in yacc */
+       matcher_parserlineno = 1;
+       matcher_parser_dialog = 1;
+       bufstate = matcher_parser_scan_string(str);
+       if (matcher_parserparse() != 0)
+               scoring = NULL;
+       matcher_parser_dialog = 0;
+       matcher_parser_delete_buffer(bufstate);
+       return scoring;
+}
+
+MatcherList * matcher_parser_get_cond(gchar * str)
+{
+       void * bufstate;
+
+       /* bad coding to enable the sub-grammar matching
+          in yacc */
+       matcher_parserlineno = 1;
+       matcher_parser_dialog = 1;
+       bufstate = matcher_parser_scan_string(str);
+       matcher_parserparse();
+       matcher_parser_dialog = 0;
+       matcher_parser_delete_buffer(bufstate);
+       return cond;
+}
+
+MatcherProp * matcher_parser_get_prop(gchar * str)
+{
+       MatcherList * list;
+       MatcherProp * prop;
+
+       matcher_parserlineno = 1;
+       list = matcher_parser_get_cond(str);
+       if (list == NULL)
+               return NULL;
+
+       if (list->matchers == NULL)
+               return NULL;
+
+       if (list->matchers->next != NULL)
+               return NULL;
+
+       prop = list->matchers->data;
+
+       g_slist_free(list->matchers);
+       g_free(list);
+
+       return prop;
+}
+
+void matcher_parsererror(char * str)
+{
+       GSList * l;
+
+       if (matchers_list) {
+               for(l = matchers_list ; l != NULL ;
+                   l = g_slist_next(l))
+                       matcherprop_free((MatcherProp *)
+                                        l->data);
+               g_slist_free(matchers_list);
+               matchers_list = NULL;
+       }
+
+       g_warning(_("scoring / filtering parsing: %i: %s\n"),
+                 matcher_parserlineno, str);
+       error = 1;
+}
+
+int matcher_parserwrap(void)
+{
+       return 1;
+}
+
+#line 139 "matcher_parser_parse.y"
+typedef union {
+       char * str;
+       int value;
+} YYSTYPE;
+#include <stdio.h>
+
+#ifndef __cplusplus
+#ifndef __STDC__
+#define const
+#endif
+#endif
+
+
+
+#define        YYFINAL         159
+#define        YYFLAG          -32768
+#define        YYNTBASE        70
+
+#define YYTRANSLATE(x) ((unsigned)(x) <= 323 ? yytranslate[x] : 88)
+
+static const char yytranslate[] = {     0,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
+     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
+     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
+    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
+    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
+    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
+    47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
+    57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+    67,    68,    69
+};
+
+#if YYDEBUG != 0
+static const short yyprhs[] = {     0,
+     0,     1,     4,     7,     9,    11,    13,    16,    19,    22,
+    24,    27,    28,    30,    31,    33,    35,    37,    39,    41,
+    43,    45,    49,    51,    53,    55,    57,    59,    61,    63,
+    65,    67,    69,    71,    73,    75,    77,    79,    81,    85,
+    89,    93,    97,   101,   105,   109,   113,   117,   121,   124,
+   127,   131,   135,   139,   143,   147,   151,   154,   157,   160,
+   161,   167,   168,   174,   178,   182,   186,   190,   194,   198,
+   201,   204,   207,   210,   213,   215,   217,   219,   221,   223,
+   227,   231,   235,   238,   240
+};
+
+static const short yyrhs[] = {    -1,
+    71,    72,     0,    73,    72,     0,    73,     0,    74,     0,
+    75,     0,     1,    60,     0,    68,    60,     0,    80,    76,
+     0,    60,     0,    78,    77,     0,     0,    60,     0,     0,
+    86,     0,    87,     0,    46,     0,    47,     0,    48,     0,
+    49,     0,    81,     0,    81,    82,    83,     0,    83,     0,
+    63,     0,    62,     0,     3,     0,     4,     0,     5,     0,
+     6,     0,     7,     0,     8,     0,     9,     0,    10,     0,
+    11,     0,    12,     0,    13,     0,    14,     0,    15,     0,
+    16,    79,    61,     0,    17,    79,    61,     0,    18,    79,
+    61,     0,    19,    79,    61,     0,    20,    79,    61,     0,
+    21,    79,    61,     0,    22,    79,    61,     0,    23,    79,
+    61,     0,    24,    79,    61,     0,    25,    79,    61,     0,
+    26,    69,     0,    27,    69,     0,    28,    79,    61,     0,
+    29,    79,    61,     0,    30,    79,    61,     0,    31,    79,
+    61,     0,    32,    79,    61,     0,    33,    79,    61,     0,
+    34,    69,     0,    35,    69,     0,    65,    69,     0,     0,
+    36,    61,    84,    79,    61,     0,     0,    37,    61,    85,
+    79,    61,     0,    38,    79,    61,     0,    39,    79,    61,
+     0,    40,    79,    61,     0,    41,    79,    61,     0,    42,
+    79,    61,     0,    43,    79,    61,     0,    44,    61,     0,
+    45,    61,     0,    44,    61,     0,    51,    61,     0,    52,
+    61,     0,    53,     0,    54,     0,    55,     0,    56,     0,
+    57,     0,    58,    69,    61,     0,    59,    69,    61,     0,
+    66,    69,    61,     0,    64,    69,     0,    67,     0,    50,
+    69,     0
+};
+
+#endif
+
+#if YYDEBUG != 0
+static const short yyrline[] = { 0,
+   173,   180,   182,   185,   188,   190,   191,   196,   216,   218,
+   221,   223,   234,   236,   247,   259,   271,   276,   280,   284,
+   290,   298,   303,   310,   315,   321,   329,   336,   343,   350,
+   357,   364,   371,   378,   385,   392,   399,   406,   413,   422,
+   431,   440,   449,   458,   467,   476,   485,   494,   503,   512,
+   521,   530,   539,   548,   557,   566,   575,   584,   593,   602,
+   605,   615,   618,   628,   637,   646,   655,   664,   673,   682,
+   691,   702,   712,   721,   730,   737,   744,   751,   758,   765,
+   776,   787,   798,   807,   815
+};
+#endif
+
+
+#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
+
+static const char * const yytname[] = {   "$","error","$undefined.","MATCHER_ALL",
+"MATCHER_UNREAD","MATCHER_NOT_UNREAD","MATCHER_NEW","MATCHER_NOT_NEW","MATCHER_MARKED",
+"MATCHER_NOT_MARKED","MATCHER_DELETED","MATCHER_NOT_DELETED","MATCHER_REPLIED",
+"MATCHER_NOT_REPLIED","MATCHER_FORWARDED","MATCHER_NOT_FORWARDED","MATCHER_SUBJECT",
+"MATCHER_NOT_SUBJECT","MATCHER_FROM","MATCHER_NOT_FROM","MATCHER_TO","MATCHER_NOT_TO",
+"MATCHER_CC","MATCHER_NOT_CC","MATCHER_TO_OR_CC","MATCHER_NOT_TO_AND_NOT_CC",
+"MATCHER_AGE_GREATER","MATCHER_AGE_LOWER","MATCHER_NEWSGROUPS","MATCHER_NOT_NEWSGROUPS",
+"MATCHER_INREPLYTO","MATCHER_NOT_INREPLYTO","MATCHER_REFERENCES","MATCHER_NOT_REFERENCES",
+"MATCHER_SCORE_GREATER","MATCHER_SCORE_LOWER","MATCHER_HEADER","MATCHER_NOT_HEADER",
+"MATCHER_HEADERS_PART","MATCHER_NOT_HEADERS_PART","MATCHER_MESSAGE","MATCHER_NOT_MESSAGE",
+"MATCHER_BODY_PART","MATCHER_NOT_BODY_PART","MATCHER_EXECUTE","MATCHER_NOT_EXECUTE",
+"MATCHER_MATCHCASE","MATCHER_MATCH","MATCHER_REGEXPCASE","MATCHER_REGEXP","MATCHER_SCORE",
+"MATCHER_MOVE","MATCHER_COPY","MATCHER_DELETE","MATCHER_MARK","MATCHER_UNMARK",
+"MATCHER_MARK_AS_READ","MATCHER_MARK_AS_UNREAD","MATCHER_FORWARD","MATCHER_FORWARD_AS_ATTACHMENT",
+"MATCHER_EOL","MATCHER_STRING","MATCHER_OR","MATCHER_AND","MATCHER_COLOR","MATCHER_SCORE_EQUAL",
+"MATCHER_BOUNCE","MATCHER_DELETE_ON_SERVER","MATCHER_SECTION","MATCHER_INTEGER",
+"file","@1","file_line_list","file_line","section_notification","instruction",
+"end_instr_opt","end_action","filtering_or_scoring","match_type","condition",
+"condition_list","bool_op","one_condition","@2","@3","filtering_action","scoring_rule", NULL
+};
+#endif
+
+static const short yyr1[] = {     0,
+    71,    70,    72,    72,    73,    73,    73,    74,    75,    75,
+    76,    76,    77,    77,    78,    78,    79,    79,    79,    79,
+    80,    81,    81,    82,    82,    83,    83,    83,    83,    83,
+    83,    83,    83,    83,    83,    83,    83,    83,    83,    83,
+    83,    83,    83,    83,    83,    83,    83,    83,    83,    83,
+    83,    83,    83,    83,    83,    83,    83,    83,    83,    84,
+    83,    85,    83,    83,    83,    83,    83,    83,    83,    83,
+    83,    86,    86,    86,    86,    86,    86,    86,    86,    86,
+    86,    86,    86,    86,    87
+};
+
+static const short yyr2[] = {     0,
+     0,     2,     2,     1,     1,     1,     2,     2,     2,     1,
+     2,     0,     1,     0,     1,     1,     1,     1,     1,     1,
+     1,     3,     1,     1,     1,     1,     1,     1,     1,     1,
+     1,     1,     1,     1,     1,     1,     1,     1,     3,     3,
+     3,     3,     3,     3,     3,     3,     3,     3,     2,     2,
+     3,     3,     3,     3,     3,     3,     2,     2,     2,     0,
+     5,     0,     5,     3,     3,     3,     3,     3,     3,     2,
+     2,     2,     2,     2,     1,     1,     1,     1,     1,     3,
+     3,     3,     2,     1,     2
+};
+
+static const short yydefact[] = {     1,
+     0,     0,    26,    27,    28,    29,    30,    31,    32,    33,
+    34,    35,    36,    37,    38,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,    10,     0,     0,     2,     0,
+     5,     6,    12,    21,    23,     7,    17,    18,    19,    20,
+     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+    49,    50,     0,     0,     0,     0,     0,     0,    57,    58,
+    60,    62,     0,     0,     0,     0,     0,     0,    70,    71,
+    59,     8,     3,     0,     0,     0,     0,    75,    76,    77,
+    78,    79,     0,     0,     0,     0,    84,     9,    14,    15,
+    16,    25,    24,     0,    39,    40,    41,    42,    43,    44,
+    45,    46,    47,    48,    51,    52,    53,    54,    55,    56,
+     0,     0,    64,    65,    66,    67,    68,    69,    72,    85,
+    73,    74,     0,     0,    83,     0,    13,    11,    22,     0,
+     0,    80,    81,    82,    61,    63,     0,     0,     0
+};
+
+static const short yydefgoto[] = {   157,
+     1,    49,    50,    51,    52,   108,   148,   109,    61,    53,
+    54,   114,    55,   131,   132,   110,   111
+};
+
+static const short yypact[] = {-32768,
+   115,   -31,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,   -29,   -29,   -29,   -29,   -29,
+   -29,   -29,   -29,   -29,   -29,     4,     5,   -29,   -29,   -29,
+   -29,   -29,   -29,     6,     7,    16,    17,   -29,   -29,   -29,
+   -29,   -29,   -29,    18,    19,-32768,    12,    22,-32768,    27,
+-32768,-32768,    46,   -53,-32768,-32768,-32768,-32768,-32768,-32768,
+    23,    24,    25,    28,    30,    32,    33,    45,    47,    48,
+-32768,-32768,    50,    56,   100,   101,   102,   103,-32768,-32768,
+-32768,-32768,   104,   105,   106,   107,   108,   109,-32768,-32768,
+-32768,-32768,-32768,   110,    14,   111,   112,-32768,-32768,-32768,
+-32768,-32768,    38,   113,   158,   159,-32768,-32768,   114,-32768,
+-32768,-32768,-32768,   181,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+   -29,   -29,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
+-32768,-32768,   116,   117,-32768,   118,-32768,-32768,-32768,   120,
+   168,-32768,-32768,-32768,-32768,-32768,    88,   176,-32768
+};
+
+static const short yypgoto[] = {-32768,
+-32768,   180,-32768,-32768,-32768,-32768,-32768,-32768,   -17,-32768,
+-32768,-32768,   119,-32768,-32768,-32768,-32768
+};
+
+
+#define        YYLAST          246
+
+
+static const short yytable[] = {    62,
+    63,    64,    65,    66,    67,    68,    69,    70,   112,   113,
+    73,    74,    75,    76,    77,    78,    57,    58,    59,    60,
+    83,    84,    85,    86,    87,    88,    -4,     2,    56,     3,
+     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
+    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+    34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+    44,    45,    71,    72,    79,    80,    81,    82,    89,    90,
+    91,    92,   140,   115,   116,   117,    46,   158,   118,    94,
+   119,    47,   120,   121,    48,    95,    96,    97,    98,    99,
+   100,   101,   102,   103,   104,   122,   143,   123,   124,   105,
+   125,   106,   107,   150,   151,     2,   126,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+   127,   128,   129,   130,   133,   134,   135,   136,   137,   138,
+   139,   141,   142,   147,    46,   159,   152,   153,   154,    47,
+   155,   144,    48,     3,     4,     5,     6,     7,     8,     9,
+    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
+    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+    40,    41,    42,    43,    44,    45,   145,   146,   156,    93,
+     0,     0,   149,     0,     0,     0,     0,     0,     0,     0,
+     0,     0,     0,     0,     0,    47
+};
+
+static const short yycheck[] = {    17,
+    18,    19,    20,    21,    22,    23,    24,    25,    62,    63,
+    28,    29,    30,    31,    32,    33,    46,    47,    48,    49,
+    38,    39,    40,    41,    42,    43,     0,     1,    60,     3,
+     4,     5,     6,     7,     8,     9,    10,    11,    12,    13,
+    14,    15,    16,    17,    18,    19,    20,    21,    22,    23,
+    24,    25,    26,    27,    28,    29,    30,    31,    32,    33,
+    34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
+    44,    45,    69,    69,    69,    69,    61,    61,    61,    61,
+    69,    60,    69,    61,    61,    61,    60,     0,    61,    44,
+    61,    65,    61,    61,    68,    50,    51,    52,    53,    54,
+    55,    56,    57,    58,    59,    61,    69,    61,    61,    64,
+    61,    66,    67,   131,   132,     1,    61,     3,     4,     5,
+     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
+    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
+    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
+    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
+    61,    61,    61,    61,    61,    61,    61,    61,    61,    61,
+    61,    61,    61,    60,    60,     0,    61,    61,    61,    65,
+    61,    69,    68,     3,     4,     5,     6,     7,     8,     9,
+    10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
+    20,    21,    22,    23,    24,    25,    26,    27,    28,    29,
+    30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
+    40,    41,    42,    43,    44,    45,    69,    69,    61,    50,
+    -1,    -1,   114,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+    -1,    -1,    -1,    -1,    -1,    65
+};
+/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
+#line 3 "/usr/lib/bison.simple"
+/* This file comes from bison-1.28.  */
+
+/* Skeleton output parser for bison,
+   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
+
+   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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
+/* This is the parser code that is written into each bison parser
+  when the %semantic_parser declaration is not specified in the grammar.
+  It was written by Richard Stallman by simplifying the hairy parser
+  used when %semantic_parser is specified.  */
+
+#ifndef YYSTACK_USE_ALLOCA
+#ifdef alloca
+#define YYSTACK_USE_ALLOCA
+#else /* alloca not defined */
+#ifdef __GNUC__
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#else /* not GNU C.  */
+#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
+#define YYSTACK_USE_ALLOCA
+#include <alloca.h>
+#else /* not sparc */
+/* We think this test detects Watcom and Microsoft C.  */
+/* This used to test MSDOS, but that is a bad idea
+   since that symbol is in the user namespace.  */
+#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
+#if 0 /* No need for malloc.h, which pollutes the namespace;
+        instead, just don't use alloca.  */
+#include <malloc.h>
+#endif
+#else /* not MSDOS, or __TURBOC__ */
+#if defined(_AIX)
+/* I don't know what this was needed for, but it pollutes the namespace.
+   So I turned it off.   rms, 2 May 1997.  */
+/* #include <malloc.h>  */
+ #pragma alloca
+#define YYSTACK_USE_ALLOCA
+#else /* not MSDOS, or __TURBOC__, or _AIX */
+#if 0
+#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
+                and on HPUX 10.  Eventually we can turn this on.  */
+#define YYSTACK_USE_ALLOCA
+#define alloca __builtin_alloca
+#endif /* __hpux */
+#endif
+#endif /* not _AIX */
+#endif /* not MSDOS, or __TURBOC__ */
+#endif /* not sparc */
+#endif /* not GNU C */
+#endif /* alloca not defined */
+#endif /* YYSTACK_USE_ALLOCA not defined */
+
+#ifdef YYSTACK_USE_ALLOCA
+#define YYSTACK_ALLOC alloca
+#else
+#define YYSTACK_ALLOC malloc
+#endif
+
+/* Note: there must be only one dollar sign in this file.
+   It is replaced by the list of actions, each action
+   as one case of the switch.  */
+
+#define yyerrok                (yyerrstatus = 0)
+#define yyclearin      (yychar = YYEMPTY)
+#define YYEMPTY                -2
+#define YYEOF          0
+#define YYACCEPT       goto yyacceptlab
+#define YYABORT        goto yyabortlab
+#define YYERROR                goto yyerrlab1
+/* Like YYERROR except do call yyerror.
+   This remains here temporarily to ease the
+   transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  */
+#define YYFAIL         goto yyerrlab
+#define YYRECOVERING()  (!!yyerrstatus)
+#define YYBACKUP(token, value) \
+do                                                             \
+  if (yychar == YYEMPTY && yylen == 1)                         \
+    { yychar = (token), yylval = (value);                      \
+      yychar1 = YYTRANSLATE (yychar);                          \
+      YYPOPSTACK;                                              \
+      goto yybackup;                                           \
+    }                                                          \
+  else                                                         \
+    { yyerror ("syntax error: cannot back up"); YYERROR; }     \
+while (0)
+
+#define YYTERROR       1
+#define YYERRCODE      256
+
+#ifndef YYPURE
+#define YYLEX          yylex()
+#endif
+
+#ifdef YYPURE
+#ifdef YYLSP_NEEDED
+#ifdef YYLEX_PARAM
+#define YYLEX          yylex(&yylval, &yylloc, YYLEX_PARAM)
+#else
+#define YYLEX          yylex(&yylval, &yylloc)
+#endif
+#else /* not YYLSP_NEEDED */
+#ifdef YYLEX_PARAM
+#define YYLEX          yylex(&yylval, YYLEX_PARAM)
+#else
+#define YYLEX          yylex(&yylval)
+#endif
+#endif /* not YYLSP_NEEDED */
+#endif
+
+/* If nonreentrant, generate the variables here */
+
+#ifndef YYPURE
+
+int    yychar;                 /*  the lookahead symbol                */
+YYSTYPE        yylval;                 /*  the semantic value of the           */
+                               /*  lookahead symbol                    */
+
+#ifdef YYLSP_NEEDED
+YYLTYPE yylloc;                        /*  location data for the lookahead     */
+                               /*  symbol                              */
+#endif
+
+int yynerrs;                   /*  number of parse errors so far       */
+#endif  /* not YYPURE */
+
+#if YYDEBUG != 0
+int yydebug;                   /*  nonzero means print parse trace     */
+/* Since this is uninitialized, it does not stop multiple parsers
+   from coexisting.  */
+#endif
+
+/*  YYINITDEPTH indicates the initial size of the parser's stacks      */
+
+#ifndef        YYINITDEPTH
+#define YYINITDEPTH 200
+#endif
+
+/*  YYMAXDEPTH is the maximum size the stacks can grow to
+    (effective only if the built-in stack extension method is used).  */
+
+#if YYMAXDEPTH == 0
+#undef YYMAXDEPTH
+#endif
+
+#ifndef YYMAXDEPTH
+#define YYMAXDEPTH 10000
+#endif
+\f
+/* Define __yy_memcpy.  Note that the size argument
+   should be passed with type unsigned int, because that is what the non-GCC
+   definitions require.  With GCC, __builtin_memcpy takes an arg
+   of type size_t, but it can handle unsigned int.  */
+
+#if __GNUC__ > 1               /* GNU C and GNU C++ define this.  */
+#define __yy_memcpy(TO,FROM,COUNT)     __builtin_memcpy(TO,FROM,COUNT)
+#else                          /* not GNU C or C++ */
+#ifndef __cplusplus
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+static void
+__yy_memcpy (to, from, count)
+     char *to;
+     char *from;
+     unsigned int count;
+{
+  register char *f = from;
+  register char *t = to;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+
+#else /* __cplusplus */
+
+/* This is the most reliable way to avoid incompatibilities
+   in available built-in functions on various systems.  */
+static void
+__yy_memcpy (char *to, char *from, unsigned int count)
+{
+  register char *t = to;
+  register char *f = from;
+  register int i = count;
+
+  while (i-- > 0)
+    *t++ = *f++;
+}
+
+#endif
+#endif
+\f
+#line 217 "/usr/lib/bison.simple"
+
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+   into yyparse.  The argument should have type void *.
+   It should actually point to an object.
+   Grammar actions can access the variable by casting it
+   to the proper pointer type.  */
+
+#ifdef YYPARSE_PARAM
+#ifdef __cplusplus
+#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL
+#else /* not __cplusplus */
+#define YYPARSE_PARAM_ARG YYPARSE_PARAM
+#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
+#endif /* not __cplusplus */
+#else /* not YYPARSE_PARAM */
+#define YYPARSE_PARAM_ARG
+#define YYPARSE_PARAM_DECL
+#endif /* not YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes.  */
+#ifdef __GNUC__
+#ifdef YYPARSE_PARAM
+int yyparse (void *);
+#else
+int yyparse (void);
+#endif
+#endif
+
+int
+yyparse(YYPARSE_PARAM_ARG)
+     YYPARSE_PARAM_DECL
+{
+  register int yystate;
+  register int yyn;
+  register short *yyssp;
+  register YYSTYPE *yyvsp;
+  int yyerrstatus;     /*  number of tokens to shift before error messages enabled */
+  int yychar1 = 0;             /*  lookahead token as an internal (translated) token number */
+
+  short        yyssa[YYINITDEPTH];     /*  the state stack                     */
+  YYSTYPE yyvsa[YYINITDEPTH];  /*  the semantic value stack            */
+
+  short *yyss = yyssa;         /*  refer to the stacks thru separate pointers */
+  YYSTYPE *yyvs = yyvsa;       /*  to allow yyoverflow to reallocate them elsewhere */
+
+#ifdef YYLSP_NEEDED
+  YYLTYPE yylsa[YYINITDEPTH];  /*  the location stack                  */
+  YYLTYPE *yyls = yylsa;
+  YYLTYPE *yylsp;
+
+#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
+#else
+#define YYPOPSTACK   (yyvsp--, yyssp--)
+#endif
+
+  int yystacksize = YYINITDEPTH;
+  int yyfree_stacks = 0;
+
+#ifdef YYPURE
+  int yychar;
+  YYSTYPE yylval;
+  int yynerrs;
+#ifdef YYLSP_NEEDED
+  YYLTYPE yylloc;
+#endif
+#endif
+
+  YYSTYPE yyval;               /*  the variable used to return         */
+                               /*  semantic values from the action     */
+                               /*  routines                            */
+
+  int yylen;
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Starting parse\n");
+#endif
+
+  yystate = 0;
+  yyerrstatus = 0;
+  yynerrs = 0;
+  yychar = YYEMPTY;            /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+
+  yyssp = yyss - 1;
+  yyvsp = yyvs;
+#ifdef YYLSP_NEEDED
+  yylsp = yyls;
+#endif
+
+/* Push a new state, which is found in  yystate  .  */
+/* In all cases, when you get here, the value and location stacks
+   have just been pushed. so pushing a state here evens the stacks.  */
+yynewstate:
+
+  *++yyssp = yystate;
+
+  if (yyssp >= yyss + yystacksize - 1)
+    {
+      /* Give user a chance to reallocate the stack */
+      /* Use copies of these so that the &'s don't force the real ones into memory. */
+      YYSTYPE *yyvs1 = yyvs;
+      short *yyss1 = yyss;
+#ifdef YYLSP_NEEDED
+      YYLTYPE *yyls1 = yyls;
+#endif
+
+      /* Get the current used size of the three stacks, in elements.  */
+      int size = yyssp - yyss + 1;
+
+#ifdef yyoverflow
+      /* Each stack pointer address is followed by the size of
+        the data in use in that stack, in bytes.  */
+#ifdef YYLSP_NEEDED
+      /* This used to be a conditional around just the two extra args,
+        but that might be undefined if yyoverflow is a macro.  */
+      yyoverflow("parser stack overflow",
+                &yyss1, size * sizeof (*yyssp),
+                &yyvs1, size * sizeof (*yyvsp),
+                &yyls1, size * sizeof (*yylsp),
+                &yystacksize);
+#else
+      yyoverflow("parser stack overflow",
+                &yyss1, size * sizeof (*yyssp),
+                &yyvs1, size * sizeof (*yyvsp),
+                &yystacksize);
+#endif
+
+      yyss = yyss1; yyvs = yyvs1;
+#ifdef YYLSP_NEEDED
+      yyls = yyls1;
+#endif
+#else /* no yyoverflow */
+      /* Extend the stack our own way.  */
+      if (yystacksize >= YYMAXDEPTH)
+       {
+         yyerror("parser stack overflow");
+         if (yyfree_stacks)
+           {
+             free (yyss);
+             free (yyvs);
+#ifdef YYLSP_NEEDED
+             free (yyls);
+#endif
+           }
+         return 2;
+       }
+      yystacksize *= 2;
+      if (yystacksize > YYMAXDEPTH)
+       yystacksize = YYMAXDEPTH;
+#ifndef YYSTACK_USE_ALLOCA
+      yyfree_stacks = 1;
+#endif
+      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
+      __yy_memcpy ((char *)yyss, (char *)yyss1,
+                  size * (unsigned int) sizeof (*yyssp));
+      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
+      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
+                  size * (unsigned int) sizeof (*yyvsp));
+#ifdef YYLSP_NEEDED
+      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
+      __yy_memcpy ((char *)yyls, (char *)yyls1,
+                  size * (unsigned int) sizeof (*yylsp));
+#endif
+#endif /* no yyoverflow */
+
+      yyssp = yyss + size - 1;
+      yyvsp = yyvs + size - 1;
+#ifdef YYLSP_NEEDED
+      yylsp = yyls + size - 1;
+#endif
+
+#if YYDEBUG != 0
+      if (yydebug)
+       fprintf(stderr, "Stack size increased to %d\n", yystacksize);
+#endif
+
+      if (yyssp >= yyss + yystacksize - 1)
+       YYABORT;
+    }
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Entering state %d\n", yystate);
+#endif
+
+  goto yybackup;
+ yybackup:
+
+/* Do appropriate processing given the current state.  */
+/* Read a lookahead token if we need one and don't already have one.  */
+/* yyresume: */
+
+  /* First try to decide what to do without reference to lookahead token.  */
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    goto yydefault;
+
+  /* Not known => get a lookahead token if don't already have one.  */
+
+  /* yychar is either YYEMPTY or YYEOF
+     or a valid token in external form.  */
+
+  if (yychar == YYEMPTY)
+    {
+#if YYDEBUG != 0
+      if (yydebug)
+       fprintf(stderr, "Reading a token: ");
+#endif
+      yychar = YYLEX;
+    }
+
+  /* Convert token to internal form (in yychar1) for indexing tables with */
+
+  if (yychar <= 0)             /* This means end of input. */
+    {
+      yychar1 = 0;
+      yychar = YYEOF;          /* Don't call YYLEX any more */
+
+#if YYDEBUG != 0
+      if (yydebug)
+       fprintf(stderr, "Now at end of input.\n");
+#endif
+    }
+  else
+    {
+      yychar1 = YYTRANSLATE(yychar);
+
+#if YYDEBUG != 0
+      if (yydebug)
+       {
+         fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
+         /* Give the individual parser a way to print the precise meaning
+            of a token, for further debugging info.  */
+#ifdef YYPRINT
+         YYPRINT (stderr, yychar, yylval);
+#endif
+         fprintf (stderr, ")\n");
+       }
+#endif
+    }
+
+  yyn += yychar1;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
+    goto yydefault;
+
+  yyn = yytable[yyn];
+
+  /* yyn is what to do for this token type in this state.
+     Negative => reduce, -yyn is rule number.
+     Positive => shift, yyn is new state.
+       New state is final state => don't bother to shift,
+       just return success.
+     0, or most negative number => error.  */
+
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+       goto yyerrlab;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+  else if (yyn == 0)
+    goto yyerrlab;
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+  /* Shift the lookahead token.  */
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
+#endif
+
+  /* Discard the token being shifted unless it is eof.  */
+  if (yychar != YYEOF)
+    yychar = YYEMPTY;
+
+  *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+  *++yylsp = yylloc;
+#endif
+
+  /* count tokens shifted since error; after three, turn off error status.  */
+  if (yyerrstatus) yyerrstatus--;
+
+  yystate = yyn;
+  goto yynewstate;
+
+/* Do the default action for the current state.  */
+yydefault:
+
+  yyn = yydefact[yystate];
+  if (yyn == 0)
+    goto yyerrlab;
+
+/* Do a reduction.  yyn is the number of a rule to reduce with.  */
+yyreduce:
+  yylen = yyr2[yyn];
+  if (yylen > 0)
+    yyval = yyvsp[1-yylen]; /* implement default value of the action */
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      int i;
+
+      fprintf (stderr, "Reducing via rule %d (line %d), ",
+              yyn, yyrline[yyn]);
+
+      /* Print the symbols being reduced, and their result.  */
+      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
+       fprintf (stderr, "%s ", yytname[yyrhs[i]]);
+      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+    }
+#endif
+
+
+  switch (yyn) {
+
+case 1:
+#line 174 "matcher_parser_parse.y"
+{
+       if (!matcher_parser_dialog) {
+               prefs_scoring = &global_scoring;
+               prefs_filtering = &global_processing;
+       }
+;
+    break;}
+case 7:
+#line 192 "matcher_parser_parse.y"
+{
+       yyerrok;
+;
+    break;}
+case 8:
+#line 198 "matcher_parser_parse.y"
+{
+       gchar * folder = yyvsp[-1].str;
+       FolderItem * item = NULL;
+
+       if (!matcher_parser_dialog) {
+               item = folder_find_item_from_identifier(folder);
+               if (item == NULL) {
+                       prefs_scoring = &global_scoring;
+                       prefs_filtering = &global_processing;
+               }
+               else {
+                       prefs_scoring = &item->prefs->scoring;
+                       prefs_filtering = &item->prefs->processing;
+               }
+       }
+;
+    break;}
+case 12:
+#line 224 "matcher_parser_parse.y"
+{
+       if (matcher_parser_dialog)
+               YYACCEPT;
+       else {
+               matcher_parsererror("parse error");
+               YYERROR;
+       }
+;
+    break;}
+case 14:
+#line 237 "matcher_parser_parse.y"
+{
+       if (matcher_parser_dialog)
+               YYACCEPT;
+       else {
+               matcher_parsererror("parse error");
+               YYERROR;
+       }
+;
+    break;}
+case 15:
+#line 249 "matcher_parser_parse.y"
+{
+       filtering = filteringprop_new(cond, action);
+       cond = NULL;
+       action = NULL;
+       if (!matcher_parser_dialog) {
+               * prefs_filtering = g_slist_append(* prefs_filtering,
+                                                  filtering);
+               filtering = NULL;
+       }
+;
+    break;}
+case 16:
+#line 260 "matcher_parser_parse.y"
+{
+       scoring = scoringprop_new(cond, score);
+       cond = NULL;
+       score = 0;
+       if (!matcher_parser_dialog) {
+               * prefs_scoring = g_slist_append(* prefs_scoring, scoring);
+               scoring = NULL;
+       }
+;
+    break;}
+case 17:
+#line 273 "matcher_parser_parse.y"
+{
+       match_type = MATCHTYPE_MATCHCASE;
+;
+    break;}
+case 18:
+#line 277 "matcher_parser_parse.y"
+{
+       match_type = MATCHTYPE_MATCH;
+;
+    break;}
+case 19:
+#line 281 "matcher_parser_parse.y"
+{
+       match_type = MATCHTYPE_REGEXPCASE;
+;
+    break;}
+case 20:
+#line 285 "matcher_parser_parse.y"
+{
+       match_type = MATCHTYPE_REGEXP;
+;
+    break;}
+case 21:
+#line 292 "matcher_parser_parse.y"
+{
+       cond = matcherlist_new(matchers_list, (bool_op == MATCHERBOOL_AND));
+       matchers_list = NULL;
+;
+    break;}
+case 22:
+#line 300 "matcher_parser_parse.y"
+{
+       matchers_list = g_slist_append(matchers_list, prop);
+;
+    break;}
+case 23:
+#line 304 "matcher_parser_parse.y"
+{
+       matchers_list = NULL;
+       matchers_list = g_slist_append(matchers_list, prop);
+;
+    break;}
+case 24:
+#line 312 "matcher_parser_parse.y"
+{
+       bool_op = MATCHERBOOL_AND;
+;
+    break;}
+case 25:
+#line 316 "matcher_parser_parse.y"
+{
+       bool_op = MATCHERBOOL_OR;
+;
+    break;}
+case 26:
+#line 323 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_ALL;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 27:
+#line 330 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_UNREAD;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 28:
+#line 337 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_UNREAD;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 29:
+#line 344 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NEW;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 30:
+#line 351 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_NEW;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 31:
+#line 358 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_MARKED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 32:
+#line 365 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_MARKED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 33:
+#line 372 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_DELETED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 34:
+#line 379 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_DELETED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 35:
+#line 386 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_REPLIED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 36:
+#line 393 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_REPLIED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 37:
+#line 400 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_FORWARDED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 38:
+#line 407 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+
+       criteria = MATCHCRITERIA_NOT_FORWARDED;
+       prop = matcherprop_new(criteria, NULL, 0, NULL, 0);
+;
+    break;}
+case 39:
+#line 414 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_SUBJECT;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 40:
+#line 423 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_SUBJECT;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 41:
+#line 432 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_FROM;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 42:
+#line 441 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_FROM;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 43:
+#line 450 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_TO;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 44:
+#line 459 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_TO;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 45:
+#line 468 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_CC;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 46:
+#line 477 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_CC;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 47:
+#line 486 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_TO_OR_CC;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 48:
+#line 495 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_TO_AND_NOT_CC;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 49:
+#line 504 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gint value = 0;
+
+       criteria = MATCHCRITERIA_AGE_GREATER;
+       value = atoi(yyvsp[0].value);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+;
+    break;}
+case 50:
+#line 513 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gint value = 0;
+
+       criteria = MATCHCRITERIA_AGE_LOWER;
+       value = atoi(yyvsp[0].value);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+;
+    break;}
+case 51:
+#line 522 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NEWSGROUPS;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 52:
+#line 531 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_NEWSGROUPS;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 53:
+#line 540 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_INREPLYTO;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 54:
+#line 549 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_INREPLYTO;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 55:
+#line 558 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_REFERENCES;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 56:
+#line 567 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_REFERENCES;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 57:
+#line 576 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gint value = 0;
+
+       criteria = MATCHCRITERIA_SCORE_GREATER;
+       value = atoi(yyvsp[0].value);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+;
+    break;}
+case 58:
+#line 585 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gint value = 0;
+
+       criteria = MATCHCRITERIA_SCORE_LOWER;
+       value = atoi(yyvsp[0].value);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+;
+    break;}
+case 59:
+#line 594 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gint value = 0;
+
+       criteria = MATCHCRITERIA_SCORE_EQUAL;
+       value = atoi(yyvsp[0].value);
+       prop = matcherprop_new(criteria, NULL, 0, NULL, value);
+;
+    break;}
+case 60:
+#line 603 "matcher_parser_parse.y"
+{
+       header = g_strdup(yyvsp[0].str);
+;
+    break;}
+case 61:
+#line 606 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_HEADER;
+       expr = yyvsp[-3].str;
+       prop = matcherprop_new(criteria, header, match_type, expr, 0);
+       g_free(header);
+;
+    break;}
+case 62:
+#line 616 "matcher_parser_parse.y"
+{
+       header = g_strdup(yyvsp[0].str);
+;
+    break;}
+case 63:
+#line 619 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_HEADER;
+       expr = yyvsp[-3].str;
+       prop = matcherprop_new(criteria, header, match_type, expr, 0);
+       g_free(header);
+;
+    break;}
+case 64:
+#line 629 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_HEADERS_PART;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 65:
+#line 638 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_HEADERS_PART;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 66:
+#line 647 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_MESSAGE;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 67:
+#line 656 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_MESSAGE;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 68:
+#line 665 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_BODY_PART;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 69:
+#line 674 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_BODY_PART;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, match_type, expr, 0);
+;
+    break;}
+case 70:
+#line 683 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_EXECUTE;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, 0, expr, 0);
+;
+    break;}
+case 71:
+#line 692 "matcher_parser_parse.y"
+{
+       gint criteria = 0;
+       gchar * expr = NULL;
+
+       criteria = MATCHCRITERIA_NOT_EXECUTE;
+       expr = yyvsp[0].str;
+       prop = matcherprop_new(criteria, NULL, 0, expr, 0);
+;
+    break;}
+case 72:
+#line 704 "matcher_parser_parse.y"
+{
+       gchar * cmd = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_EXECUTE;
+       cmd = yyvsp[0].str;
+       action = filteringaction_new(action_type, 0, cmd, 0);
+;
+    break;}
+case 73:
+#line 713 "matcher_parser_parse.y"
+{
+       gchar * destination = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_MOVE;
+       destination = yyvsp[0].str;
+       action = filteringaction_new(action_type, 0, destination, 0);
+;
+    break;}
+case 74:
+#line 722 "matcher_parser_parse.y"
+{
+       gchar * destination = NULL;
+       gint action_type = 0;
+
+       action_type = MATCHACTION_COPY;
+       destination = yyvsp[0].str;
+       action = filteringaction_new(action_type, 0, destination, 0);
+;
+    break;}
+case 75:
+#line 731 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_DELETE;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 76:
+#line 738 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_MARK;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 77:
+#line 745 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_UNMARK;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 78:
+#line 752 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_MARK_AS_READ;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 79:
+#line 759 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+
+       action_type = MATCHACTION_MARK_AS_UNREAD;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 80:
+#line 766 "matcher_parser_parse.y"
+{
+       gchar * destination = NULL;
+       gint action_type = 0;
+       gint account_id = 0;
+
+       action_type = MATCHACTION_FORWARD;
+       account_id = atoi(yyvsp[-1].value);
+       destination = yyvsp[0].str;
+       action = filteringaction_new(action_type, account_id, destination, 0);
+;
+    break;}
+case 81:
+#line 777 "matcher_parser_parse.y"
+{
+       gchar * destination = NULL;
+       gint action_type = 0;
+       gint account_id = 0;
+
+       action_type = MATCHACTION_FORWARD_AS_ATTACHMENT;
+       account_id = atoi(yyvsp[-1].value);
+       destination = yyvsp[0].str;
+       action = filteringaction_new(action_type, account_id, destination, 0);
+;
+    break;}
+case 82:
+#line 788 "matcher_parser_parse.y"
+{
+       gchar * destination = NULL;
+       gint action_type = 0;
+       gint account_id = 0;
+
+       action_type = MATCHACTION_BOUNCE;
+       account_id = atoi(yyvsp[-1].value);
+       destination = yyvsp[0].str;
+       action = filteringaction_new(action_type, account_id, destination, 0);
+;
+    break;}
+case 83:
+#line 799 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+       gint color = 0;
+
+       action_type = MATCHACTION_COLOR;
+       color = atoi(yyvsp[0].value);
+       action = filteringaction_new(action_type, 0, NULL, color);
+;
+    break;}
+case 84:
+#line 808 "matcher_parser_parse.y"
+{
+       gint action_type = 0;
+       action_type = MATCHACTION_DELETE_ON_SERVER;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+;
+    break;}
+case 85:
+#line 817 "matcher_parser_parse.y"
+{
+       score = atoi(yyvsp[0].value);
+;
+    break;}
+}
+   /* the action file gets copied in in place of this dollarsign */
+#line 543 "/usr/lib/bison.simple"
+\f
+  yyvsp -= yylen;
+  yyssp -= yylen;
+#ifdef YYLSP_NEEDED
+  yylsp -= yylen;
+#endif
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "state stack now");
+      while (ssp1 != yyssp)
+       fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+  *++yyvsp = yyval;
+
+#ifdef YYLSP_NEEDED
+  yylsp++;
+  if (yylen == 0)
+    {
+      yylsp->first_line = yylloc.first_line;
+      yylsp->first_column = yylloc.first_column;
+      yylsp->last_line = (yylsp-1)->last_line;
+      yylsp->last_column = (yylsp-1)->last_column;
+      yylsp->text = 0;
+    }
+  else
+    {
+      yylsp->last_line = (yylsp+yylen-1)->last_line;
+      yylsp->last_column = (yylsp+yylen-1)->last_column;
+    }
+#endif
+
+  /* Now "shift" the result of the reduction.
+     Determine what state that goes to,
+     based on the state we popped back to
+     and the rule number reduced by.  */
+
+  yyn = yyr1[yyn];
+
+  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+    yystate = yytable[yystate];
+  else
+    yystate = yydefgoto[yyn - YYNTBASE];
+
+  goto yynewstate;
+
+yyerrlab:   /* here on detecting error */
+
+  if (! yyerrstatus)
+    /* If not already recovering from an error, report this error.  */
+    {
+      ++yynerrs;
+
+#ifdef YYERROR_VERBOSE
+      yyn = yypact[yystate];
+
+      if (yyn > YYFLAG && yyn < YYLAST)
+       {
+         int size = 0;
+         char *msg;
+         int x, count;
+
+         count = 0;
+         /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
+         for (x = (yyn < 0 ? -yyn : 0);
+              x < (sizeof(yytname) / sizeof(char *)); x++)
+           if (yycheck[x + yyn] == x)
+             size += strlen(yytname[x]) + 15, count++;
+         msg = (char *) malloc(size + 15);
+         if (msg != 0)
+           {
+             strcpy(msg, "parse error");
+
+             if (count < 5)
+               {
+                 count = 0;
+                 for (x = (yyn < 0 ? -yyn : 0);
+                      x < (sizeof(yytname) / sizeof(char *)); x++)
+                   if (yycheck[x + yyn] == x)
+                     {
+                       strcat(msg, count == 0 ? ", expecting `" : " or `");
+                       strcat(msg, yytname[x]);
+                       strcat(msg, "'");
+                       count++;
+                     }
+               }
+             yyerror(msg);
+             free(msg);
+           }
+         else
+           yyerror ("parse error; also virtual memory exceeded");
+       }
+      else
+#endif /* YYERROR_VERBOSE */
+       yyerror("parse error");
+    }
+
+  goto yyerrlab1;
+yyerrlab1:   /* here on error raised explicitly by an action */
+
+  if (yyerrstatus == 3)
+    {
+      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
+
+      /* return failure if at end of input */
+      if (yychar == YYEOF)
+       YYABORT;
+
+#if YYDEBUG != 0
+      if (yydebug)
+       fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
+#endif
+
+      yychar = YYEMPTY;
+    }
+
+  /* Else will try to reuse lookahead token
+     after shifting the error token.  */
+
+  yyerrstatus = 3;             /* Each real token shifted decrements this */
+
+  goto yyerrhandle;
+
+yyerrdefault:  /* current state does not do anything special for the error token. */
+
+#if 0
+  /* This is wrong; only states that explicitly want error tokens
+     should shift them.  */
+  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
+  if (yyn) goto yydefault;
+#endif
+
+yyerrpop:   /* pop the current state because it cannot handle the error token */
+
+  if (yyssp == yyss) YYABORT;
+  yyvsp--;
+  yystate = *--yyssp;
+#ifdef YYLSP_NEEDED
+  yylsp--;
+#endif
+
+#if YYDEBUG != 0
+  if (yydebug)
+    {
+      short *ssp1 = yyss - 1;
+      fprintf (stderr, "Error: state stack now");
+      while (ssp1 != yyssp)
+       fprintf (stderr, " %d", *++ssp1);
+      fprintf (stderr, "\n");
+    }
+#endif
+
+yyerrhandle:
+
+  yyn = yypact[yystate];
+  if (yyn == YYFLAG)
+    goto yyerrdefault;
+
+  yyn += YYTERROR;
+  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+    goto yyerrdefault;
+
+  yyn = yytable[yyn];
+  if (yyn < 0)
+    {
+      if (yyn == YYFLAG)
+       goto yyerrpop;
+      yyn = -yyn;
+      goto yyreduce;
+    }
+  else if (yyn == 0)
+    goto yyerrpop;
+
+  if (yyn == YYFINAL)
+    YYACCEPT;
+
+#if YYDEBUG != 0
+  if (yydebug)
+    fprintf(stderr, "Shifting error token, ");
+#endif
+
+  *++yyvsp = yylval;
+#ifdef YYLSP_NEEDED
+  *++yylsp = yylloc;
+#endif
+
+  yystate = yyn;
+  goto yynewstate;
+
+ yyacceptlab:
+  /* YYACCEPT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 0;
+
+ yyabortlab:
+  /* YYABORT comes here.  */
+  if (yyfree_stacks)
+    {
+      free (yyss);
+      free (yyvs);
+#ifdef YYLSP_NEEDED
+      free (yyls);
+#endif
+    }
+  return 1;
+}
+#line 821 "matcher_parser_parse.y"
diff --git a/src/matcher_parser_parse.h b/src/matcher_parser_parse.h
new file mode 100644 (file)
index 0000000..3cad785
--- /dev/null
@@ -0,0 +1,74 @@
+typedef union {
+       char * str;
+       int value;
+} YYSTYPE;
+#define        MATCHER_ALL     257
+#define        MATCHER_UNREAD  258
+#define        MATCHER_NOT_UNREAD      259
+#define        MATCHER_NEW     260
+#define        MATCHER_NOT_NEW 261
+#define        MATCHER_MARKED  262
+#define        MATCHER_NOT_MARKED      263
+#define        MATCHER_DELETED 264
+#define        MATCHER_NOT_DELETED     265
+#define        MATCHER_REPLIED 266
+#define        MATCHER_NOT_REPLIED     267
+#define        MATCHER_FORWARDED       268
+#define        MATCHER_NOT_FORWARDED   269
+#define        MATCHER_SUBJECT 270
+#define        MATCHER_NOT_SUBJECT     271
+#define        MATCHER_FROM    272
+#define        MATCHER_NOT_FROM        273
+#define        MATCHER_TO      274
+#define        MATCHER_NOT_TO  275
+#define        MATCHER_CC      276
+#define        MATCHER_NOT_CC  277
+#define        MATCHER_TO_OR_CC        278
+#define        MATCHER_NOT_TO_AND_NOT_CC       279
+#define        MATCHER_AGE_GREATER     280
+#define        MATCHER_AGE_LOWER       281
+#define        MATCHER_NEWSGROUPS      282
+#define        MATCHER_NOT_NEWSGROUPS  283
+#define        MATCHER_INREPLYTO       284
+#define        MATCHER_NOT_INREPLYTO   285
+#define        MATCHER_REFERENCES      286
+#define        MATCHER_NOT_REFERENCES  287
+#define        MATCHER_SCORE_GREATER   288
+#define        MATCHER_SCORE_LOWER     289
+#define        MATCHER_HEADER  290
+#define        MATCHER_NOT_HEADER      291
+#define        MATCHER_HEADERS_PART    292
+#define        MATCHER_NOT_HEADERS_PART        293
+#define        MATCHER_MESSAGE 294
+#define        MATCHER_NOT_MESSAGE     295
+#define        MATCHER_BODY_PART       296
+#define        MATCHER_NOT_BODY_PART   297
+#define        MATCHER_EXECUTE 298
+#define        MATCHER_NOT_EXECUTE     299
+#define        MATCHER_MATCHCASE       300
+#define        MATCHER_MATCH   301
+#define        MATCHER_REGEXPCASE      302
+#define        MATCHER_REGEXP  303
+#define        MATCHER_SCORE   304
+#define        MATCHER_MOVE    305
+#define        MATCHER_COPY    306
+#define        MATCHER_DELETE  307
+#define        MATCHER_MARK    308
+#define        MATCHER_UNMARK  309
+#define        MATCHER_MARK_AS_READ    310
+#define        MATCHER_MARK_AS_UNREAD  311
+#define        MATCHER_FORWARD 312
+#define        MATCHER_FORWARD_AS_ATTACHMENT   313
+#define        MATCHER_EOL     314
+#define        MATCHER_STRING  315
+#define        MATCHER_OR      316
+#define        MATCHER_AND     317
+#define        MATCHER_COLOR   318
+#define        MATCHER_SCORE_EQUAL     319
+#define        MATCHER_BOUNCE  320
+#define        MATCHER_DELETE_ON_SERVER        321
+#define        MATCHER_SECTION 322
+#define        MATCHER_INTEGER 323
+
+
+extern YYSTYPE yylval;
index 685bbd97bc81fc0a9d624f73dcae1b655e702875..33a4bfd0c4c0de7b546585fe481241370fc27b1a 100644 (file)
@@ -160,7 +160,7 @@ int matcher_parserwrap(void)
 %token MATCHER_MARK_AS_READ  MATCHER_MARK_AS_UNREAD  MATCHER_FORWARD
 %token MATCHER_FORWARD_AS_ATTACHMENT  MATCHER_EOL  MATCHER_STRING  
 %token MATCHER_OR MATCHER_AND  
 %token MATCHER_MARK_AS_READ  MATCHER_MARK_AS_UNREAD  MATCHER_FORWARD
 %token MATCHER_FORWARD_AS_ATTACHMENT  MATCHER_EOL  MATCHER_STRING  
 %token MATCHER_OR MATCHER_AND  
-%token MATCHER_COLOR MATCHER_SCORE_EQUAL MATCHER_BOUNCE
+%token MATCHER_COLOR MATCHER_SCORE_EQUAL MATCHER_BOUNCE MATCHER_DELETE_ON_SERVER
 
 %start file
 
 
 %start file
 
@@ -804,6 +804,12 @@ MATCHER_EXECUTE MATCHER_STRING
        color = atoi($2);
        action = filteringaction_new(action_type, 0, NULL, color);
 }
        color = atoi($2);
        action = filteringaction_new(action_type, 0, NULL, color);
 }
+| MATCHER_DELETE_ON_SERVER
+{
+       gint action_type = 0;
+       action_type = MATCHACTION_DELETE_ON_SERVER;
+       action = filteringaction_new(action_type, 0, NULL, 0);
+}
 ;
 
 scoring_rule:
 ;
 
 scoring_rule:
index 6065fb95f4fbd6aec3f9634632b0fd07e73b2c2d..b672504627a0291a9445282d4b65129e4a93b807 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -36,6 +36,7 @@
 #include "utils.h"
 #include "inc.h"
 #include "recv.h"
 #include "utils.h"
 #include "inc.h"
 #include "recv.h"
+#include "selective_download.h"
 
 #define LOOKUP_NEXT_MSG() \
        for (;;) { \
 
 #define LOOKUP_NEXT_MSG() \
        for (;;) { \
@@ -65,6 +66,7 @@
 static gint pop3_ok(SockInfo *sock, gchar *argbuf);
 static void pop3_gen_send(SockInfo *sock, const gchar *format, ...);
 static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size);
 static gint pop3_ok(SockInfo *sock, gchar *argbuf);
 static void pop3_gen_send(SockInfo *sock, const gchar *format, ...);
 static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size);
+static gboolean pop3_delete_header (Pop3State *state);
 
 gint pop3_greeting_recv(SockInfo *sock, gpointer data)
 {
 
 gint pop3_greeting_recv(SockInfo *sock, gpointer data)
 {
@@ -123,8 +125,13 @@ gint pop3_getauth_pass_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
-       if (pop3_ok(sock, NULL) == PS_SUCCESS)
-               return POP3_GETRANGE_STAT_SEND;
+       if (pop3_ok(sock, NULL) == PS_SUCCESS) {
+               
+               if (pop3_delete_header(state) == TRUE)
+                       return POP3_DELETE_SEND;
+               else
+                       return POP3_GETRANGE_STAT_SEND;
+       }
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
@@ -171,8 +178,14 @@ gint pop3_getauth_apop_recv(SockInfo *sock, gpointer data)
 {
        Pop3State *state = (Pop3State *)data;
 
 {
        Pop3State *state = (Pop3State *)data;
 
-       if (pop3_ok(sock, NULL) == PS_SUCCESS)
+       if (pop3_ok(sock, NULL) == PS_SUCCESS) {
+               
+               if (pop3_delete_header(state) == TRUE)
+                       return POP3_DELETE_SEND;
+               else
                return POP3_GETRANGE_STAT_SEND;
                return POP3_GETRANGE_STAT_SEND;
+       }
+
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
        else {
                log_warning(_("error occurred on authentication\n"));
                state->error_val = PS_AUTHFAIL;
@@ -342,7 +355,66 @@ gint pop3_getsize_list_recv(SockInfo *sock, gpointer data)
        }
 
        LOOKUP_NEXT_MSG();
        }
 
        LOOKUP_NEXT_MSG();
-       return POP3_RETR_SEND;
+       if (state->ac_prefs->session_type == RETR_HEADER) 
+               return POP3_TOP_SEND;
+       else
+               return POP3_RETR_SEND;
+ }
+gint pop3_top_send(SockInfo *sock, gpointer data)
+{
+       Pop3State *state = (Pop3State *)data;
+
+       inc_progress_update(state, POP3_TOP_SEND); 
+
+       pop3_gen_send(sock, "TOP %i 0", state->cur_msg );
+
+       return POP3_TOP_RECV;
+}
+
+gint pop3_top_recv(SockInfo *sock, gpointer data)
+{
+       Pop3State *state = (Pop3State *)data;
+       FILE  *fp;
+       gchar buf[POPBUFSIZE];
+       gchar *header;
+       gchar *filename, *path;
+       
+       inc_progress_update(state, POP3_TOP_RECV); 
+
+       if (pop3_ok(sock, NULL) != PS_SUCCESS) 
+               return POP3_LOGOUT_SEND;
+
+       path = g_strconcat(get_header_cache_dir(), G_DIR_SEPARATOR_S, NULL);
+
+       if ( !is_dir_exist(path) )
+               make_dir_hier(path);
+       
+       filename = g_strdup_printf("%s%i", path, state->cur_msg);
+                                  
+       if (recv_write_to_file(sock, filename) < 0) {
+               state->inc_state = INC_NOSPACE;
+               return -1;
+       }
+       /* we add a Complete-Size Header Item ...
+          note: overwrites first line  --> this is dirty */
+       if ( (fp = fopen(filename, "r+")) != NULL ) {
+               gchar *buf = g_strdup_printf("%s%i", SIZE_HEADER, 
+                                            state->sizes[state->cur_msg]);
+       
+               if (change_file_mode_rw(fp, filename) == 0) 
+                       fprintf(fp, "%s\n", buf);
+               fclose(fp);
+       }
+       
+       g_free(path);
+       g_free(filename);
+
+       if (state->cur_msg < state->count) {
+               state->cur_msg++;
+               return POP3_TOP_SEND;
+       } else
+               return POP3_LOGOUT_SEND;
 }
 
 gint pop3_retr_send(SockInfo *sock, gpointer data)
 }
 
 gint pop3_retr_send(SockInfo *sock, gpointer data)
@@ -416,6 +488,10 @@ gint pop3_delete_recv(SockInfo *sock, gpointer data)
        gint ok;
 
        if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
        gint ok;
 
        if ((ok = pop3_ok(sock, NULL)) == PS_SUCCESS) {
+
+               if (pop3_delete_header(state) == TRUE) 
+                       return POP3_DELETE_SEND;
+
                if (state->cur_msg < state->count) {
                        state->cur_msg++;
                        LOOKUP_NEXT_MSG();
                if (state->cur_msg < state->count) {
                        state->cur_msg++;
                        LOOKUP_NEXT_MSG();
@@ -518,3 +594,18 @@ static gint pop3_gen_recv(SockInfo *sock, gchar *buf, gint size)
                return PS_SUCCESS;
        }
 }
                return PS_SUCCESS;
        }
 }
+
+gboolean pop3_delete_header (Pop3State *state)
+{
+       
+       if ( (state->ac_prefs->session_type == DELE_HEADER) &&
+            (g_slist_length(state->ac_prefs->to_delete) > 0) ) {
+
+               state->cur_msg = (gint) state->ac_prefs->to_delete->data;
+               debug_print(_("next to delete %i\n"), state->cur_msg);
+               state->ac_prefs->to_delete = g_slist_remove 
+                       (state->ac_prefs->to_delete, state->ac_prefs->to_delete->data);
+               return TRUE;
+       }
+       return FALSE;
+}
index 41e5b3dfd4780e05658177ce10c4f51305135940..0d8e93069803d7b4dd500f66f85963910c37cbe8 100644 (file)
--- a/src/pop.h
+++ b/src/pop.h
@@ -40,6 +40,8 @@ typedef enum {
        POP3_GETRANGE_UIDL_RECV,
        POP3_GETSIZE_LIST_SEND,
        POP3_GETSIZE_LIST_RECV,
        POP3_GETRANGE_UIDL_RECV,
        POP3_GETSIZE_LIST_SEND,
        POP3_GETSIZE_LIST_RECV,
+       POP3_TOP_SEND,                   
+       POP3_TOP_RECV,                    
        POP3_RETR_SEND,
        POP3_RETR_RECV,
        POP3_DELETE_SEND,
        POP3_RETR_SEND,
        POP3_RETR_RECV,
        POP3_DELETE_SEND,
@@ -50,6 +52,7 @@ typedef enum {
        N_POP3_PHASE
 } Pop3Phase;
 
        N_POP3_PHASE
 } Pop3Phase;
 
+#define MAX_HEADER_LEN  5000
 #define POPBUFSIZE     512
 #define IDLEN          128
 
 #define POPBUFSIZE     512
 #define IDLEN          128
 
@@ -90,6 +93,8 @@ gint pop3_getrange_uidl_send  (SockInfo *sock, gpointer data);
 gint pop3_getrange_uidl_recv   (SockInfo *sock, gpointer data);
 gint pop3_getsize_list_send    (SockInfo *sock, gpointer data);
 gint pop3_getsize_list_recv    (SockInfo *sock, gpointer data);
 gint pop3_getrange_uidl_recv   (SockInfo *sock, gpointer data);
 gint pop3_getsize_list_send    (SockInfo *sock, gpointer data);
 gint pop3_getsize_list_recv    (SockInfo *sock, gpointer data);
+gint pop3_top_send              (SockInfo *sock, gpointer data);
+gint pop3_top_recv              (SockInfo *sock, gpointer data);
 gint pop3_retr_send            (SockInfo *sock, gpointer data);
 gint pop3_retr_recv            (SockInfo *sock, gpointer data);
 gint pop3_delete_send          (SockInfo *sock, gpointer data);
 gint pop3_retr_send            (SockInfo *sock, gpointer data);
 gint pop3_retr_recv            (SockInfo *sock, gpointer data);
 gint pop3_delete_send          (SockInfo *sock, gpointer data);
index ad5831ff4e5b779989af59780a2b2ec0435e142c..e670a454e0910cd0b0f2c5287eb9e49713d4dcb2 100644 (file)
@@ -43,6 +43,15 @@ typedef enum {
        A_LOCAL
 } RecvProtocol;
 
        A_LOCAL
 } RecvProtocol;
 
+typedef enum {
+       /* login and retrieve messages, as before */
+       RETR_NORMAL,
+       /* send TOP to server and retrieve Header */
+       RETR_HEADER, 
+       /* delete selected Headers on Server */
+       DELE_HEADER 
+} Pop3SessionType;
+
 #if USE_GPGME
 typedef enum {
        SIGN_KEY_DEFAULT,
 #if USE_GPGME
 typedef enum {
        SIGN_KEY_DEFAULT,
@@ -101,6 +110,10 @@ struct _PrefsAccount
        gboolean filter_on_recv;
        gchar *inbox;
 
        gboolean filter_on_recv;
        gchar *inbox;
 
+       /* selective Download */
+       gint   session_type;
+       GSList *to_delete;
+
        gchar *imap_dir;
 
        /* Send */
        gchar *imap_dir;
 
        /* Send */
index c3fdde68193c011207321f14a6aab609547c326e..40387e7fa12dae389a2c9367fe50e21b3286820d 100644 (file)
@@ -129,6 +129,7 @@ enum {
        ACTION_BOUNCE = 9,
        ACTION_EXECUTE = 10,
        ACTION_COLOR = 11,
        ACTION_BOUNCE = 9,
        ACTION_EXECUTE = 10,
        ACTION_COLOR = 11,
+       ACTION_DELETE_ON_SERVER = 12,
 };
 
 static gint get_sel_from_list(GtkList * list)
 };
 
 static gint get_sel_from_list(GtkList * list)
@@ -209,6 +210,8 @@ static gint prefs_filtering_get_matching_from_action(gint action_id)
                return MATCHACTION_EXECUTE;
        case ACTION_COLOR:
                return MATCHACTION_COLOR;
                return MATCHACTION_EXECUTE;
        case ACTION_COLOR:
                return MATCHACTION_COLOR;
+       case ACTION_DELETE_ON_SERVER:
+               return MATCHACTION_DELETE_ON_SERVER;
        default:
                return -1;
        }
        default:
                return -1;
        }
@@ -226,7 +229,8 @@ static gchar * action_text [] = {
        N_("Forward as attachment"), 
        N_("Bounce"), 
        N_("Execute"),
        N_("Forward as attachment"), 
        N_("Bounce"), 
        N_("Execute"),
-       N_("Color")
+       N_("Color"),
+       N_("Delete on Server")
 };
 
 void prefs_filtering_open(FolderItem * item)
 };
 
 void prefs_filtering_open(FolderItem * item)
@@ -783,6 +787,9 @@ static FilteringProp * prefs_filtering_dialog_to_filtering(void)
                        gtk_option_menu_get_menu(GTK_OPTION_MENU(filtering.color_optmenu)));
                destination = NULL;     
                break;
                        gtk_option_menu_get_menu(GTK_OPTION_MENU(filtering.color_optmenu)));
                destination = NULL;     
                break;
+       case ACTION_DELETE_ON_SERVER:
+               destination = NULL;
+               break;
        default:
                destination = NULL;
                break;
        default:
                destination = NULL;
                break;
@@ -971,6 +978,10 @@ static void prefs_filtering_select_set(FilteringProp * prop)
                                     ACTION_COLOR);
                gtk_option_menu_set_history(GTK_OPTION_MENU(filtering.color_optmenu), action->labelcolor);     
                break;
                                     ACTION_COLOR);
                gtk_option_menu_set_history(GTK_OPTION_MENU(filtering.color_optmenu), action->labelcolor);     
                break;
+       case MATCHACTION_DELETE_ON_SERVER:
+               gtk_list_select_item(GTK_LIST(filtering.action_list),
+                                    ACTION_DELETE_ON_SERVER);
+               break;
        }
 
        g_free(matcher_str);
        }
 
        g_free(matcher_str);
@@ -1178,6 +1189,17 @@ static void prefs_filtering_action_select(GtkList *list,
                gtk_widget_show(filtering.color_optmenu);
                gtk_widget_show(filtering.color_label);
                break;
                gtk_widget_show(filtering.color_optmenu);
                gtk_widget_show(filtering.color_label);
                break;
+       case ACTION_DELETE_ON_SERVER:
+               gtk_widget_set_sensitive(filtering.account_combo, FALSE);
+               gtk_widget_hide(filtering.dest_entry);
+               gtk_widget_hide(filtering.dest_btn);
+               gtk_widget_hide(filtering.dest_label);
+               gtk_widget_hide(filtering.exec_label);
+               gtk_widget_show(filtering.exec_btn);
+               gtk_widget_hide(filtering.exec_btn);
+               gtk_widget_hide(filtering.color_optmenu);
+               gtk_widget_hide(filtering.color_label);
+               break;
        }
 }
 
        }
 }
 
diff --git a/src/selective_download.c b/src/selective_download.c
new file mode 100644 (file)
index 0000000..cf3584c
--- /dev/null
@@ -0,0 +1,565 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "defs.h"
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkoptionmenu.h>
+#include <gdk/gdkkeysyms.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include <regex.h>
+
+#include "intl.h"
+#include "main.h"
+#include "prefs.h"
+#include "prefs_matcher.h"
+#include "prefs_filtering.h"
+#include "prefs_common.h"
+#include "prefs_account.h"
+#include "account.h"
+#include "mainwindow.h"
+#include "foldersel.h"
+#include "manage_window.h"
+#include "stock_pixmap.h"
+#include "inc.h"
+#include "utils.h"
+#include "gtkutils.h"
+#include "alertpanel.h"
+#include "folder.h"
+#include "inc.h"
+#include "filtering.h"
+#include "matcher_parser.h"
+#include "selective_download.h"
+#include "procheader.h"
+
+struct _SDView {
+       MainWindow *mainwin;
+
+       GtkWidget *window;
+       GtkWidget *btn_getmail;
+       GtkWidget *btn_remove;
+       GtkWidget *btn_done;
+       GtkWidget *clist;
+       GtkWidget *label_account_name;
+       GtkWidget *label_mails;
+}selective;
+
+GSList *header_item_list = NULL;
+
+static GdkPixmap *checkboxonxpm;
+static GdkPixmap *checkboxonxpmmask;
+static GdkPixmap *checkboxoffxpm;
+static GdkPixmap *checkboxoffxpmmask;
+
+static void sd_window_create(MainWindow *mainwin);
+static void sd_clist_set();
+static void sd_remove_header_files();
+
+
+void selective_download(MainWindow *mainwin)
+{
+       PrefsAccount *account = cur_account;
+
+       summary_write_cache(mainwin->summaryview);
+       main_window_lock(mainwin);
+
+       sd_remove_header_files();
+
+       header_item_list = NULL;
+       
+       sd_window_create(mainwin);
+
+       stock_pixmap_gdk(selective.clist, STOCK_PIXMAP_CHECKBOX_OFF,
+                        &checkboxoffxpm, &checkboxoffxpmmask);
+       stock_pixmap_gdk(selective.clist, STOCK_PIXMAP_CHECKBOX_ON,
+                        &checkboxonxpm, &checkboxonxpmmask);
+       
+       gtk_label_set_text(GTK_LABEL(selective.label_account_name), account->account_name);
+}
+
+
+/* sd_remove_header_files()
+ * 
+ * - removes any stale header files in HEADER_CACHE_DIR 
+ *
+ */
+static void sd_remove_header_files()
+{
+       gchar *path = g_strconcat(get_header_cache_dir(), G_DIR_SEPARATOR_S, NULL);
+       
+       remove_all_files(path);
+       g_free(path);
+}
+
+
+/* sd_toggle_btn_remove()
+ *
+ * - checks whether at least on email is selected for deletion
+ *   if so, untoggle remove button
+ */
+static gboolean sd_toggle_btn_remove()
+{
+       GSList *cur;
+       gint num = 0;
+       gpointer row;
+
+
+       for (cur = header_item_list; cur != NULL; cur = cur->next) {
+               HeaderItems *item = (HeaderItems*)cur->data;
+               
+               if (item->state == CHECKED) {
+                       gtk_widget_set_sensitive (selective.btn_remove, TRUE);
+                       return CHECKED;
+               }
+               num++;
+       }
+
+       gtk_widget_set_sensitive (selective.btn_remove, FALSE);
+       return UNCHECKED;
+}
+
+
+/* sd_header_filter(MsgInfo *msginfo)
+ *
+ * - parse header line and look for any applying filtering rules
+ * - if message matches other MATCHACTION --> return
+ *
+ */
+gboolean sd_header_filter(MsgInfo *msginfo)
+{
+       GSList *rules;
+
+       /* parse header line for line */
+       for (rules = global_processing; rules != NULL; rules = rules->next) { 
+
+               FilteringProp *prop = (FilteringProp*) rules->data; 
+               gchar line[POPBUFSIZE];
+
+               if ( matcherlist_match(prop->matchers, msginfo) ) {
+                       if (prop->action->type == MATCHACTION_DELETE_ON_SERVER) {
+                               return CHECKED;
+                       }
+                       else 
+                               return UNCHECKED;
+               }
+               
+       }
+       return UNCHECKED;
+}
+
+
+/* sd_get_msginfo_from_file(const gchar *filename)
+ *
+ * - retrieve msginfo from saved header files
+ */
+MsgInfo *sd_get_msginfo_from_file(const gchar *filename)
+{
+       FILE *fp;
+       gchar buf[BUFFSIZE];
+       MsgInfo *msginfo  = g_new0(MsgInfo, 1);
+       MsgFlags msgflags = { 0, 0 };
+
+       msginfo  = (MsgInfo*) procheader_parse(filename, msgflags, TRUE, FALSE);
+       if ( (fp = fopen(filename, "r")) != NULL ) {
+               static HeaderEntry hentry[] = { { SIZE_HEADER, NULL, FALSE},
+                                               { NULL, NULL, FALSE} };
+               
+               procheader_get_one_field (buf, sizeof(buf), fp, hentry);
+               fclose(fp);
+       }
+
+       if (buf)
+               msginfo->size = (off_t)atoi(buf + SIZE_HEADER_LEN);
+       else
+               msginfo->size = 0;
+       
+       return msginfo;
+}
+
+
+/* sd_clist_set()
+ *
+ * - fill clist and set toggle button accordingly
+ */
+void sd_clist_set()
+{
+       gint index = 1;
+
+       gchar *path     = g_strconcat(get_header_cache_dir(), G_DIR_SEPARATOR_S, NULL);
+       gchar *filename = g_strdup_printf("%s%i", path, index);
+       
+       while ( is_file_exist(filename) ) {
+
+               MsgInfo *msginfo  = sd_get_msginfo_from_file(filename);
+               HeaderItems *line = g_new0 (HeaderItems, 1);
+               gchar *row[4];
+               gint msgid;     
+               
+               line->index = index;
+
+               row[0] = "";
+               row[1] = line->from    = msginfo->from;
+               row[2] = line->subject = msginfo->subject;
+               row[3] = line->size    = to_human_readable(msginfo->size);
+               
+               gtk_clist_append (GTK_CLIST(selective.clist), row);
+
+               msginfo->folder = folder_get_default_processing();
+
+               /* move msg file to drop folder */
+               if ((msginfo->msgnum = folder_item_add_msg(msginfo->folder, 
+                                                          filename, TRUE)) < 0) {
+                       unlink(filename);
+                       return;
+               }
+               
+               if (sd_header_filter(msginfo)) {
+                       line->state = CHECKED;
+                       gtk_clist_set_pixmap (GTK_CLIST (selective.clist), index - 1, 0,
+                                             checkboxonxpm, checkboxonxpmmask);
+               }
+               else {
+                       line->state = UNCHECKED;
+                       gtk_clist_set_pixmap (GTK_CLIST (selective.clist), index - 1, 0,
+                                             checkboxoffxpm, checkboxoffxpmmask);
+               }
+               
+               folder_item_remove_msg(msginfo->folder, msginfo->msgnum);
+
+               header_item_list = g_slist_append(header_item_list, line);
+               
+               index++;
+               filename = g_strdup_printf("%s%i", path, index);
+       }
+       
+       sd_toggle_btn_remove();
+
+       g_free(path);
+       g_free(filename);
+}
+
+
+/* --- Callbacks -- */
+static void sd_btn_remove_cb()
+{
+       GSList *cur;
+       PrefsAccount *account = cur_account;
+       gboolean enable_dele  = FALSE;
+
+       account->to_delete = NULL;
+
+       /* loop through list collecting mails marked for delete */
+       for (cur = header_item_list; cur != NULL; cur = cur->next) {
+               
+               HeaderItems *items = (HeaderItems*)cur->data;
+               
+               if (items->state == CHECKED) {
+                       gchar *row[4];
+
+                       /* replace deleted Mail */
+                       row[0] = "D";
+                       row[1] = items->from;
+                       row[2] = items->subject;
+                       row[3] = items->size;
+
+                       account->to_delete = g_slist_append(account->to_delete, 
+                                                           GINT_TO_POINTER(items->index));
+
+                       gtk_clist_remove(GTK_CLIST(selective.clist), items->index-1);
+                       gtk_clist_insert(GTK_CLIST(selective.clist), items->index-1, row);
+                       gtk_clist_set_selectable(GTK_CLIST(selective.clist), 
+                                                items->index - 1, FALSE);
+                       enable_dele = TRUE;
+                       debug_print(_("marked to delete %i\n"), 
+                                   items->index);
+                       
+                       items->state = UNCHECKED;
+               }
+       }
+
+
+       if (enable_dele == TRUE) {
+               inc_selective_download(selective.mainwin, DELE_HEADER);
+       }
+
+       sd_toggle_btn_remove(); 
+
+       g_slist_free(account->to_delete);
+       account->to_delete = NULL;      
+}
+
+static void sd_btn_receive_cb()
+{
+
+       manage_window_focus_in(selective.window, NULL, NULL);
+
+       inc_selective_download(selective.mainwin, RETR_HEADER);
+
+       gtk_clist_clear(GTK_CLIST(selective.clist));
+       sd_clist_set();
+}
+
+static void sd_btn_done_cb()
+{
+       sd_remove_header_files();
+       
+       if (header_item_list)
+               slist_free_strings (header_item_list);
+
+       gtk_widget_hide(selective.window);
+       main_window_unlock(selective.mainwin);
+}
+
+static void sd_select_row_cb(GtkCList *clist, gint row, gint column,
+                            GdkEvent *event, gpointer user_data)
+{
+
+       if ((row >= 0) && (column >= 0)) {
+               HeaderItems *item = (HeaderItems*) g_slist_nth_data (header_item_list, row);
+
+               if (!item) return;
+               if (!gtk_clist_get_selectable(GTK_CLIST(selective.clist), row)) return;
+
+               if (item->state == UNCHECKED) {
+                       item->state = CHECKED;
+                       gtk_clist_set_pixmap (GTK_CLIST (selective.clist), row, 0,
+                                             checkboxonxpm, checkboxonxpmmask);
+               } else {
+                       item->state = UNCHECKED;
+                       gtk_clist_set_pixmap (GTK_CLIST (selective.clist), row, 0,
+                                             checkboxoffxpm, checkboxoffxpmmask);
+               }
+               sd_toggle_btn_remove();
+       }
+}
+
+static void sd_window_create(MainWindow *mainwin)
+{
+       GtkWidget *window;
+       GtkWidget *table;
+       GtkWidget *label_mails;
+       GtkWidget *hbox_bottom;
+       GtkWidget *label_fixed;
+       GtkWidget *label_account_name;
+       GtkWidget *scrolledwindow;
+       GtkWidget *clist;
+       GtkWidget *label_state;
+       GtkWidget *label_from;
+       GtkWidget *label_subject;
+       GtkWidget *label_size;
+       GtkWidget *hbox_toolbar;
+       GtkWidget *toolbar;
+       GtkWidget *btn_receive;
+       GtkWidget *tmp_toolbar_icon;
+       GtkWidget *btn_remove;
+       GtkWidget *btn_done;
+
+       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+       gtk_object_set_data (GTK_OBJECT (window), "window", window);
+       gtk_window_set_title (GTK_WINDOW (window), _("Selective Download"));
+       gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
+       gtk_window_set_default_size (GTK_WINDOW (window), 450, 250);
+       
+       table = gtk_table_new (2, 2, FALSE);
+       gtk_widget_ref (table);
+       gtk_object_set_data_full (GTK_OBJECT (window), "table", table,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (table);
+       gtk_container_add (GTK_CONTAINER (window), table);
+       
+       label_mails = gtk_label_new (_("0 Mail(s)"));
+       gtk_widget_ref (label_mails);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_mails", label_mails,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_mails);
+       gtk_table_attach (GTK_TABLE (table), label_mails, 1, 2, 1, 2,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (0), 0, 0);
+       gtk_misc_set_alignment (GTK_MISC (label_mails), 0, 0.5);
+       
+       hbox_bottom = gtk_hbox_new (FALSE, 0);
+       gtk_widget_ref (hbox_bottom);
+       gtk_object_set_data_full (GTK_OBJECT (window), "hbox_bottom", hbox_bottom,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (hbox_bottom);
+       gtk_table_attach (GTK_TABLE (table), hbox_bottom, 0, 1, 1, 2,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (GTK_FILL), 0, 0);
+       
+       label_fixed = gtk_label_new (_("current Account:"));
+       gtk_widget_ref (label_fixed);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_fixed", label_fixed,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_fixed);
+       gtk_box_pack_start (GTK_BOX (hbox_bottom), label_fixed, FALSE, FALSE, 0);
+       
+       label_account_name = gtk_label_new (_("none"));
+       gtk_widget_ref (label_account_name);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_account_name", label_account_name,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_account_name);
+       gtk_box_pack_start (GTK_BOX (hbox_bottom), label_account_name, TRUE, FALSE, 0);
+       
+       scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+       gtk_widget_ref (scrolledwindow);
+       gtk_object_set_data_full (GTK_OBJECT (window), "scrolledwindow", scrolledwindow,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (scrolledwindow);
+       gtk_table_attach (GTK_TABLE (table), scrolledwindow, 0, 1, 0, 1,
+                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                         (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
+       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+       
+       clist = gtk_clist_new (4);
+       gtk_widget_ref (clist);
+       gtk_object_set_data_full (GTK_OBJECT (window), "clist", clist,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (clist);
+       gtk_container_add (GTK_CONTAINER (scrolledwindow), clist);
+       gtk_container_set_border_width (GTK_CONTAINER (clist), 5);
+       gtk_clist_set_column_width (GTK_CLIST (clist), 0, 21);
+       gtk_clist_set_column_width (GTK_CLIST (clist), 1, 143);
+       gtk_clist_set_column_width (GTK_CLIST (clist), 2, 158);
+       gtk_clist_set_column_width (GTK_CLIST (clist), 3, 15);
+       gtk_clist_set_selection_mode (GTK_CLIST (clist), GTK_SELECTION_BROWSE);
+       gtk_clist_column_titles_show (GTK_CLIST (clist));
+       
+       label_state = gtk_label_new (_("#"));
+       gtk_widget_ref (label_state);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_state", label_state,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_state);
+       gtk_clist_set_column_widget (GTK_CLIST (clist), 0, label_state);
+       
+       label_from = gtk_label_new (_("From"));
+       gtk_widget_ref (label_from);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_from", label_from,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_from);
+       gtk_clist_set_column_widget (GTK_CLIST (clist), 1, label_from);
+       
+       label_subject = gtk_label_new (_("Subject"));
+       gtk_widget_ref (label_subject);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_subject", label_subject,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_subject);
+       gtk_clist_set_column_widget (GTK_CLIST (clist), 2, label_subject);
+       
+       label_size = gtk_label_new (_("Size"));
+       gtk_widget_ref (label_size);
+       gtk_object_set_data_full (GTK_OBJECT (window), "label_size", label_size,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (label_size);
+       gtk_clist_set_column_widget (GTK_CLIST (clist), 3, label_size);
+       
+       hbox_toolbar = gtk_hbox_new (FALSE, 0);
+       gtk_widget_ref (hbox_toolbar);
+       gtk_object_set_data_full (GTK_OBJECT (window), "hbox_toolbar", hbox_toolbar,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (hbox_toolbar);
+       gtk_table_attach (GTK_TABLE (table), hbox_toolbar, 1, 2, 0, 1,
+                         (GtkAttachOptions) (GTK_FILL),
+                         (GtkAttachOptions) (GTK_FILL), 0, 0);
+       
+       toolbar = gtk_toolbar_new (GTK_ORIENTATION_VERTICAL, GTK_TOOLBAR_BOTH);
+       gtk_widget_ref (toolbar);
+       gtk_object_set_data_full (GTK_OBJECT (window), "toolbar", toolbar,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (toolbar);
+       gtk_box_pack_start (GTK_BOX (hbox_toolbar), toolbar, FALSE, FALSE, 0);
+       gtk_toolbar_set_space_size (GTK_TOOLBAR (toolbar), 20);
+       gtk_toolbar_set_space_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_SPACE_LINE);
+       
+       tmp_toolbar_icon = stock_pixmap_widget(hbox_toolbar, STOCK_PIXMAP_MAIL);
+       btn_receive = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
+                                                 GTK_TOOLBAR_CHILD_BUTTON,
+                                                 NULL,
+                                                 _("Receive"),
+                                                 _("preview E-Mail"), NULL,
+                                                 tmp_toolbar_icon, NULL, NULL);
+       gtk_widget_ref (btn_receive);
+       gtk_object_set_data_full (GTK_OBJECT (window), "btn_receive", btn_receive,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (btn_receive);
+       
+       gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+       
+       tmp_toolbar_icon = stock_pixmap_widget(hbox_toolbar, STOCK_PIXMAP_CONTINUE);
+       btn_remove = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
+                                                GTK_TOOLBAR_CHILD_BUTTON,
+                                                NULL,
+                                                _("Remove"),
+                                                _("remove selected E-Mails"), NULL,
+                                                tmp_toolbar_icon, NULL, NULL);
+       gtk_widget_ref (btn_remove);
+       gtk_object_set_data_full (GTK_OBJECT (window), "btn_remove", btn_remove,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_set_sensitive (btn_remove, FALSE);
+       
+       gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
+       
+       tmp_toolbar_icon = stock_pixmap_widget (hbox_toolbar, STOCK_PIXMAP_CLOSE);
+       btn_done = gtk_toolbar_append_element (GTK_TOOLBAR (toolbar),
+                                              GTK_TOOLBAR_CHILD_BUTTON,
+                                              NULL,
+                                              _("Done"),
+                                              _("Exit Dialog"), NULL,
+                                              tmp_toolbar_icon, NULL, NULL);
+       gtk_widget_ref (btn_done);
+       gtk_object_set_data_full (GTK_OBJECT (window), "btn_done", btn_done,
+                                 (GtkDestroyNotify) gtk_widget_unref);
+       gtk_widget_show (btn_done);
+       
+       gtk_signal_connect (GTK_OBJECT (window), "destroy",
+                           GTK_SIGNAL_FUNC (sd_btn_done_cb),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT (btn_receive), "clicked",
+                           GTK_SIGNAL_FUNC (sd_btn_receive_cb),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT (btn_remove), "clicked",
+                           GTK_SIGNAL_FUNC (sd_btn_remove_cb),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT (btn_done), "clicked",
+                           GTK_SIGNAL_FUNC (sd_btn_done_cb),
+                           NULL);
+       gtk_signal_connect (GTK_OBJECT (clist), "select_row",
+                           GTK_SIGNAL_FUNC (sd_select_row_cb),
+                           NULL);
+
+
+
+       selective.mainwin            = mainwin;
+       selective.window             = window;
+       selective.btn_remove         = btn_remove;
+       selective.btn_done           = btn_done;
+       selective.clist              = clist;
+       selective.label_account_name = label_account_name;
+       selective.label_mails        = label_mails;
+
+       gtk_widget_show_all(window);
+}
+
diff --git a/src/selective_download.h b/src/selective_download.h
new file mode 100644 (file)
index 0000000..3e892ac
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2002 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __SELECTIVE_DOWNLOAD_H__
+#define __SELECTIVE_DOWNLOAD_H__
+
+#include "mainwindow.h"
+
+#define SIZE_HEADER "Complete-Size: "
+#define SIZE_HEADER_LEN strlen(SIZE_HEADER)
+
+#define CHECKED    TRUE
+#define UNCHECKED  FALSE
+
+typedef struct _HeaderItems HeaderItems;
+
+struct _HeaderItems {
+       gint     index;
+       gboolean state;
+       gchar    *from;
+       gchar    *subject;
+       gchar    *size;
+};
+
+void selective_download(MainWindow *mainwin);
+
+#endif /* __SELECTIVE_DOWNLOAD_H__ */
index 75419c65b4723ce7e8d677730cb9a7d0ce68653c..6f09a59228df650015012b67254442812db322ff 100644 (file)
@@ -1268,6 +1268,17 @@ gchar *get_template_dir(void)
        return template_dir;
 }
 
        return template_dir;
 }
 
+gchar *get_header_cache_dir(void)
+{
+       static gchar *header_dir = NULL;
+
+       if (!header_dir)
+               header_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
+                                        HEADER_CACHE_DIR, NULL);
+
+       return header_dir;
+}
+
 gchar *get_tmp_file(void)
 {
        static gchar *tmp_file = NULL;
 gchar *get_tmp_file(void)
 {
        static gchar *tmp_file = NULL;
index a1150dedd29bff742940d0d5def369d6a04de1b5..bc108a33b918a7ae0d08c1ff2655f3eb51e11d45 100644 (file)
@@ -288,6 +288,7 @@ gchar *get_imap_cache_dir   (void);
 gchar *get_mbox_cache_dir      (void);
 gchar *get_mime_tmp_dir                (void);
 gchar *get_template_dir                (void);
 gchar *get_mbox_cache_dir      (void);
 gchar *get_mime_tmp_dir                (void);
 gchar *get_template_dir                (void);
+gchar *get_header_cache_dir     (void);
 gchar *get_tmp_file            (void);
 gchar *get_domain_name         (void);
 
 gchar *get_tmp_file            (void);
 gchar *get_domain_name         (void);