[458] in BarnOwl Developers

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

[D-O-H] r587 - in trunk: . owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:06:23 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Thu, 8 Feb 2007 16:39:32 -0500
To: dirty-owl-hackers@mit.edu
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU

Author: nelhage
Date: 2007-02-08 16:39:31 -0500 (Thu, 08 Feb 2007)
New Revision: 587

Modified:
   trunk/
   trunk/owl/functions.c
   trunk/owl/util.c
Log:
 r18511@phanatique:  nelhage | 2007-02-01 12:03:34 -0500
 smartnarrowing to an unclass is now the same as narrowing to the
 corresponding class. We may want to make this more customizable.



Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18298
   + bb873fd7-8e23-0410-944a-99ec44c633eb:/branches/owl/filter-rewrite:15925
bb873fd7-8e23-0410-944a-99ec44c633eb:/local/d-o-h/trunk:18511

Modified: trunk/owl/functions.c
===================================================================
--- trunk/owl/functions.c	2007-02-06 23:05:13 UTC (rev 586)
+++ trunk/owl/functions.c	2007-02-08 21:39:31 UTC (rev 587)
@@ -2616,14 +2616,20 @@
  * instance is NULL then catch all messgaes in the class.  Returns the
  * name of the filter, which the caller must free.
  */
-char *owl_function_classinstfilt(char *class, char *instance) 
+char *owl_function_classinstfilt(char *c, char *i) 
 {
   owl_list *fl;
   owl_filter *f;
   char *argbuff, *filtname;
   char *tmpclass, *tmpinstance = NULL;
+  char *class, *instance = NULL;
   int len;
 
+  class = owl_util_baseclass(c);
+  if(i) {
+    instance = owl_util_baseclass(i);
+  }
+
   fl=owl_global_get_filterlist(&g);
 
   /* name for the filter */

Modified: trunk/owl/util.c
===================================================================
--- trunk/owl/util.c	2007-02-06 23:05:13 UTC (rev 586)
+++ trunk/owl/util.c	2007-02-08 21:39:31 UTC (rev 587)
@@ -736,6 +736,24 @@
   return(b);
 }
 
+/* Return the base class or instance from a zephyr class, by removing
+   leading `un' or trailing `.d'.
+   Modified ``class'' in place, and does not allocate memory.
+*/
+char * owl_util_baseclass(char * class)
+{
+  char * end;
+  while(!strncmp(class, "un", 2)) {
+    class += 2;
+  }
+  end = class + strlen(class) - 1;
+  while(*end == 'd' && *(end-1) == '.') {
+    end -= 2;
+  }
+  *(end + 1) = 0;
+  return class;
+}
+
 /**************************************************************************/
 /************************* REGRESSION TESTS *******************************/
 /**************************************************************************/


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