[585] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r699 - trunk/owl

daemon@ATHENA.MIT.EDU (asedeno@MIT.EDU)
Thu Oct 29 18:07:41 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@MIT.EDU
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Thu, 19 Apr 2007 13:04:43 -0400 (EDT)

Author: asedeno
Date: 2007-04-19 13:04:43 -0400 (Thu, 19 Apr 2007)
New Revision: 699

Modified:
   trunk/owl/functions.c
Log:
When generating filters, change single quotes and double quotes into
dots, so they line parser doesn't choke on them.

This fixes problems smart-narrowing to instances such as "this'll break it".



Modified: trunk/owl/functions.c
===================================================================
--- trunk/owl/functions.c	2007-04-19 04:06:43 UTC (rev 698)
+++ trunk/owl/functions.c	2007-04-19 17:04:43 UTC (rev 699)
@@ -2652,8 +2652,10 @@
   }
   /* downcase it */
   downstr(filtname);
-  /* turn spaces into dots */
+  /* turn spaces, single quotes, and double quotes into dots */
   owl_text_tr(filtname, ' ', '.');
+  owl_text_tr(filtname, '\'', '.');
+  owl_text_tr(filtname, '"', '.');
   
   /* if it already exists then go with it.  This lets users override */
   if (owl_global_get_filter(&g, filtname)) {
@@ -2663,9 +2665,13 @@
   /* create the new filter */
   tmpclass=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
   owl_text_tr(tmpclass, ' ', '.');
+  owl_text_tr(tmpclass, '\'', '.');
+  owl_text_tr(tmpclass, '"', '.');
   if (instance) {
     tmpinstance=owl_text_quote(instance, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     owl_text_tr(tmpinstance, ' ', '.');
+    owl_text_tr(tmpinstance, '\'', '.');
+    owl_text_tr(tmpinstance, '"', '.');
   }
   len = strlen(tmpclass);
   if(tmpinstance) len += strlen(tmpinstance);
@@ -3084,6 +3090,8 @@
   } else {
     quoted=owl_text_quote(class, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     owl_text_tr(quoted, ' ', '.');
+    owl_text_tr(quoted, '\'', '.');
+    owl_text_tr(quoted, '"', '.');
     sprintf(buff, "%s ^(un)*%s(\\.d)*$", buff, quoted);
     owl_free(quoted);
   }
@@ -3092,12 +3100,16 @@
   } else {
     quoted=owl_text_quote(inst, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     owl_text_tr(quoted, ' ', '.');
+    owl_text_tr(quoted, '\'', '.');
+    owl_text_tr(quoted, '"', '.');
     sprintf(buff, "%s and instance ^(un)*%s(\\.d)*$", buff, quoted);
     owl_free(quoted);
   }
   if (strcmp(recip, "*")) {
     quoted=owl_text_quote(recip, OWL_REGEX_QUOTECHARS, OWL_REGEX_QUOTEWITH);
     owl_text_tr(quoted, ' ', '.');
+    owl_text_tr(quoted, '\'', '.');
+    owl_text_tr(quoted, '"', '.');
     sprintf(buff, "%s and recipient ^%s$", buff, quoted);
     owl_free(quoted);
   }


home help back first fref pref prev next nref lref last post