Changeset bd65108
- Timestamp:
- Aug 15, 2009, 7:08:20 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 4542047
- Parents:
- 89b2daf
- git-author:
- Anders Kaseorg <andersk@mit.edu> (08/04/09 00:45:45)
- git-committer:
- Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:20)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
filterelement.c
rc08c70a rbd65108 48 48 } 49 49 50 static int owl_filterelement_match_false( owl_filterelement *fe, const owl_message *m)50 static int owl_filterelement_match_false(const owl_filterelement *fe, const owl_message *m) 51 51 { 52 52 return 0; 53 53 } 54 54 55 static int owl_filterelement_match_true( owl_filterelement *fe, const owl_message *m)55 static int owl_filterelement_match_true(const owl_filterelement *fe, const owl_message *m) 56 56 { 57 57 return 1; 58 58 } 59 59 60 static int owl_filterelement_match_re( owl_filterelement *fe, const owl_message *m)60 static int owl_filterelement_match_re(const owl_filterelement *fe, const owl_message *m) 61 61 { 62 62 const char * val = owl_filterelement_get_field(m, fe->field); … … 64 64 } 65 65 66 static int owl_filterelement_match_filter( owl_filterelement *fe, const owl_message *m)66 static int owl_filterelement_match_filter(const owl_filterelement *fe, const owl_message *m) 67 67 { 68 68 owl_filter *subfilter; … … 77 77 } 78 78 79 static int owl_filterelement_match_perl( owl_filterelement *fe, const owl_message *m)79 static int owl_filterelement_match_perl(const owl_filterelement *fe, const owl_message *m) 80 80 { 81 81 const char *subname; … … 97 97 } 98 98 99 static int owl_filterelement_match_group( owl_filterelement *fe, const owl_message *m)99 static int owl_filterelement_match_group(const owl_filterelement *fe, const owl_message *m) 100 100 { 101 101 return owl_filterelement_match(fe->left, m); … … 106 106 */ 107 107 108 static int owl_filterelement_match_and( owl_filterelement *fe, const owl_message *m)108 static int owl_filterelement_match_and(const owl_filterelement *fe, const owl_message *m) 109 109 { 110 110 return owl_filterelement_match(fe->left, m) && … … 112 112 } 113 113 114 static int owl_filterelement_match_or( owl_filterelement *fe, const owl_message *m)114 static int owl_filterelement_match_or(const owl_filterelement *fe, const owl_message *m) 115 115 { 116 116 return owl_filterelement_match(fe->left, m) || … … 118 118 } 119 119 120 static int owl_filterelement_match_not( owl_filterelement *fe, const owl_message *m)120 static int owl_filterelement_match_not(const owl_filterelement *fe, const owl_message *m) 121 121 { 122 122 return !owl_filterelement_match(fe->left, m); … … 125 125 /* Print methods */ 126 126 127 static void owl_filterelement_print_true( owl_filterelement *fe, GString *buf)127 static void owl_filterelement_print_true(const owl_filterelement *fe, GString *buf) 128 128 { 129 129 g_string_append(buf, "true"); 130 130 } 131 131 132 static void owl_filterelement_print_false( owl_filterelement *fe, GString *buf)132 static void owl_filterelement_print_false(const owl_filterelement *fe, GString *buf) 133 133 { 134 134 g_string_append(buf, "false"); 135 135 } 136 136 137 static void owl_filterelement_print_re( owl_filterelement *fe, GString *buf)137 static void owl_filterelement_print_re(const owl_filterelement *fe, GString *buf) 138 138 { 139 139 const char *re, *q; … … 148 148 } 149 149 150 static void owl_filterelement_print_filter( owl_filterelement *fe, GString *buf)150 static void owl_filterelement_print_filter(const owl_filterelement *fe, GString *buf) 151 151 { 152 152 g_string_append(buf, "filter "); … … 154 154 } 155 155 156 static void owl_filterelement_print_perl( owl_filterelement *fe, GString *buf)156 static void owl_filterelement_print_perl(const owl_filterelement *fe, GString *buf) 157 157 { 158 158 g_string_append(buf, "perl "); … … 160 160 } 161 161 162 static void owl_filterelement_print_group( owl_filterelement *fe, GString *buf)162 static void owl_filterelement_print_group(const owl_filterelement *fe, GString *buf) 163 163 { 164 164 g_string_append(buf, "( "); … … 167 167 } 168 168 169 static void owl_filterelement_print_or( owl_filterelement *fe, GString *buf)169 static void owl_filterelement_print_or(const owl_filterelement *fe, GString *buf) 170 170 { 171 171 owl_filterelement_print(fe->left, buf); … … 174 174 } 175 175 176 static void owl_filterelement_print_and( owl_filterelement *fe, GString *buf)176 static void owl_filterelement_print_and(const owl_filterelement *fe, GString *buf) 177 177 { 178 178 owl_filterelement_print(fe->left, buf); … … 181 181 } 182 182 183 static void owl_filterelement_print_not( owl_filterelement *fe, GString *buf)183 static void owl_filterelement_print_not(const owl_filterelement *fe, GString *buf) 184 184 { 185 185 g_string_append(buf, " not "); … … 276 276 } 277 277 278 int owl_filterelement_match( owl_filterelement *fe, const owl_message *m)278 int owl_filterelement_match(const owl_filterelement *fe, const owl_message *m) 279 279 { 280 280 if(!fe) return 0; … … 286 286 static int fe_visited = 1; 287 287 288 int owl_filterelement_is_toodeep(owl_filter *f, owl_filterelement *fe)288 int owl_filterelement_is_toodeep(owl_filter *f, const owl_filterelement *fe) 289 289 { 290 290 int rv; … … 300 300 } 301 301 302 int _owl_filterelement_is_toodeep( owl_filterelement *fe, owl_dict *seen)302 int _owl_filterelement_is_toodeep(const owl_filterelement *fe, owl_dict *seen) 303 303 { 304 304 int rv = 0; … … 338 338 } 339 339 340 void owl_filterelement_print( owl_filterelement *fe, GString *buf)340 void owl_filterelement_print(const owl_filterelement *fe, GString *buf) 341 341 { 342 342 if(!fe || !fe->print_elt) return; -
owl.h
r1fdab04 rbd65108 398 398 399 399 typedef struct _owl_filterelement { 400 int (*match_message)( struct _owl_filterelement *fe, const owl_message *m);400 int (*match_message)(const struct _owl_filterelement *fe, const owl_message *m); 401 401 /* Append a string representation of the filterelement onto buf*/ 402 void (*print_elt)( struct _owl_filterelement *fe, GString *buf);402 void (*print_elt)(const struct _owl_filterelement *fe, GString *buf); 403 403 /* Operands for and,or,not*/ 404 404 struct _owl_filterelement *left, *right;
Note: See TracChangeset
for help on using the changeset viewer.