+2002-04-07 [alfons] 0.7.4claws69
+
+ * src/matcher.[ch]
+ * src/prefs_filtering.c
+ * src/summaryview.c
+ escape \' and \" in strings passed as filtering strings; bug report by Alex Evseev.
+ (see http://www.geocrawler.com/lists/3/SourceForge/11619/25/8279435/)
+
2002-04-07 [paul] 0.7.4claws68
* sync with 0.7.4cvs32
MICRO_VERSION=4
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=claws68
+EXTRA_VERSION=claws69
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
return NULL;
}
+/* matcher_escape_str() - escapes a string returns newly allocated escaped string */
+gchar *matcher_escape_str(const gchar *str)
+{
+ register const gchar *walk;
+ register int escape;
+ gchar *res;
+ register char *reswalk;
+
+ if (str == NULL)
+ return NULL;
+
+ for (escape = 0, walk = str; *walk; walk++)
+ if (*walk == '\'' || *walk == '\"')
+ escape++;
+
+ if (!escape)
+ return g_strdup(str);
+
+ reswalk = res = g_new0(gchar, (walk - str) + escape + 1);
+ for (walk = str; *walk; walk++, reswalk++) {
+ if (*walk == '\'' || *walk == '\"')
+ *reswalk++ = '\\';
+ *reswalk = *walk;
+ }
+
+ *reswalk = 0;
+ return res;
+}
+
/* matcher_unescape_str() - assumes that unescaping frees up room
* in the string, so it returns the unescaped string in the
* source */
gboolean matcher_parse_boolean_op(gchar ** str);
gchar * matcher_parse_regexp(gchar ** str);
gchar * matcher_parse_str(gchar ** str);
+gchar * matcher_escape_str(const gchar *str);
gchar * matcher_unescape_str(gchar *str);
gchar * matcherprop_to_string(MatcherProp * matcher);
gchar * matcherlist_to_string(MatcherList * matchers);
#include "colorlabel.h"
#include "matcher_parser.h"
+#include "matcher.h"
static struct Filtering {
GtkWidget *window;
const gchar *header,
const gchar *key)
{
+ gchar *esckey;
+
if (prefs_rc_is_readonly(FILTERING_RC))
return;
cur_item = item;
- prefs_filtering_set_dialog(header, key);
+ esckey = matcher_escape_str(key);
+ prefs_filtering_set_dialog(header, esckey);
+ g_free(esckey);
gtk_widget_show(filtering.window);
break;
}
+ /*
+ * NOTE: key may be allocated on the stack, so
+ * prefs_filter[ing]_open() should have completed
+ * and have set entries. Otherwise we're hosed.
+ */
+
if (global_processing)
prefs_filtering_open(NULL, header, key);
else