make unescaping / escaping in filtering work again
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 10 Dec 2001 22:38:19 +0000 (22:38 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Mon, 10 Dec 2001 22:38:19 +0000 (22:38 +0000)
ChangeLog.claws
configure.in
src/matcher.c
src/matcher_parser_lex.l

index 3d102c123bdf3e491b84d09fa04427ed6fec214b..d718a9b2a475493cc178c40fbaebe97acb039a21 100644 (file)
@@ -1,3 +1,10 @@
+2001-12-10 [alfons]    0.6.5claws73
+
+       * src/matcher.c
+               add more control characters
+       * src/matcher_parser_lex.l
+               make escaping / unescaping work again
+
 2001-12-10 [alfons]    0.6.5claws72
 
        * src/imap.c
index ba29055f53a3aac094b1d9381e7a1d29f7ea7e0d..d6d416a619de27350371e1b9bcf5b68503c19506 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws72
+EXTRA_VERSION=claws73
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 46605fe3085addc0afb900c816844bc9633d563c..b8a353089ffe67725283d8226f8d4d61226e9ba9 100644 (file)
@@ -127,12 +127,20 @@ gchar *matcher_unescape_str(gchar *str)
                else {
                        src++;
                        if (*src == '\\')
-                               *dst++ = '\\';
-                       else if (*src == 'n')
+                               *dst++ = '\\';                          /* insert backslash */
+                       else if (*src == 'n')                           /* insert control characters */
                                *dst++ = '\n';
                        else if (*src == 'r') 
                                *dst++ = '\r';
-                       else if (*src == '\'' || *src == '\"')
+                       else if (*src == 't') 
+                               *dst++ = '\t';
+                       else if (*src == 'r') 
+                               *dst++ = '\r';
+                       else if (*src == 'b')
+                               *dst++ = '\b';
+                       else if (*src == 'f')
+                               *dst++ = '\f';
+                       else if (*src == '\'' || *src == '\"')          /* insert \' or \" */
                                *dst++ = *src;
                        else {
                                src--;
@@ -1064,6 +1072,7 @@ static void prefs_filtering_write(FILE * fp, GSList * prefs_scoring)
 
                prop = (FilteringProp *) cur->data;
                filtering_str = filteringprop_to_string(prop);
+               debug_print("FILTERING WRITING %s\n", filtering_str);
                
                if (fputs(filtering_str, fp) == EOF ||
                    fputc('\n', fp) == EOF) {
index 84bfd4ec378ec214d34fd7ee514c4d7cb0f4a7fe..e638e51f042c39e32187e11dbc1759dd275705d1 100644 (file)
@@ -92,12 +92,48 @@ static void add_char(char ch)
                BEGIN(string);
                string_buf_ptr = string_buf;
                }
-<string>\\n    add_char('\n');
-<string>\\t    add_char('\t');
-<string>\\r    add_char('\r');
-<string>\\b    add_char('\b');
-<string>\\f    add_char('\f');
-<string>\\.    add_char(yytext[1]);
+               /* the following tokens \n \t \r \b \f \\ could be
+                * removed from the list, but we let them here for
+                * the sake of clarity; they are unescaped by 
+                * matcher.c:unescape_str()) */
+<string>\\n    {
+               /* paste as-is */
+               add_char('\\');
+               add_char('n');
+               }
+<string>\\t    {
+               /* paste as-is */
+               add_char('\\');
+               add_char('t');
+               }
+<string>\\r    {
+               /* paste as-is */
+               add_char('\\');
+               add_char('r');
+               }
+<string>\\b    {
+               /* paste as-is */
+               add_char('\\');
+               add_char('b');
+               }
+<string>\\f    {
+               /* paste as-is */
+               add_char('\\');
+               add_char('f');
+               }
+<string>\\\'   {
+               /* paste as-is */
+               add_char('\\');
+               add_char('\'');
+               }
+<string>\\\"   {
+               /* paste as-is */
+               add_char('\\');
+               add_char('\"');
+               }
+               /* we only miss the thing with nested escaping like
+                * \\\\" which should mean something like 'forget it, we want a "'
+                * right here in the token stream.... */
 <string>\"     {
                BEGIN(0);
                *string_buf_ptr = '\0';
@@ -105,14 +141,14 @@ static void add_char(char ch)
                return MATCHER_STRING;
                }
 <string>.      {
-add_char(yytext[0]);
-}
+               add_char(yytext[0]);
+               }
 \[[^\[\]]*\]   {
-                       BEGIN(0);
-                       yylval.str = yytext + 1;
-                       yytext[strlen(yytext) - 1] = '\0';
-                       return MATCHER_SECTION;
-                       }
+               BEGIN(0);
+               yylval.str = yytext + 1;
+               yytext[strlen(yytext) - 1] = '\0';
+               return MATCHER_SECTION;
+               }
 [-+]?[0-9]+    {
                yylval.str = yytext;
                return MATCHER_INTEGER;