Changeset 32eed98 for filterelement.c


Ignore:
Timestamp:
Dec 26, 2003, 2:49:54 PM (17 years ago)
Author:
Erik Nygren <nygren@mit.edu>
Branches:
master, barnowl_perlaim, debian, owl, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5f82eb3
Parents:
4357be8
Message:
2.1.3-pre-2
	Added perl filter elements.  Similar to having "filter <subfilter>"
	  in a filter, you may also have "perl <functionname>"
	  where <functionname> is passed an owl::Message object and
	  returns 0 or 1 depending on whether the message matches
	  that element of the filter.
	  [Note: currently this overloads the filtername element
	  of the filterelement structure to store the function name.
	  Perhaps we should change the name of this element to something
	  more general to avoid confusion?]
File:
1 edited

Legend:

Unmodified
Added
Removed
  • filterelement.c

    r40458b9 r32eed98  
    1313#define OWL_FILTERELEMENT_RE          8
    1414#define OWL_FILTERELEMENT_FILTER      9
     15#define OWL_FILTERELEMENT_PERL       10
    1516
    1617void owl_filterelement_create_null(owl_filterelement *fe)
     
    7879}
    7980
     81void owl_filterelement_create_perl(owl_filterelement *fe, char *name)
     82{
     83  owl_filterelement_create_null(fe);
     84  fe->type=OWL_FILTERELEMENT_PERL;
     85  fe->filtername=owl_strdup(name);
     86}
     87
    8088void owl_filterelement_free(owl_filterelement *fe)
    8189{
     
    135143{
    136144  if (fe->type==OWL_FILTERELEMENT_RE) return(1);
     145  return(0);
     146}
     147
     148int owl_filterelement_is_perl(owl_filterelement *fe)
     149{
     150  if (fe->type==OWL_FILTERELEMENT_PERL) return(1);
    137151  return(0);
    138152}
     
    166180       (fe->type==OWL_FILTERELEMENT_FALSE) ||
    167181       (fe->type==OWL_FILTERELEMENT_RE) ||
     182       (fe->type==OWL_FILTERELEMENT_PERL) ||
    168183       (fe->type==OWL_FILTERELEMENT_FILTER)) {
    169184    return(1);
     
    193208  } else if (owl_filterelement_is_filter(fe)) {
    194209    return(owl_sprintf("filter %s ", fe->filtername));
     210  } else if (owl_filterelement_is_perl(fe)) {
     211    return(owl_sprintf("perl %s ", fe->filtername));
    195212  }
    196213
Note: See TracChangeset for help on using the changeset viewer.